Walk-forward analysis: rolling re-optimisation, and why the stitched out-of-sample curve is the one that counts
Posted: Wed Nov 25, 2026 9:14 am
Walk-forward analysis is a way of testing a strategy that gets re-optimised from time to time. You choose an in-sample window, say six months, find the best settings there, then trade those settings on the next out-of-sample window, say one month. Then you roll everything forward by a month and repeat. At the end you join up all the out-of-sample months into one equity curve.
That joined curve is the important result, because each piece of it was traded with settings chosen without seeing that data. It's a much more honest picture than a single optimisation over the whole history, which always looks good because the settings were picked with full knowledge of what happened.
A few details make a big difference. The ratio of in-sample to out-of-sample length matters: too short an in-sample window and the settings jump around chasing noise; too long and they react slowly to changes. Walk-forward efficiency, roughly the out-of-sample return compared with the in-sample return, gives a quick sense of how much the optimisation is just fitting. If the in-sample months always look great and the out-of-sample months are flat, the optimiser is mostly finding noise.
It's also worth watching how much the chosen settings move from window to window. If the best stop size is 4 pips one month and 15 the next, the strategy probably doesn't have a stable optimum, and that's useful information even if the joined curve looks fine.
One trap: running walk-forward many times with different window lengths and keeping the best is just optimisation again, one level up. Pick the window structure in advance.
For those who use walk-forward: what in-sample and out-of-sample lengths have you found sensible for M1 and M5 strategies?
That joined curve is the important result, because each piece of it was traded with settings chosen without seeing that data. It's a much more honest picture than a single optimisation over the whole history, which always looks good because the settings were picked with full knowledge of what happened.
A few details make a big difference. The ratio of in-sample to out-of-sample length matters: too short an in-sample window and the settings jump around chasing noise; too long and they react slowly to changes. Walk-forward efficiency, roughly the out-of-sample return compared with the in-sample return, gives a quick sense of how much the optimisation is just fitting. If the in-sample months always look great and the out-of-sample months are flat, the optimiser is mostly finding noise.
It's also worth watching how much the chosen settings move from window to window. If the best stop size is 4 pips one month and 15 the next, the strategy probably doesn't have a stable optimum, and that's useful information even if the joined curve looks fine.
One trap: running walk-forward many times with different window lengths and keeping the best is just optimisation again, one level up. Pick the window structure in advance.
For those who use walk-forward: what in-sample and out-of-sample lengths have you found sensible for M1 and M5 strategies?