Articles ·
A backtest warms up the way a live run does
Indicators need history. An RSI(14) has no value until it has seen 14 changes, and its value keeps settling for a few dozen bars after that. A live run does not start blind: before its first decision it reads the market's recent closed bars and runs the strategy over them, so its indicators are ready on the first live bar.
A backtest has to do the same, or it measures a different strategy: one that sits idle at the start of every window, then decides on averages a live run would never have seen.
What a live run reads
| Run on | Warms on before its first decision |
|---|---|
| time bars (1m … 1d) | the last 1,000 closed bars of its own timeframe, or as many as its indicators need when that is more |
| range bars | the last 7 days of candles, cut into range bars the same way |
What a backtest does now
Every backtest fetches the history before its window and runs the strategy over it first:
- Time bars: 1,000 bars of the window's timeframe — or more, when the strategy's indicators need more (see how the warm-up is derived).
- Range bars: 7 days of the candles the range bars are cut from, cut into one continuous series with the window.
During the warm-up the strategy sees every bar exactly as a deployment warming on history would. The account does not
exist yet: nothing is traded, marked or charged. The account opens on the window's first bar, and everything in the
report — trades, equity curve, drawdown, returns, funding, bar counts — covers the window only. The result says how many
bars the strategy warmed on (warm_bars), and the app shows it next to the window ("warmed on 1000 bars before").
The warm-up reaches back only as far as the market's history goes; a market listed recently warms on what exists. It is also trimmed when a very long window would exceed what one backtest may fetch (50,000 bars per market, 100,000 across markets).
The difference it makes
A strategy that buys when price is above its 10-bar average, on hourly bars:
| First trade | |
|---|---|
| started cold at the window | the window's 11th bar — the average needs 10 bars first |
| warmed on the bars before | the window's 2nd bar — decided on the 1st, filled at the next open, as live |
For short windows, or strategies on slow averages, the cold start used to cut off a large part of the window and shift every trade after it.
Everywhere a backtest runs
- A single backtest and a comparison of versions warm on the bars before the window.
- Periods (a window split into parts, or named market regimes): each period warms on the bars before it, as a run started on that period's first day would.
- Baskets: every market warms on its own history.
- The parameter optimizer: the in-sample part trades after the warm-up; the out-of-sample part trades after the in-sample part, with the strategy already warm.
- Template showcases on the site are measured the same way.
In the API
POST /backtest takes from_ts, the open time of the first bar to trade. The bars before it only warm the strategy;
the report and report.config.warm_candles describe what was traded and what was warmed on. Batch requests take
from_ts and until_ts per window. For range bars, the limit on how many bars one backtest may replay counts only the
bars from from_ts on.