A guide for anyone who has run a backtest and wants to know whether the strategy actually holds up — or whether it just looked good by accident.
It's a way of testing a strategy the way it would actually be used in real life — one period at a time, always on data it hasn't seen before.
Imagine you're studying for an exam. If the teacher gives you the question paper in advance and you memorise the answers, getting 100% doesn't tell you whether you actually understand the subject. It just tells you that you memorised.
A normal backtest is a bit like that. You pick the strategy that made the most money over the last 5 years — but you picked it after seeing the whole 5 years. Of course it looks good. You chose it because it looked good.
Walk-forward analysis tests the strategy differently. It splits the history into a series of chunks. On the first chunk, it picks the best settings. Then it tests those settings on the next chunk — a chunk the strategy has never seen. Then it slides forward by a bit and does it again. And again.
Because the tests keep landing on data the strategy was never tuned on, the results are much closer to what you'd actually get in live trading.
Because a good result on the full history can be a lucky accident. Walk-forward tells you whether the strategy keeps working when the future arrives.
Every strategy has settings — how much loss to allow, when to exit, which indicator threshold to use. A regular backtest finds the settings that would have made the most money in the past. But that's a trap: some settings only worked because of one-off events in that exact period.
Walk-forward catches this. It asks a harder question: "If I had kept re-picking the settings every 6 months, using only what I knew up to that point — would the strategy have kept making money?"
The one-line version: a regular backtest tells you what would have worked. Walk-forward tells you what was actually knowable at the time.
Each cycle has two halves: a training window where the strategy is tuned, and a test window where those settings are checked — without any changes.
Here's the standard setup StockWise uses:
Then the whole thing slides forward by 6 months and repeats. The new train window overlaps the old one by 18 months, but the new test window is fresh. This keeps happening until we run out of history.
| Cycle | Training window | Test window |
|---|---|---|
| 1 | Jan 2020 – Dec 2021 | Jan 2022 – Jun 2022 |
| 2 | Jul 2020 – Jun 2022 | Jul 2022 – Dec 2022 |
| 3 | Jan 2021 – Dec 2022 | Jan 2023 – Jun 2023 |
| … | … | … |
With 6 years of history you get around 10 cycles. Each test window is one small "fresh look" at the strategy — and you get to see whether it worked 10 times in a row, not just once.
Why 24 / 6? A 24-month training window gives the strategy enough history to learn from. A 6-month test window is long enough to be meaningful but short enough to give you many independent checks.
Six terms cover 90% of what you'll read on a walk-forward report. Each is explained in one or two sentences.
One complete train-then-test pass. If history spans 6 years with 6-month test windows, you get about 10 cycles.
The historical period used to pick the best settings. Usually 24 months in StockWise.
The historical period immediately after the training window, where the frozen settings are checked on fresh data. Usually 6 months.
The specific settings — stop loss, profit target, threshold values — that the training window picked for a given cycle.
Once the training window picks its best settings, they are locked for the test window. No tweaking allowed. This is what makes the test honest.
How often the strategy was profitable across all test windows. 8 of 10 profitable is much stronger than 2 of 10, even if the total return is the same.
These two numbers are the heart of walk-forward. One tells you how the strategy performed when it was being tuned. The other tells you how it performed on data it had never seen.
In-sample (IS) results come from the training windows. Every cycle, the strategy tries many settings and reports the result of the best one. Because it was allowed to pick the winner after seeing the data, in-sample results are always better than they deserve to be. They are useful as an upper bound, not as an expectation.
Out-of-sample (OOS) results come from the test windows. The settings were frozen before those windows were seen. This is the closest thing you can get to a live result without actually trading. This is the number that matters.
The gap between the two tells you something important:
| Metric | In-sample | Out-of-sample |
|---|---|---|
| Total return | +186% | −4% |
| Sharpe ratio | 0.56 | 0.04 |
| Win rate | 55% | 42% |
In this example the strategy looked decent in-sample but essentially did nothing once it saw new data. That collapse is the clearest sign of overfitting — the settings were tuned to the noise of the past rather than to a real pattern.
Healthy vs warning signs: If OOS results are close to IS results, the strategy is probably genuine. If OOS results are a small fraction of IS results — or worse, negative — the strategy was likely overfit.
StockWise labels every walk-forward run with one of three verdicts, based on how the out-of-sample results compared to in-sample.
Out-of-sample performance stayed close to in-sample, and most test windows were profitable. This is the best case — it doesn't guarantee future returns, but it's a strong signal.
Out-of-sample performance was weaker than in-sample, but enough test windows were profitable that the strategy may still have some value. Worth investigating further before trusting it.
In-sample results were strong but out-of-sample collapsed. The strategy was tuned to the past rather than to a real pattern. Don't trust it with real money.
A simple example. Suppose you test two strategies:
Both strategies show a "positive total return" if you look at the whole history. Only walk-forward separates them.
Remember: even a Robust verdict is not a promise. It means the strategy survived a much harder test than a plain backtest. That's a good starting point for careful decisions, not a guarantee of profit.
Open StockWise, pick a strategy, and see the out-of-sample numbers for yourself.
Download StockWise