I am trying to create a simple template strategy (attached below) where I can benchmark my code. I thought the simplest way would be to track time between state changes, which raised a few questions:
a) the only call to OnStateChange after a backtest is the Terminated state where it has already cleaned up (including the StopWatch object). Shouldn't there be some call to OnStateChange when all the historical data has been processed (like the Transition state)?
b) To test the backtest time I created a check in the OnBarUpdate method. Is there a way to do this outside of the OnBarUpdate?
c) The documentation says the Terminated state gets called once but I see it getting called multiple times after a backtest. Can you explain what is happening?
d) How do I benchmark backtests? This approach doesn't work as the StopWatch gets reset after each iteration.
Comment