Walk-Forward Testing: How to Build Honest Backtests
Walk-forward testing checks a strategy on unseen data. Learn how in-sample and out-of-sample windows work, and why one great backtest proves very little.
A backtest is a story about the past. It tells you what a set of rules would have done on historical data. That is useful, but it is also dangerously easy to flatter. Given enough freedom, any strategy can be made to look excellent on history, and the more you adjust it, the better it looks.
Walk-forward testing is one of the most practical ways to keep a backtest honest. This article explains how it works, why it matters, and what it can and cannot tell you.
The problem: a strategy can always be fitted to the past
Imagine a strategy with a handful of parameters, such as the length of a moving average or the threshold for an indicator. If you try many combinations and keep the best one, you will find a combination that performed well on that particular stretch of history. That does not mean it captured anything lasting about the market. It may simply have matched the noise.
This is overfitting. The strategy has learned the past rather than a repeatable pattern. When it meets new data, performance often falls away, and the person who trusted the backtest is left wondering what went wrong.
The more parameters a strategy has, and the more combinations you try, the greater the risk. A single impressive equity curve is the visible end of a process you often cannot see.
What walk-forward testing does
Walk-forward testing splits history into a sequence of windows. In each window, the data is divided into two parts.
- In-sample: the earlier part, where the strategy’s parameters are tuned.
- Out-of-sample: the later part, which the tuning never saw. The chosen parameters are applied to it unchanged.
Then the window moves forward and the process repeats. At the end you have a series of out-of-sample results, each produced by parameters that were chosen without knowledge of the period they were tested on.
That is the key idea. Out-of-sample performance is a fairer guide than in-sample performance, because it was not shaped by the optimisation. If a strategy only works in-sample and falls apart out-of-sample, you have learned something valuable before risking anything.
A concrete example of the settings
In ArrowAlgo, walk-forward testing defaults to four windows, with 75% of each window used in-sample and 25% out-of-sample. In other words, the strategy is optimised on the first three quarters of each window and then tested on the remaining quarter, four times over different stretches of history.
These are defaults rather than laws of nature. A longer in-sample period gives the optimiser more data to learn from, while a longer out-of-sample period gives you a more reliable check. More windows test the strategy across more market conditions, but each window then contains less data. The right balance depends on the strategy and the amount of history available.
Reading the results
When a walk-forward test completes, look at the pattern rather than the headline number.
- Consistency: does the strategy perform acceptably in most out-of-sample windows, or does one lucky window carry the total?
- Degradation: how much worse is out-of-sample performance than in-sample? Some gap is normal. A very large one is a warning.
- Stability of parameters: do the best parameters stay similar from window to window, or jump around? Parameters that change wildly suggest the optimiser is chasing noise.
ArrowAlgo summarises this through an Overfitting Risk score that reflects how much of a strategy’s apparent performance holds up out-of-sample. It is a guide, not a guarantee, and a low score does not mean a strategy will make money. It means the backtest is less likely to be an artefact of tuning.
Fees and slippage are not optional
Even a well-designed walk-forward test can mislead if it ignores trading costs. Every trade has fees. Many also suffer slippage, which is the difference between the price you expected and the price you received.
High-frequency strategies are especially sensitive. A strategy that trades often may look profitable before costs and unprofitable after them, because many small gains are consumed by many small costs. Even for slower strategies, ignoring costs makes results look better than reality.
When you run a backtest, use realistic fee levels for the venue you intend to trade on, and test how sensitive results are to slippage assumptions. If a strategy only works with optimistic costs, treat it with suspicion.
Leverage deserves the same honesty. A leveraged strategy can be liquidated during a drawdown that an unleveraged one would survive. ArrowAlgo’s leverage backtesting, launched in January 2026, simulates margin and liquidation so that results reflect that risk rather than hiding it.
Why one great backtest proves little
It is tempting to treat a strong equity curve as evidence. It is better to treat it as a hypothesis. Several things can sit behind a single good result.
Selection. If you tried fifty ideas and kept the best, the best one probably benefited from luck. The more you try, the more likely a random strategy looks good.
Regime dependence. A strategy may have suited one market environment, such as a strong trend, and fail in another.
Small samples. A strategy with few trades has little statistical weight. A handful of winners can be coincidence.
Look-ahead and data errors. Subtle mistakes, such as using information that would not have been available at the time, inflate results. Careful tooling reduces this risk but does not remove the need for scepticism.
A good habit is to look for corroboration: results that hold across windows, across nearby parameter values, across different assets, and across time periods the optimiser never saw. Evidence accumulates from many modest checks, not from one spectacular chart.
What walk-forward testing cannot do
It is a better check, not a perfect one. Several limits are worth keeping in mind.
- It cannot predict regime change. Markets can behave in ways that no historical window contains.
- It can still be abused. If you run walk-forward tests repeatedly and keep tweaking the strategy until the out-of-sample results look good, you have turned the out-of-sample data into in-sample data.
- It does not account for everything. Liquidity, outages and changes to exchange rules can all affect live trading.
For that reason, walk-forward testing should be one step in a process that also includes small-scale live observation and ongoing monitoring.
A practical workflow
A sensible approach looks like this.
- Write the strategy as explicit rules, so it can be tested without ambiguity.
- Run a backtest with realistic fees and slippage, and leverage if you intend to use it.
- Optimise parameters sparingly, and prefer simple strategies with few of them.
- Run a walk-forward test and read the out-of-sample results, not just the totals.
- Check the overfitting indicators, and be prepared to discard an idea that fails.
- Watch any strategy that goes live, and treat unexpected behaviour as information.
This is the workflow that ArrowAlgo is designed to support, from its visual block builder through to walk-forward testing and an Overfitting Risk score. If you are curious about how testing fits into the wider system, see inside a modern algorithmic trading stack and our technology page.
Honesty is a feature
The goal of testing is not to produce impressive numbers. It is to find out, as cheaply as possible, whether an idea deserves further attention. A platform that makes it easy to discard bad ideas serves its users better than one that makes every idea look good.
If you would like to talk about how we approach research tooling, or about offering it under your own brand, you can book a conversation.
This article is for information only and is not investment advice.
