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:

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").

A timeline: 1,000 bars of warm-up in which the strategy runs and there is no account, then the window, where the account opens on the first bar and everything in the report is measured.
The strategy runs through the warm-up as a deployment would; the account opens only on the window’s first bar.

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
Twelve bars of a window, twice. Started cold, the strategy decides on the 10th bar and its first trade is on the 11th. Warmed on bars before the window, it decides on the 1st and trades on the 2nd.
The same strategy, buying above its 10-bar average: its first trade comes on the 11th bar cold and on the 2nd warm.

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

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.