Here is a fun little script that I put together. It trades the hook from an extreme reading on the cci so when the cci prints above the extreme level and then drops back below it or drops below the lower level and then trades above it you enter a trade with an atr stop and an adjustable atr profit multiple.

I have tried a few variations and 20, 100, 3 seems quite good. I am using this as a learning tool to learn how to use the optimisation features. I will try to include optimisation for one parameter to start with and then increase from there. If I get stuck I will ask for help!

I would be grateful for any help if you can see anything wrong with the script? I have set it to trade all possible instruments but of course they are not all profitable. With the losing instruments taken out it would probably be quite good.

Code:
function run() 
{
	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 = slider(3,2,1,5,"Profit ATR",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();
   }
}