BullsEdges algo trading guide: Walk-forward testing repeatedly optimises on one period and tests on the next. It is one of the most realistic ways to judge an adaptive strategy.
A single in-sample/out-of-sample split tests one moment in time. Walk-forward testing repeats that test many times, rolling through history the way you would actually re-optimise a strategy in real life.
BullsEdges algo trading application: Repeat development and validation across successive periods while preserving the order of time and keeping future data unavailable.
How it works
- Choose a training window (for example 12 months) and a testing window (for example 3 months).
- Optimise the strategy on the first 12 months.
- Run the best settings on the next 3 months, without changing them. Record the results.
- Move both windows forward by 3 months and repeat.
- Join all the testing periods together. That combined result is the walk-forward performance.
Every trade in the walk-forward result was made with settings chosen only from data before it - just like live trading.
What it tells you
- Whether optimisation helps at all. If re-optimised settings do no better than fixed ones, keep it simple.
- How stable the best settings are. If the "best" parameters jump around wildly each window, the strategy is probably fitting noise.
- Realistic expectations. The walk-forward equity curve is usually less impressive than the full-period optimisation, and much closer to what you will get live.
Walk-forward efficiency
A useful ratio is the annualised walk-forward return divided by the annualised in-sample return. Values around 0.5 or higher are often considered healthy; very low values suggest the in-sample results are mostly overfitting.
Choosing the windows
- The training window needs enough trades to optimise meaningfully - usually hundreds.
- The testing window should be long enough to include several trades but short enough to reflect how often you would really re-optimise.
- Try more than one window size. Results that only work for one exact combination are fragile.
Anchored vs rolling
- Rolling: the training window has a fixed length and moves forward.
- Anchored: the training window always starts at the beginning of the data and grows.
Rolling adapts faster to new conditions; anchored is more stable.
Simpler alternative
If a full walk-forward is too much work, a minimum version is:
- Optimise on the first half, test once on the second half.
- Then do the reverse.
- If both directions hold up, the strategy is more likely to be robust.
BullsEdges takeaway for algo trading
Walk-forward testing answers the question that matters: if I had followed this process in the past, would it have made money? It is more work than a single backtest, and much more honest.
Trading forex and gold carries a high level of risk and may not be suitable for every investor. Past performance and backtests do not guarantee future results. This article is education, not financial advice.
