hi,
My code has a defined SL and Profit targets. sometimes the stock gets stopped out before actual SL is hit. the one example in BT is highlighted in yellow in the picture..Can you please help me out in fixing my code. thanks
Cond1 = ValueWhen(C,O<C);
Cond2 = R > 50;
Cond3 = ATR(14) < (C-O);
Cond4 = ((MH > 0 AND MH > Ref(MH, -1))OR (MH < 0 AND MH > Ref(MH, -1)));
Buy = Cover= O<C AND Cond3 AND Volume > x AND (C > EMA(C,200) ) AND (C > EMA(C,50) ) ;
Sell= Close<1;
Short=O>C AND (ATR(14) <(O-C)) AND Volume > x AND (C < EMA(C,200) ) ;
Filter=Buy;
ApplyStop(stopTypeProfit,
stopModePercent,
2.5,
True );
ApplyStop(stopTypeLoss, stopModePoint, Cross(EMA(Close,34),Close), True, True );