Parameterizing the Start Time of a Strategy Backtest
Summary
This document explains how to make a strategy's backtest start time configurable. A user supplies a year, month, day, hour, and minute; the script converts those inputs into a timestamp and allows strategy conditions to trigger only once the current bar time reaches that point. The example illustrates adding this time gate to moving-average crossover entries. The published settings also show a BTC_USDT futures backtest, but no trading performance results are presented because the method concerns test-window configuration rather than an entry strategy.
A custom start date can help examine a particular market period or event, but results can change substantially with the selected date. The document warns that repeatedly adjusting the start point to improve historical outcomes can create overfitting and make comparisons with fixed-window tests difficult. It recommends checking multiple start dates and keeping a fixed-date run as a reference. The described technique controls when strategy conditions become active; it does not by itself validate a strategy or define a complete backtest window, since an end-time control is only proposed as a possible extension.
Key ideas
- A timestamp built from user-selected calendar fields can gate when strategy entries become active.
- The example applies the gate to moving-average crossover conditions.
- Changing the start date can materially alter results and encourage historical overfitting.
- Comparing multiple start dates against a fixed-window benchmark can help assess sensitivity.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.