Here it is. Basic donchian channel trading, enter one position on breakout of long period channel and exit when crossing the shorther channel. Not sure how to code the add ons the way you've done it with your DC trading method tho...

Guiom

Code:
function run()
{
	set(PARAMETERS|LOGFILE|TESTNOW);  // generate and use optimized parameters
	StartDate = 2006;
	BarPeriod = 1440;	// daily bars
	NumWFOCycles = 8; // activate WFO
	NumBarCycles = 4;	// 4 times oversampling
	
		var *Price_Close = series(priceClose());
		var *Donchian_Entry = series(DChannel(optimize(30,35,70,5)));
		var *DE_Up = series(rRealUpperBand);
		var *DE_Down = series(rRealLowerBand);
		var *Donchian_Exit = series(DChannel(optimize(5,5,30,5)));
		var *DEx_Up = series(rRealUpperBand);
		var *DEx_Down = series(rRealLowerBand);

	while(asset(loop("AUD/USD","EUR/USD","GBP/USD","GER30","NAS100","SPX500","UK100","UKOil","US30","USD/CAD","USD/CHF","USD/JPY","USDOLLAR","USOil","XAG/USD","XAU/USD")))
	{
		Stop = optimize(2,1,10)*ATR(20);
		
		if(Train)
			Lots = 1;
		else if(OptimalFLong > 0) {
			Lots = 1;			 
			Margin = clamp((WinLong-LossLong) * OptimalFLong/2, 50, 10000);
		} else if(OptimalFShort > 0) {
			Lots = 1;
			Margin = clamp((WinShort-LossShort) * OptimalFShort/2, 50, 10000);
		} else
			Lots = 0; // switch off trading
		
		if(crossOver(Price_Close,DE_Up[1]) and numLong(0)==0)
			enterLong();
		else if(crossUnder(Price_Close,DE_Down[1]) and numShort(0)==0)
			enterShort();
		else if(crossOver(Price_Close,DEx_Up[1]) and numShort(0)>=1)
			exitShort();
		else if(crossUnder(Price_Close,DEx_Down[1]) and numLong(0)>=1)
			exitLong();
	}	

}