Consider this code:
SetOption("AllowSameBarExit",False);
SetOption("AllowPositionShrinking", False);
SetOption("FuturesMode", True);
SetOption("InterestRate",3);
SetOption("MaxOpenPositions",1);
SetOption("MinShares",50);
SetOption("PriceBoundChecking",False);
SetOption("CommissionMode",1);
SetOption("CommissionAmount",0.04);
SetOption("AccountMargin",25);
SetOption("ReverseSignalForcesExit",False);
SetOption("UsePrevBarEquityForPosSizing",True);
MarginDeposit = 0.25*C*50;
PositionSize = MarginDeposit *4;
SetTradeDelays(0,0,0,0);
BuyPrice = Close;
SellPrice = Close;
ShortPrice = Close;
CoverPrice =Close;
Buy = (EMA(C,5)>EMA(C,20)) AND (EMA(C,10)>EMA(C,20));
Sell = (EMA(C,5)<EMA(C,20)) AND (EMA(C,10)<EMA(C,20));
Buy =ExRem(Buy,Sell);
Sell= ExRem(Sell,Buy);
PlotShapes(IIf(Buy,shapeUpArrow,0),colorGreen,0,L,-15);
PlotShapes(IIf(Sell,shapeDownArrow,0),colorRed,0,H,-15);
In this code, thought scan and the "PlotShapes" work perfectly, while
backtesting nothing seems to work out. No trades are being thrown and more
importantly, the funds just increase by 3% annually, as given in the annual
interest rate option.
Please do help!