How Initialization Bars Can Affect Backtest Start Dates
Summary
The post discusses a possible source of inaccurate results near the beginning of a backtest in VeighNa’s BacktestingEngine. It describes an initialization period in which historical bars are loaded for strategy setup, followed by the bars used for strategy logic. In the described workflow, the selected start date marks the end of the initialization data, so earlier bars must be reserved for setup. The author warns that choosing a start date without that allowance can leave too little history for initialization and distort early results.
As an alternative, the author proposes running the selected start-to-end range linearly without separating initialization bars from strategy bars, and temporarily disabling the strategy’s initialization callback during backtesting. The post bases its concern on code inspection and observed deviations in a small portion of some runs; it provides no controlled comparison or quantified results. The proposed workaround may change strategy behavior, and the post does not explain how to ensure that backtest initialization matches live operation.
Key ideas
- The described engine reserves earlier bars to initialize a strategy before the chosen backtest start date.
- Insufficient initialization history may affect results near the beginning of a backtest.
- The author proposes running the selected date range linearly while disabling the initialization callback.
- The concern is based on code inspection and observed early-run deviations, without a controlled evaluation.
- The workaround may create differences between backtest initialization and live strategy behavior.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.