Analysis & metrics

Walk-forward analysis

A chronological evaluation that repeatedly fits a strategy on an earlier window and tests it on a subsequent unseen window. It can expose sensitivity to parameters and market changes, but does not prove future profitability. Keep optimisation, testing and cost assumptions separate, including any decisions made after seeing test results.
Example. Three illustrative steps fit on months 1–12 and test on 13–15; fit on 4–15 and test on 16–18; fit on 7–18 and test on 19–21. Test windows do not overlap. With 40, 50 and 30 trades averaging +0.10R, −0.04R and +0.20R, the combined mean is (4−2+6)/120 ≈ +0.0667R, rather than the unweighted mean of three means.

Evaluate the refitting procedure

Walk-forward also evaluates how and when the model is updated. Each step can use only earlier observations. Training windows can roll or expand; length, parameter range and update schedule should be specified before evaluation. In the example, an earlier test period can enter a later training window because it is then historical data. Knowledge gained that way cannot be applied retrospectively to an earlier test.

Combine results correctly

Join actual test segments only, with costs and sizing appropriate to each step. Do not add training performance to the validation curve. Overlapping tests can count a trade repeatedly; define attribution rules. Summed R or a per-trade mean is not automatically a compounded account return. Window boundaries must also specify how existing open positions are treated.

Limitations

Choosing the best window length after reviewing results is another fitting step. Few windows, small samples and dependent trades limit conclusions. Data processing fitted on the entire history can leak information despite correctly split dates. scikit-learn’s TimeSeriesSplit illustrates chronological splitting; the function does not itself resolve financial execution rules.

The cost of changing models

Refitting can change positions, order count or trading frequency. If switching variants requires closing and reopening, include those fills and charges in the evaluated procedure. Do not automatically erase an open loss at a window boundary or charge the same cost twice. Record account state between steps so the joined curve represents an achievable process rather than independent restarts with fresh capital.

Application

Keep each step’s parameters and results, observation counts, costs and failures. Compare stability against a frozen strategy without frequent tuning. Once the full procedure has been selected, conduct a further independent assessment rather than infer a promise from a few positive windows. In the course: strategy testing. Source checked on 11 October 2026.

Diagram and worked example

Educational infographic: Walk-forward analysis
Educational diagram; model data and assumptions are stated in the graphic.
Open the full-size graphic

FAQ

Does walk-forward eliminate overfitting?
No. It can reveal instability, but the procedure and its settings can also be fitted.
Can earlier test observations be reused?
Yes, in a later training step once available. This does not retrospectively change decisions made by the earlier version.

← Back to the full glossary

Jarosław Wasiński

Editor-in-chief, ForexMechanics.com • Macro & FX analyst

Independent analyst and practitioner with over 20 years of experience in financial markets. Actively involved in Forex since 2007, with a focus on fundamental analysis, OTC market structure, and disciplined capital risk management.

  • Creator and editor-in-chief of MyBank.pl, providing reliable financial education since 2004.
  • Author of hundreds of in-depth market commentaries, structural analyses, and educational materials for traders and investors.
  • Advocate for market transparency, promoting education grounded in hard data and institutional reports (BIS, ESMA, CFTC).

All content is educational and informational only – it does not constitute investment advice or a recommendation. Remember: leveraged trading (Forex/CFD) carries a high risk of rapid capital loss.