If the next bar after the current bar would fill a limit order, the fill event fires off on the current bar rather than the next bar. In other words, a fill event for a limit order doesn't align with the bar that filled it.
This misalignment messes up the logic for adjusting stops and targets on the current bar if the entry order's status has already been set to Filled before it actually happens, resulting in occasional errors in the backtest results.
I got around this by delaying stoploss and target processing until the bar following the fill event (which is the bar that actually caused the fill).
If others are accounting for this misalignment in their code and NinjaTrader corrects this behavior, it might break some things.
-Alex

Comment