Help Center · Walk-Forward Analysis

Walk-forward analysis, explained simply.

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.

Topic 1

What is walk-forward analysis?

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.

Topic 2

Why use walk-forward — and where is it useful?

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?"

It's useful whenever you're about to trust a strategy with real money

  • Before going live. A strategy that holds up under walk-forward is much more likely to work in real trading than one that only looks good on a single backtest.
  • When comparing strategies. Two strategies may look identical on a single backtest. Walk-forward usually separates them, because one generalises and the other doesn't.
  • After changing settings. If you tweak a stop loss and the result improves, walk-forward tells you whether that improvement is real or just noise.
  • To set realistic expectations. The out-of-sample numbers are a much better guide to what future returns might look like — not a guarantee, but far more honest than the in-sample numbers.

The one-line version: a regular backtest tells you what would have worked. Walk-forward tells you what was actually knowable at the time.

Topic 3

How a walk-forward cycle works

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:

Train window · 24 months
The strategy tries many settings and picks the one that worked best on this stretch of history.
Test window · 6 months
The chosen settings are frozen and applied to the next 6 months — which the strategy has never seen.

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.

A concrete example
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.

Topic 4

Key terms you'll see

Six terms cover 90% of what you'll read on a walk-forward report. Each is explained in one or two sentences.

Cycle

One complete train-then-test pass. If history spans 6 years with 6-month test windows, you get about 10 cycles.

Training window

The historical period used to pick the best settings. Usually 24 months in StockWise.

Test window

The historical period immediately after the training window, where the frozen settings are checked on fresh data. Usually 6 months.

Chosen parameters

The specific settings — stop loss, profit target, threshold values — that the training window picked for a given cycle.

Frozen settings

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.

Consistency

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.

Topic 5

In-sample vs out-of-sample

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.

Topic 6

Overfit, Robust, Moderate — what each verdict means

StockWise labels every walk-forward run with one of three verdicts, based on how the out-of-sample results compared to in-sample.

Robust

The strategy held up

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.

Moderate

Some slippage, still usable

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.

Overfit

Looks good in hindsight only

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:

  • Strategy A made +60% in-sample and +12% out-of-sample across 8 of 10 test windows. Verdict: Robust. The small gap and high profitable count are both healthy signs.
  • Strategy B made +180% in-sample and −15% out-of-sample across 3 of 10 test windows. Verdict: Overfit. The strategy only worked because of the exact period it was tuned on.

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.

Ready to run your own walk-forward analysis?

Open StockWise, pick a strategy, and see the out-of-sample numbers for yourself.

Download StockWise