Guide · Backtesting method
Walk-forward testing with chronological, untouched test folds
Walk-forward testing splits history into consecutive blocks: you choose or tune rules on one block, then trade them unchanged on the next block you have not looked at. Only those later blocks count as evidence.
Short answer
Order sessions by date, pick rules on a training window, freeze them, then test on the next, unseen window. Roll both forward and repeat. Judge the strategy only on the joined test windows. Example: 12 months with 3-month training and 1-month tests gives 9 out-of-sample months.
Designing the folds
| Fold | Training (choose rules) | Test (untouched) |
|---|---|---|
| 1 | Months 1–3 | Month 4 |
| 2 | Months 2–4 | Month 5 |
| 3 | Months 3–5 | Month 6 |
| … | … | … |
| 9 | Months 9–11 | Month 12 |
Protocol for manual replay testing
- Write every rule before fold 1: market, session times, entry, stop, target, maximum trades per day, cost and slippage assumptions.
- List the test dates of every fold in advance and do not open them during training — not even to “check the chart”.
- On the training window, choose among a small number of pre-declared variants (for example a 15- or 30-minute opening range). More variants raise the chance of picking a lucky one.
- Freeze the chosen variant, then trade the test window bar by bar in replay, logging every trade in R.
- Roll forward and repeat. Never edit a finished test fold's log.
- Join all test-fold trades and compute expectancy and profit factor on that combined record only.
Worked example (hypothetical)
| Fold | Variant chosen in training | Training avg | Test trades | Test avg |
|---|---|---|---|---|
| 1 | 15-min range | +0.31R | 14 | +0.12R |
| 2 | 30-min range | +0.27R | 11 | −0.18R |
| 3 | 15-min range | +0.22R | 16 | +0.05R |
Common leaks
- Remembering a famous day you have seen before. Prefer dates you have not studied, or note the contamination.
- Using an end-of-day level (such as the day's high) inside a rule that fires earlier that day — lookahead.
- Changing the cost or fill assumption between training and test.
- Reporting the best fold instead of all folds.
Frequently asked questions
Why not just shuffle sessions randomly?
Markets change over time. Random splits let information from later periods leak into training, which a trader could never have had. Chronological folds respect the order in which you would really have learned.
Can I adjust the rules after a bad test fold?
Only for the next fold, using the next training window. The fold you just saw is now spent; re-testing on it is no longer out-of-sample.
Who formalised walk-forward analysis?
Robert Pardo is commonly credited with popularising walk-forward analysis for trading systems; this guide adapts the idea for manual, bar-by-bar replay.
References
- CFTC — Learn and protect: customer advisories
- Robert Pardo, The Evaluation and Optimization of Trading Strategies, 2nd ed. (Wiley, 2008)