Concept · example: ETH, week of 27 May 2024

Walk-forward test

How do you check whether a trading rule would have worked without letting it see the answer in advance?

In plain words

A walk-forward test builds a rule using only data from the past, then applies it unchanged to the next period, then rolls the window forward and repeats. The rule never sees the data it is being judged on, so each new period is a fresh test.

Why it matters

Testing a rule on the same data used to design it flatters the result, because the rule has already fitted that history. Walk-forward testing measures performance on unseen periods, which is closer to what a live position would experience. It also shows whether a rule holds up across different market conditions rather than one favourable stretch.

In a real week: ETH, week of 27 May 2024

For the week starting 2024-05-27, a rule fit only on the preceding weeks would have seen prior weekly returns of -3.89%, -6.6%, 4.84% and 24.59% before facing ETH's return of -1.19% for that week, with a range of 7.41% and a close in the lower third. Testing that rule again on the following week would be the next step in the walk-forward sequence.

A common mistake

Confusing a walk-forward test with a backtest on the full history. A full-history backtest uses the very data the rule was tuned on, so its results are inflated relative to what the rule delivers out of sample.

Related ideas

out-of-samplein-sample fitlook-ahead biasbacktest

Research notes on real market weeks, not investment advice. Sources: Binance spot BTCUSDT and ETHUSDT 1-hour candles and USD-M perpetual funding rates; weekly figures computed by WSTiger.

RISCON Labsrisconlabs.com