I have two implementations of the same strategy in NinjaTrader:
- A monolithic strategy (single series, logic inside the strategy)
- A modular version (logic in an indicator, strategy only routes orders, multi-BIP)
Both use the same conditions (EMA crosses, same filters, same parameters).
I built a bar-by-bar compare logger and confirmed:
All signals (Entry1, Entry2, Exit) are 100% identical on every bar.
However, the backtest trade lists are not identical (some trades are missing or extra).
So the problem is not the signal logic, but order / position handling.
Here is a simplified example of the structural difference:
Version A (single strategy):
// Single position model
EntriesPerDirection = 1;
if (CrossAbove(m, s, 1))
EnterLong(1, "Long");
if(CrossAbove(s, m, 1)
EnterLong(1, "Long");
if (CrossBelow(f, m, 1))
ExitLong("Exit", "Long");
Version B (routed / multi-BIP style):
// Allows multiple entries
EntriesPerDirection = 1;
if (signalEntry1)
EnterLong(1, "ENTRY1");
if (signalEntry2)
EnterLong(1, "ENTRY2");
if (signalExit)
{
ExitLong(1, "EXIT1", "ENTRY1");
ExitLong(1, "EXIT2", "ENTRY2");
}
Even if signalEntry1, signalEntry2, and signalExit are identical to Version A’s logic on every bar, NinjaTrader’s internal position aggregation and order mapping can lead to different executed trades.
My questions:
How can two strategies with identical signals produce different trades?
What is the correct way to structure order/position handling (signal names, EntryHandling, multi-series routing) so both versions produce exactly the same trades?
Any insight into NinjaTrader’s internal position aggregation, signal name handling, or multi-BIP execution model would be appreciated.