Len = Optimize("Len", 20, 15,25,5);
Profit = Optimize("% Profit", 200, 200,1600,200);
Loss = Optimize("% Loss", 100, 100,1000,100);
DMA = MA(C,Len);
Buy = C > DMA;
Sell = C < DMA;
Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);
Short = Sell;
Cover = Buy;
SetPositionSize(1,4);
ApplyStop(stopTypeProfit, stopModePoint, Profit);
ApplyStop(stopTypeLoss, stopModePoint, Loss);