Easylanguage Code
//NEXT BAR EXIT
If MarketPosition = 1 and barssinceentry > HTL then Sell next bar at market;
Ninjatrader8 Code
//EXIT
if(Position.MarketPosition == MarketPosition.Long && (BarsSinceEntryExecution(0, "NQ_30min_BO50", 0) > HTL))
{ ExitLong(Convert.ToInt32(Qty), "Exit", "NQ_30min_BO50"); }
////////////////////
Explaination:
In Easylanguage this code will exit the position on the open of the HTL bar + 1
So for example:
HTL = 5 and MarketPosition = 1
Strategy enters at 1:00 AM and it holds 5 bars (30 min bars) which is 2.5 hours and then exits on the NEXT bar. So it really holds 3 hours and exits at 4:00:01AM
In NT8 the exit condition is only valid if its been 6 bars (6 > 5 (HTl)) which means it also holds 3 hours. Is this correct?
If this code matches then why is seeing incorrect exits