In the last lesson, you kept back one slice of history and used it once. Walk-forward testing repeats that check again and again, stepping forward through time. By the end of this lesson, you'll know how it works, step by step, and how to read the joined-up result. You'll also know the choices to make before you start, and what it can and can't tell you, especially when you're testing by hand.
1 of 8
What you'll learn
- Walk the test forward. Build on a window, test the stretch after, slide on, repeat.
- Join the test stretches. They form one record on prices the rules hadn't seen.
- Read the picked settings. Picks that stay in one zone are a good sign.
- Set the windows first. Window lengths are settings too, so searching them adds tests.
- Keep test windows big enough. A tiny window can't tell you much.
Exercise
- Plan a small walk-forward test on paper before you replay anything: a build window, a test window, and two values of one setting.
- Write out the dates of each round and the two values.
- Then run just the first round by hand: replay the build window with both values, pick one, and replay the test window with it.
Quick check
1. In each walk-forward round, which stretch is the result measured on?
2. Four rounds pick settings 20, 55, 20, 55. What does that suggest?
3. You try ten window lengths and keep the best walk-forward result. What's the problem?
0 of 3 answered.
Finished this lesson?
Tick it off and keep your place
Read the full notes
Walk-Running a finished strategy, unchanged, on new prices as they arrive, and recording every trade.More in the glossary repeats the build-then-check step over and over, moving forward through time, and joins the Running a strategy’s exact rules over past prices to see which trades they would have taken.More in the glossary stretches into one record of results on prices the rules hadn't seen.
- Building rules on one window of history, testing them on the stretch just after it, then moving both windows on and doing it again.More in the glossary repeats the The part of the price history used to build and adjust a strategy’s rules. The part kept back to test them is out-of-sample.More in the glossary and History kept back while a strategy’s rules are built, then used once to test the finished rules unchanged. The part used to build them is in-sample.More in the glossary check, moving forward: build or re-tune on a window, test on the stretch just after, slide both on, repeat. The test stretches are joined into one out-of-sample record.
- Made-up example: build 6 months, test the next 2, step 2 months. Rounds pick lengths 40, 45, 40, 50 and make A result measured in units of the amount at risk. If a trade risks 4 points, 1R is 4 points and a 6-point gain is +1.5R.More in the glossary, −1.5R, +3.0R, +0.5R. Joined, July to February: +4.0R.
- Read both the joined result and the picked settings. Picks that stay in one zone are a better sign than picks that jump around.
- Decide first: build window length, test window length, rolling or anchored, and what gets re-chosen from which short list. Window lengths are settings too; searching them is another many-tests problem.
- It shows how the whole process did, several times, and whether settings stay steady. It can't say much from tiny test windows, and it can't escape choices made after looking. More: Walk-forward analysis.
Worked example
Made-up numbersFour rounds, stepping forward
Made-up numbers · build 6 months, test the next 2 · length chosen each round from 35, 40, 45, 50
- Build Jan to Jun → 40. Test Jul to Aug: +2.0R
- Build Mar to Aug → 45. Test Sep to Oct: −1.5R
- Build May to Oct → 40. Test Nov to Dec: +3.0R
- Build Jul to Dec → 50. Test Jan to Feb: +0.5R
- Joined: 2.0 − 1.5 + 3.0 + 0.5 = +4.0R over 8 months
One round of four lost, and the picks stayed in one zone. It's still a limited sample.
Your turn
DrillMade-up numbers · four test stretches · +1.5R · −2.0R · +0.5R · +1.0R
Trading is risky. You can lose money. Test results are hypothetical, and a good test doesn't mean future profits. This lesson explains how testing works. It isn't advice.