This scenario uses 'TickReplay = true' and one of the indicators and the strategy are set to 'CalculateOnEachTick'.
The overall load time of the strategy is SIGNIFICANTLY slower than the sum of the load times for the individual indicators and the OnBarUpdate time of the strategy.
In trying to isolate where the time is being spent I determined that it is in the Update() method for the loaded indicators.
The issue is that the amount of time is disproportionately bigger when the strategy loads the indicators versus just loading the same indicators on the chart.
In my test (about 690,000 calls to OnBarUpdate) the total strategy load time is 80 seconds. If I load those same indicators alone on the chart the total load time is about 10 seconds.
I am pretty sure the time is spent in the call to Update() because I tried 2 versions of the strategy: 1) The strategy calls the Update method on each indicator in OnBarUpdate and 2) The strategy does not call Update , leaving it up to Ninja to call it, which it does.
I could measure the time that the calls to Update took and it was about the same in both versions, except that in version 1 the time was in my code and in version 2 the time was in Ninja code (outside my OnBarUpdate).
The net result was about the same total load time but when my code called Update(), about 60 seconds of the time was in the strategy OnBarUpdate method. When strategy did not call Update, then about 78 of the 80 seconds was spent outside of OnBarUpdate.
This seems fishy since when loaded together on a chart the worst case is about 10 seconds. Something is surely inefficient when it takes Ninja 70 seconds longer to process the same indicators when loaded from a strategy.
Any ideas on what is causing the huge difference in load times?
Thanks,
Gary
Comment