I am running several strategies on NinjaTrader 8 in RealTime for testing purposes. Each strategy is assigned to one simulation account. Further, each strategy trades in one data series with only one instrument either "ES 03-21", "YM 03-21", or "MYM 03-21" (index futures).
Most aspects of real-time trading are working fine, i.e. each strategy can open and close positions. On closing a position, all account items are updated properly.
But there is one problem with SystemPerformance.AllTrades because this collection is empty for all strategies and at all times during trading.
protected override void OnPositionUpdate( ... ) { ... Log( "Number of Trades: " + SystemPerformance.AllTrades.Count, .... ); // Prints "Number of Trades: 0" Log( "Number of Trades: " + SystemPerformance.AllTrades.TradesCount, .... ); // Prints "Number of Trades: 4" i.e. the number of trades made by ALL strategies. ...
I searched this community for answers to my problem. For instance, one thread suggested setting the parameter IncludeTradeHistoryInBacktest = True. But it won't help either.
Can you assist me to correct this problem? I would like to analyze the trades for each strategy in the method OnPositionUpdate().
Many thanks in advance.
Comment