Walk-Forward Analysis Explained
Walk-forward analysis tests whether a trading system stays profitable as parameters are re-optimized over rolling windows, and this guide explains the process and interpretation for beginners.
翻訳ビューではインタラクティブツールが動作しない場合があります。
Walk-Forward Analysis Explained
A single backtest asks "did the system work?" Walk-forward analysis asks "will the system keep working?"
The problem walk-forward solves
Standard backtesting optimizes parameters on historical data, then tests on out-of-sample data once. But in live trading you would re-optimize periodically — quarterly, yearly — as market regimes shift. Walk-forward analysis (WFA) simulates this: optimize on a rolling window, trade the next window, repeat. It is the most realistic test of a system's adaptability.
How WFA works
- Split the data into segments. Common pattern: optimize on 2 years, test on next 6 months, slide forward 6 months, repeat.
- Optimize parameters on the in-sample (IS) window.
- Apply the best parameters to the immediately following out-of-sample (OOS) window.
- Slide the window forward and repeat until you reach the present.
- Stitch together all OOS results — this is the "walk-forward equity curve."
The stitched OOS curve is what you would have actually earned had you re-optimized on this schedule in real life.
An example with numbers
Total data: 2015–2025 (10 years). Pattern: 2-year IS, 6-month OOS.
| Window | Optimize on | Test on |
|---|---|---|
| 1 | 2015–2016 | 2017 H1 |
| 2 | 2015 H2–2017 H1 | 2017 H2 |
| 3 | 2016–2017 | 2018 H1 |
| ... | ... | ... |
| Last | 2023–2024 | 2025 H1 |
The OOS periods combined = roughly 5 years of forward-tested results. If the system is robust, the OOS expectancy stays positive across most windows.
Walk-forward efficiency
Walk-forward efficiency (WFE) compares OOS performance to IS performance:
WFE = OOS Profit / IS Profit
- >100%: OOS outperformed IS (rare, suspicious)
- 50–100%: strong robustness
- 25–50%: acceptable
- <25%: severe overfitting
- Negative: IS was overfit, OOS lost money
Most professional systems sit in the 30–60% range. Anything above 70% should be examined for hidden look-ahead.
What WFA catches that single-pass tests miss
- Parameter decay: parameters that worked in 2018 but failed by 2022
- Regime sensitivity: system works in low-vol periods but dies in high-vol
- Overfit parameters: IS profit collapses in OOS
- Lucky single period: a great 2017 result doesn't repeat elsewhere
Choosing window sizes
| Parameter | Tradeoff |
|---|---|
| IS window | Longer = more data per optimization, but slower to adapt to regime shifts |
| OOS window | Longer = more OOS data per cycle, but fewer cycles overall |
| Slide step | Smaller = more cycles (more robust), more compute time |
A common starting point: 2-year IS, 6-month OOS, 3-month slide. Adjust based on data frequency and compute budget.
WFA tools
- NinjaTrader: built-in WFA in Strategy Analyzer
- MultiCharts: native walk-forward optimizer
- Amibroker: comprehensive WFA suite
- TradingView Pine: limited — must script manually
- Python (backtrader, vectorbt): full control, requires custom code
For strategies in MQL, MT5's Strategy Tester has a genetic optimization mode but no native WFA — you must run multiple passes manually.
Practical workflow
- Lock your strategy logic and parameter ranges.
- Define window sizes (start conservative: 2y IS, 6m OOS).
- Run the WFA on as long a history as possible.
- Inspect the OOS trade list — are losses distributed or clustered?
- Compute WFE. Below 25% = back to the drawing board.
- If WFE is acceptable, run Monte Carlo simulation on the OOS trades (next article).
- Only then move to forward demo testing.
What WFA does not catch
- Survivorship and look-ahead bias — fix these in your data first
- Future regime shifts — past robustness doesn't guarantee future returns
- Black swans — events outside the historical sample
- Slippage regime changes — past slippage may understate future
Common WFA mistakes
- Optimizing too many parameters — results become noise even within WFA
- Too-short IS windows — unstable parameter estimates
- Too-short OOS windows — too few trades per cycle to be meaningful
- Reporting only the best cycle — average across all cycles matters
- Choosing window sizes that fit a desired outcome — pre-commit to sizes
Interpreting results
A "passing" WFA looks like:
- OOS profit positive in 70%+ of cycles
- OOS maximum drawdown within 1.5× of IS drawdown
- WFE above 30%
- No single cycle carries the bulk of total profit
If a single cycle produces 80% of total OOS profit, the system is dependent on one lucky period — treat it as failed.
Next: parameter optimization in depth — and how to recognize when you've crossed into overfitting.
Live Chart
Open full chart →Related market data, powered by TradingView.