Ok, here is my first attempt at using optimisation. If I use the train button it does test the parameters and the test then comes out with a higher profit figure so I am guessing that it did something but I don't get a graph from the test function with the parameters on like you do in the tutorials. Am I doing something wrong? What should the LookBack period be set to?

Code:
function run() 
{
	set(PARAMETERS);
	BarPeriod = 1440;
	LookBack = 500;
	
	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")))
	
	{
	var *ClosePrice = series(priceClose());
	var ccilength = slider(1,20,5,100,"Length",0);
	var cciextreme = slider(2,100,50,300,"Extreme",0);
	var cciextremen = (cciextreme*-1);
	var profatr = optimize(3,1,5,0.5,0);
	var *cci = series(CCI(ccilength));
	Stop = ATR(20);
	Profit = profatr*ATR(20);
	
	if(cci[1] > cciextreme && cci[0] < cciextreme)
	    enterShort();
	if(cci[1] < cciextremen && cci[0] > cciextremen)   
	    enterLong();
   }
}