← All posts

October 22, 2026 · Michael Shane

Walk-Forward Analysis, Explained With a Simple Example

Walk-forward analysis tests a trading strategy the way you'd really use it: tune on the past, then trade the next stretch blind. Here's how it works, step by step.

Most backtests answer one question: if I had used these exact settings over the last few years, how would it have gone?

That sounds fair. It isn't. You picked those settings after seeing the whole period. Of course they look good on it.

Walk-forward analysis fixes this. It tests a strategy the way you would really use it: pick settings using only the past, trade the next stretch without touching anything, then repeat. This post walks through how it works with a simple example you can copy.

The problem walk-forward solves

Say you have a moving-average strategy with two settings: a fast average and a slow average. You test 40 combinations over three years and keep the best one.

That best result is not a fair score. It's the winner of a contest you ran on the same data you're grading it on. Some of its edge is real, maybe. Some of it is luck that happened to fit that exact stretch of history. We wrote more about this in 7 signs your strategy only works on the past.

The honest question is different: if I had chosen settings the way I'm choosing them now, but only with data I had at the time, what would have happened next?

Walk-forward answers that question.

How it works, in plain steps

You split your history into a chain of windows. Each window has two parts:

  • The training part (in-sample). You're allowed to look at this data and pick your settings.
  • The test part (out-of-sample). You run the chosen settings here with no changes. This is the part that counts.

Then you slide the whole thing forward and do it again. The test parts never overlap, and you stitch them together into one result.

That stitched result is your walk-forward score. Every trade in it was made with settings chosen before that data existed.

A simple example

These numbers are made up to show the method. They are not results from any real strategy.

Say you have three years of 4-hour data for one market, from January 2023 to December 2025. You choose a 12-month training window and a 3-month test window.

Round 1. Train on Jan to Dec 2023. Try your 40 setting combinations and pick the best. Then run only that pick on Jan to Mar 2024. Write down the result.

Round 2. Slide forward 3 months. Train on Apr 2023 to Mar 2024. Pick again; the best settings may change. Run the new pick on Apr to Jun 2024.

Round 3 and on. Keep sliding 3 months at a time until you run out of data.

With three years of data you get eight test windows, covering Jan 2024 to Dec 2025. Two years of trades, every one of them made "blind."

Now compare two numbers:

  • The normal backtest: best settings, picked with hindsight, over the full three years.
  • The walk-forward result: the eight test windows stitched together.

The gap between them is the useful part. If the normal backtest looks great and the walk-forward result is flat or negative, most of what you saw was fit to the past.

How to read the result

A few plain rules of thumb:

Look at every window, not just the total. If one test window made all the gains and the other seven lost a little, you don't have a steady pattern. You have one lucky quarter. Write it the honest way: "3 of 8 test windows net positive (simulated)."

Watch how much the settings jump. If round 1 picks a 10/30 average, round 2 picks 45/200, and round 3 picks 5/12, the "best" settings are just chasing noise. A real pattern tends to pick similar settings from window to window.

Expect the walk-forward score to be worse. That's normal. A drop is fine. A collapse is the warning sign.

Count trades. A test window with four trades tells you almost nothing. If your windows are too short to hold a fair number of trades, make them longer.

Common mistakes

Peeking anyway. If your data or features were built using the whole history, for example an average or a cutoff calculated over all three years, the test windows aren't truly blind. Everything has to use only what was known at that moment. We call this point-in-time truth.

Tuning the walk-forward itself. If you try 12-month, 6-month and 18-month training windows, plus 1-month and 3-month tests, and keep the combo that looks best, you've overfit again, one level up. Pick the window sizes first, for a reason you can say out loud, and stick with them.

Forgetting costs. Fees and slippage go into every test window, the same as live. Our post on paper trading vs live trading covers where those costs hide.

Stopping here. Walk-forward is still a test on history. It's a much better one, but the market you trade next hasn't happened yet.

What comes after walk-forward

Walk-forward is a strong filter. Ideas that fail it can go in the bin cheaply. Ideas that pass it have earned the next step, not a live account.

The next step is forward testing: run the locked rules on new data as it arrives, on paper, with no changes. A walk-forward test simulates "blind." A forward test really is blind, because the data didn't exist when you wrote the rules. We go through that step in backtest vs forward observation.

How Pickled Lizard uses this

At Pickled Lizard, an idea, yours or one from your AI, moves through stages: discover, test, challenge, forward observe, prove. Walk-forward-style checks sit in the "challenge" part. We try to break the idea before it gets anywhere near real money.

Ideas that survive go to paper, with real fees, real margin rules and real timestamps, and move up from Shadow to Unproven Paper to Verified. Each step has to be earned. Failed ideas stay on the record too, so nobody can quietly forget them.

You bring your own AI: ChatGPT, Claude, Grok, Cursor. AI thinks. Pickled Lizard proves and executes.

A quick checklist

Before you trust a strategy's backtest, ask:

  • Were the settings picked using only data from before each test period?
  • Are the test windows stitched together, with no overlap?
  • How many test windows were net positive, out of how many?
  • Do the chosen settings stay roughly the same from window to window?
  • Were fees and slippage in every window?

If you can't answer these, you don't have a walk-forward result yet. For the full process, start with how to backtest without fooling yourself.

Test it free

The beta is free. Bring an idea from your AI and see how it does on new data, on paper. You can also see simulated paper results on our paper trading leaderboard.

Test it free at pickledlizardz.com/join

More on how we test ideas: see all posts on Learn. Want to know why I'm building this? Read the story on our About page.

Paper trading only. Results are simulated. Not financial advice.