Skip to Main Content

Risk & Quant

Walk-⁠Forward Analysis

Walk-forward analysis is a backtesting method that repeatedly optimizes a strategy on past data and tests it on the next unseen segment, stepping forward through time.
Also Called
  • Walk-Forward Optimization
  • Rolling Optimization
  • Walk-Forward Testing
  • WFA
By InsiderFinance TeamUpdated Sources & Methodology

Advance Training and Evaluation by Three Months

Window endpoints mark boundaries. Each evaluation window starts after its training cutoff; 16 evaluation windows cover months 12 through 60.
FoldTraining WindowEvaluation Window
1Months 0 to 12Months 12 to 15
2Months 3 to 15Months 15 to 18
3 to 15Months 6 to 18 through 42 to 54Months 18 to 21 through 54 to 57
16Months 45 to 57Months 57 to 60
Window endpoints mark boundaries. Each evaluation window starts after its training cutoff; 16 evaluation windows cover months 12 through 60.
On This Page
  1. What is walk-forward analysis?
  2. Walk-forward analysis example: 60 months, 16 folds
  3. How to keep each fit free of future data
  4. One continuous portfolio record across folds
  5. Walk-forward efficiency ratio
  6. Rolling vs anchored walk-forward windows
  7. Limitations of walk-forward analysis
  8. Bottom line
  9. FAQ

Key Takeaways

  • Walk-forward analysis splits history into repeated in-sample optimization windows and immediately following out-of-sample test windows, then steps forward through the data.
  • Build the evaluation record from the next-segment returns generated by each preceding fit. Each observation counts once under the declared portfolio rule.
  • Use the sequence to evaluate the complete refitting procedure, including the objective, candidate set, window lengths and update schedule.
  • Windows can be rolling (fixed length) or anchored (expanding), and re-optimization lets parameters adapt to changing market regimes.
  • Compare evaluation and development metrics using an explicitly defined aggregation. A return ratio summarizes those records; review the trades behind a gap to find its cause.

What is walk-forward analysis?

Walk-forward analysis is a backtesting method that repeatedly fits a strategy on available past observations and evaluates it over the next, unseen interval, then steps forward and repeats. Linking the evaluation intervals produces one out-of-sample record for the whole refitting procedure, which estimates how the strategy would have behaved if it had been re-optimized on that schedule.

It is a form of backtesting for a predefined adaptive procedure. Define the candidate set, fitting objective, training length, evaluation length and step before the final assessment. Selection among those designs belongs to development or validation.

Formula

Example efficiency ratio = pooled out-of-sample CAGR / arithmetic mean of the 16 selected training-window annual returns = 18% / 40% = 0.45.
  • This example uses a positive 40% denominator. A zero denominator makes the ratio undefined; negative values do not support a simple retained-performance reading.
  • The 16 nonoverlapping three-month evaluation windows form a four-year record. Apply continuous capital, position and cost accounting across boundaries.
  • The overlapping training windows are summarized separately. Do not concatenate them as one investable performance record.

Walk-forward analysis example: 60 months, 16 folds

Use 60 months of observations, a 12-month training window, a three-month evaluation window and a three-month step. This produces 16 folds. In this illustration, the mean of the selected training-window annual returns is 40% and the four-year evaluation CAGR is 18%.

  • Mean of the 16 selected training-window annual returns: 40%.
  • CAGR of the pooled 48-month evaluation record: 18%.
  • Walk-forward efficiency: 18% / 40% = 0.45
  • Fold count: (60 − 12) / 3 = 16 complete nonoverlapping evaluation windows.

The defined ratio is 0.45. Evaluate the four-year return record, drawdown, exposure, trading costs and parameter changes together. The ratio sizes the gap between the two summaries, and the fold-by-fold record shows its cause.

Use 12 months for training and three months for evaluation, advancing three months at each step.

Fold 1 trains over months 0 to 12 and evaluates months 12 to 15. Fold 2 trains over months 3 to 15 and evaluates months 15 to 18. Fold 16 trains over months 45 to 57 and evaluates months 57 to 60.

The endpoints are boundaries between intervals. Sixteen evaluation windows cover 48 months without gaps or duplication.

How to keep each fit free of future data

Use only inputs and training outcomes available at the fitting cutoff. If a target depends on a later exit or future return, that outcome must be complete before it enters the training set.

Fit learned preprocessing within the permitted data. Apply the selected procedure to the next interval, including any predefined causal updates.

An observation evaluated in an early fold can become training data in a later fold. Its earlier result remains out of sample relative to the earlier fit.

One continuous portfolio record across folds

Link evaluation returns in chronological order with one capital and position ledger. Specify how open positions cross a refitting boundary and account for turnover and costs when settings change.

If evaluation windows overlap, define which prediction or portfolio allocation applies at each time before aggregating results. Do not count the same capital return twice.

Walk-forward efficiency ratio

In the example, the arithmetic mean of the 16 selected training-window annual returns is 40%. The four-year pooled evaluation CAGR is 18%. Their explicitly defined ratio is 0.45.

The training windows overlap and are not one continuous portfolio track record. Keep their aggregation separate from the nonoverlapping evaluation record.

A zero denominator makes the ratio undefined. Evaluate return, drawdown, exposure, costs and parameter changes directly to understand the procedure’s behavior.

Rolling vs anchored walk-forward windows

A rolling window keeps a fixed length. An anchored window retains its initial start date and adds observations over time. The estimator and weighting determine how each procedure responds to new data.

Limitations of walk-forward analysis

  • Start live trading at reduced size and let the forward record confirm the result. The walk-forward record still comes from one historical path, and a market regime that differs from the sample can change how the refitting procedure performs.
  • Fix the window lengths, step and objective before the run. Choosing them after seeing walk-forward results makes the record part of the selection process, and the chosen design then needs fresh data for a final test.
  • Explain the efficiency ratio from the fold-by-fold record. The ratio compares two defined summaries, is undefined at a zero denominator and has no simple reading when values are negative.
  • Use evaluation windows long enough to hold a meaningful number of trades. Short windows hold few observations each, so the stitched record can be noisy.
  • Model positions that cross refit boundaries, turnover and costs. Without them, results can overstate what was achievable.

Bottom line

Walk-forward analysis tests the whole re-optimization process, not one fixed parameter set, by repeatedly fitting on the past and evaluating the next unseen segment. Fix the window lengths, objective and schedule in advance, account for costs across refits, and judge the linked out-of-sample record on return, drawdown and turnover together.

Clear answers

Frequently Asked Questions

Sources and Further Reading

  1. CFA Institute: Backtesting and Simulation (refresher reading)
  2. Bailey, Borwein, Lopez de Prado, Zhu: Pseudo-Mathematics and Financial Charlatanism
  3. Bailey, Borwein, Lopez de Prado, Zhu: The Probability of Backtest Overfitting

How entries are sourced, calculated and updated: editorial methodology.

Continue learning