i Short answer
A walk-forward test develops a strategy on one period of data, tests it on the next period it has never seen, then rolls both windows forward and repeats. The combined out-of-sample results show how the strategy would have performed if you had tuned it in real time. A common summary is walk-forward efficiency: out-of-sample results divided by in-sample results. In the worked example, +0.12R out of sample against +0.30R in sample is 40% efficiency, a sign of some real edge but much less than the backtest suggested.
The expectancy calculator gives the average result per trade for each in-sample and out-of-sample window.
📋 ON THIS PAGE
1. How does a walk-forward test work?
Split the history into consecutive blocks. Tune the strategy on the first block (in sample), apply the chosen settings unchanged to the next block (out of sample) and record those results. Then shift forward one block and repeat until the data runs out. Only the out-of-sample results count as evidence. It is the main defence against the problem described in overfitting.
| Round | In sample (tune) | Out of sample (test) |
|---|---|---|
| 1 | 2018–2019 | 2020 |
| 2 | 2019–2020 | 2021 |
| 3 | 2020–2021 | 2022 |
| 4 | 2021–2022 | 2023 |
| 5 | 2022–2023 | 2024 |
| 6 | 2023–2024 | 2025 |
2. How do you read walk-forward results? A worked example
Assumptions (hypothetical example): across the six rounds, the tuned settings averaged +0.30R per trade in sample; the same settings averaged +0.12R per trade on the following out-of-sample years; 300 out-of-sample trades in total; R500 risk per trade.
| Measure | Working | Result |
|---|---|---|
| Walk-forward efficiency | 0.12R ÷ 0.30R | 40% |
| Out-of-sample profit | 300 × 0.12R × R500 | R18,000 |
| What a backtest alone would have suggested | 300 × 0.30R × R500 | R45,000 |
The strategy kept some edge out of sample, which is encouraging, but well under half of what the in-sample tuning promised. Planning around the out-of-sample figure is far safer. Many practitioners treat efficiency well above 50% as a good sign and near zero as a warning, though no threshold is universal.

⬇ Download this summary (PNG) · Free to share with the credit “Source: TradeAnswers” (CC BY 4.0).
3. Why is walk-forward testing better than a single backtest?
A single backtest tunes and tests on the same data, so it overstates results. Walk-forward testing mimics real life, where you always trade on data you have not seen yet, and it shows whether the strategy survives changing conditions across several periods. Pairing it with a degradation test, which checks sensitivity to settings, gives a fuller picture.
4. How long should the windows be?
Long enough to contain a meaningful number of trades in each out-of-sample block, often 30 or more, and short enough to give several rounds. Strategies that trade rarely need longer windows. Keep the rules for choosing settings fixed across rounds; changing them midway undoes the point of the test.
- Fix the rules and the tuning method before starting
- Choose window lengths with enough trades in each test block
- Never adjust settings using out-of-sample results
- Combine out-of-sample results for the final verdict
- Compare live results with the out-of-sample figure
5. What comes after a walk-forward test?
Demo or small live trading with the latest settings, measured against the out-of-sample expectancy rather than the in-sample one; the difference between demo and paper trading is covered in paper versus demo trading. Over time, live results that fall well below even that figure may point to edge decay. Software that automates the process is discussed in backtesting platforms (CME Group, technical analysis course).
6. What are the limits of walk-forward testing?
It still uses past data, so it cannot predict a market regime that has never occurred. Running many walk-forward tests with different window choices and keeping the best reintroduces overfitting. And it needs enough data to produce several rounds, which is hard for slow strategies. Testing basics are covered in backtesting.
★ Why It Matters
A walk-forward test answers the question a backtest cannot: how would this strategy have done if I had tuned it with only the data available at the time? The out-of-sample figure, not the in-sample one, is the number to plan around.
✕ Common mistakes
- Planning around in-sample results. In the example they overstated the edge by 2.5 times.
- Adjusting settings after seeing out-of-sample results. That turns the test into tuning.
- Using test windows with too few trades. Aim for 30 or more per block.
- Running many walk-forwards and keeping the best. That is overfitting again.
Key Takeaways
- Split data into in-sample and out-of-sample periods before optimising.
- Never adjust parameters after seeing out-of-sample results.
- Record each walk-forward window’s result in a table.
- Reject strategies that only work in one window.
Frequently asked follow-up questions
What is a walk-forward test?
A test that tunes a strategy on one period, tests it on the next unseen period, and repeats as it rolls forward.
What is walk-forward efficiency?
Out-of-sample results divided by in-sample results, a measure of how much of the tuned edge survives.
How is it different from a backtest?
A single backtest tunes and tests on the same data; walk-forward tests only on unseen data.
How long should each window be?
Long enough for each out-of-sample block to hold enough trades that its average is not mostly noise; more trades per block narrow the margin of error.
Does walk-forward testing guarantee future results?
No, but it gives a more realistic estimate than a single backtest.
