Validation

Walk-forward analysis: what it is, how to do it in MetaTrader 5 and how to read it

Published November 20, 2026 · By the AUREUM team · 11 min read

Walk-forward analysis is a way of testing a trading strategy on data it hasn’t seen: you optimize on one stretch of history, test the result as it is on the next stretch, move the window forward and repeat. What counts is the test stretches put together, not the optimization. MetaTrader 5 doesn’t do the whole thing, but its Forward setting does one of those passes, and by chaining several by hand you can build one. Here you’ll find what it is, a worked example with windows, the steps in MT5 and how to read the result. This is a guide, not a recommendation.

What is walk-forward analysis? In-sample vs out-of-sample

A backtest applies a strategy to past prices to see what it would have done (what a backtest is and how to read it). The trouble starts when you optimize: you try many combinations of parameters on one stretch of history and keep the best. That combination has already seen the exam. Its result tells you what would have worked on that data, not what will work on other data: that’s overfitting, which we explain in that same article.

Walk-forward analysis, also called walk-forward optimization, tries to measure it with a simple rule: the parameters are chosen on one stretch and judged on a later one, which played no part in the choice.

  1. You optimize on one stretch of history. That’s the in-sample data.
  2. You test on the next stretch with the chosen parameters, without touching them. That’s the out-of-sample data.
  3. You move everything forward and repeat, until you reach the end of the history.
  4. You put only the test stretches together. That set is the walk-forward result.

Robert Pardo introduced the method to traders in the early 1990s, in the first edition of his book Design, Testing, and Optimization of Trading Systems, and expanded it in the second edition, from 2008, which gives it a chapter of its own. According to that book, walk-forward analysis measures performance only on out-of-sample trades, that is, on data other than the data used to optimize. It mimics someone who re-optimizes their strategy every so often and trades with the latest choice.

Backtest, out-of-sample test, walk-forward and forward test: the differences

These are four tests that often get mixed up:

Four ways of testing a strategy, and what each one leaves unanswered
TestWhat it doesWhat’s missing
Optimized backtestChooses the parameters on the whole history and measures them right there.It says nothing about new data.
A single out-of-sample testSplits the history in two: optimizes on the first part and tests on the second.It depends on a single stretch, which may have been kind or harsh.
Walk-forwardRepeats that split several times, moving the window forward, and puts the test stretches together.It’s still a simulation on the past.
Forward test on demoLeaves the robot trading at today’s prices, with no real money.It takes weeks or months and only covers the market of that moment.

Watch the words. “Forward test” is used for two things: the setting in the MT5 tester, which works on historical data, and leaving a robot on a demo account (how to test a robot on demo, step by step). And “walk-forward testing” is sometimes used for the second one too. In this article, walk-forward always means the test with windows on historical data.

A worked example: rolling vs anchored walk-forward

A made-up example, which isn’t that of any particular strategy: you have history from 2019 to 2025, you optimize on two years, test on the following year and move forward one year at a time. That gives five windows:

Each row is a window. “opt”: the years used to optimize (in-sample). “test”: the year tested without touching anything (out-of-sample). The last row is what gets evaluated.

In window 1 you optimize on 2019 and 2020, and the chosen parameters trade 2021; in window 2, on 2020 and 2021, and they trade 2022; and so on until 2025. At the end there are five out-of-sample years in a row, and in none of them were the parameters chosen with that year’s own data. The first two years go untested: that’s the price of getting started.

That’s the rolling version: the optimization window is always the same length and drops the oldest data as it goes. In the anchored version, the start stays fixed and the window grows:

Which years are used to optimize for each test year, in the example
Tested onRollingAnchored
20212019–20202019–2020
20222020–20212019–2021
20232021–20222019–2022
20242022–20232019–2023
20252023–20242019–2024

Neither is better as a rule. The rolling version adapts sooner to a changing market, but each window has fewer trades. The anchored one uses more data, but drags along an ever older market. The size of the windows isn’t a given either: Pardo himself lists, among the aims of the analysis, deciding how long the optimization window is and how often to re-optimize.

What is walk-forward efficiency (WFE)?

Walk-forward efficiency (WFE), a term from Pardo’s book, compares what the strategy made out-of-sample with what it made in-sample. Because the stretches aren’t the same length, the two yearly rates are compared. With made-up figures: if a strategy made an average of $2,000 a year on the optimization stretches and $1,100 a year on the test stretches, its efficiency is 1,100 / 2,000 = 55%.

As a rule of thumb, the documentation of one platform that calculates it treats 50% or more as good. That’s a convention, not a proven threshold, and it has drawbacks:

MetaTrader 5 doesn’t calculate this figure: if you want it, you have to work it out by hand from the results of each stretch.

How to do walk-forward analysis in MT5: the Forward setting

In the Strategy Tester (View → Strategy Tester, or Ctrl+R; how to backtest in MetaTrader 5, step by step), the Settings tab has the Forward field. Its options:

The part held back is always the last one. MetaQuotes calls the first part the back testing period and the second, the forward period. What happens next depends on whether you optimize:

After an optimization, the results are in “Optimization Results” (right-click to switch between “Back Test Results” and “Forward Test Results”) and on the forward tabs next to it: in the English terminal we checked they’re called “Forward Results” and “Forward Graph”, and the label can change with the version. The result figure for each combination is that of the Criterion you chose (“Balance max”, “Sharpe Ratio max”…), calculated on each stretch. Double-click a row and the tester reruns that combination, so you can read each stretch like any other report: profit, profit factor, drawdown and number of trades (how to read the Strategy Tester report).

The MetaQuotes help says that the better the results of the two stretches coincide, the more likely it is that the robot will show good results in live trading. A match is a sign, not a guarantee.

What it doesn’t do

The Forward setting in MT5 is a single pass: one optimization stretch and one test stretch. It doesn’t move the window forward, doesn’t repeat the optimization, doesn’t put the stretches together and doesn’t calculate the efficiency. An article published on MQL5, the MetaQuotes community site, puts it this way: the tester doesn’t let you launch a walk-forward “at the touch of a button”.

Chaining the windows by hand

With the example above, the manual way would be this:

  1. Decide the rules before you start and write them down: how long the windows are, which criterion you optimize by and which combination you’ll keep (for example, the top one by that criterion on the optimization stretch).
  2. Window 1. Under Date, choose “Custom period” and enter January 1, 2019 to January 1, 2022: according to the MetaQuotes help, the end date isn’t included, and the test ends on the last tick of the previous day. Under Forward, choose “Custom” and enter January 1, 2021.
  3. Optimize and note what the combination your rule picked did in the forward period. Not the one with the best forward result.
  4. Move the three dates forward one year and repeat, up to window 5 (January 1, 2023 to January 1, 2026, with the forward period starting on January 1, 2025).
  5. Put the five forward stretches together: profit, trades and drawdowns for each one, in order.

Use the same modelling, the same deposit and the same costs in every window (which modelling mode to use). It’s slow work, which is why some people automate it with separate programs or with their own code, like the code in the MQL5 article mentioned above, which requires programming.

How to read a walk-forward test, and where its limits are

There’s no official pass mark. This is what people usually look at:

And this is what raises suspicion: it shines in-sample and loses or goes flat out-of-sample, nearly all the profit comes from one stretch, or the result changes a lot when you shift the dates a little. Even when it looks good, a walk-forward has limits:

The key idea

A walk-forward answers one specific question: whether the parameters chosen on the past held up on the next stretch, several times in a row. Passing it guarantees nothing about the future: it’s still a simulation. What it doesn’t cover is today’s market: only a test on demo and, after that, the results of a live account that can be checked will show you that (how to read a verified live account).

What AUREUM’s home page says about its validation

AUREUM is an Expert Advisor, software that runs two gold strategies (XAU/USD) in your own MetaTrader 5 account. This article doesn’t describe its strategy. Its home page explains that its two strategies “were built on data up to 2016 and checked against the ten years that followed, which they never saw while being created”, and that they passed Monte Carlo analysis. That is an out-of-sample check, not a walk-forward with re-optimisation like the one this article describes.

Its published backtest, a simulation on XAU/USD on H1 from 2024 to 2026, has 345 trades and a maximum drawdown of 22.35%. An account running AUREUM can also lose money.

Walk-forward analysis FAQ

What is walk-forward analysis in trading?

It’s a way of testing a strategy on data it hasn’t seen. You optimize on one stretch of history (in-sample), test the chosen parameters untouched on the next stretch (out-of-sample), move the window forward and repeat until the end. The result that counts is the out-of-sample stretches put together. It’s also called walk-forward optimization or walk-forward testing. Robert Pardo introduced the method to traders in a book first published in the early 1990s.

What is the difference between a backtest and walk-forward analysis?

A backtest applies the strategy to historical data and measures the result; if you optimized the parameters on that same data first, the result is flattered. Walk-forward analysis is a chain of backtests in which each stretch is tested with parameters chosen only from earlier data. Both are simulations on the past.

How do you do walk-forward analysis in MetaTrader 5?

MetaTrader 5 has no complete walk-forward. Its Strategy Tester has the Forward setting, which does one pass: it optimizes on the first part of the date range and tests the best combinations on the last part. For a walk-forward you repeat it by hand: set the dates with Custom period and Custom, optimize, note the result of the forward stretch, move the dates forward and start again. At the end you put the forward stretches together.

What is the Forward period (forward test) in the MT5 Strategy Tester?

It’s the last part of the date range, which the tester sets aside to check the parameters on data it didn’t use to optimize. You choose it in the Forward field of the Settings tab: No, 1/2, 1/3, 1/4 or Custom, which lets you enter the start date. According to the MetaQuotes help, not every combination goes through to the forward period, only the best ones: the top 10% with the slow complete algorithm and at least the top 25% with the genetic one.

What are in-sample and out-of-sample data?

In-sample data is the data used to choose a strategy’s parameters. Out-of-sample data played no part in that choice and is used only to check it. A stretch stops being out-of-sample the moment you use it to decide something: for example, if you keep the combination that did best on it.

Does passing a walk-forward test guarantee the strategy will work?

No. It’s a simulation on the past, with the same assumptions about spread, commissions and execution as the backtest, and the market can change after the last stretch. And if you repeat it many times, changing windows or rules until it looks good, it stops measuring what it’s meant to. Past or simulated results do not guarantee future results.

How often should you re-optimize?

There’s no rule. Re-optimizing often adapts the parameters sooner to a changing market, but each window has fewer trades and it’s easier to fit noise. Doing it rarely gives windows with more data, but the parameters can go stale. You decide the frequency before you start, and it’s part of the test: a walk-forward with one-year test stretches describes a strategy that is re-optimized every year.

Risk warning

The menus and options in this article were checked in November 2026 with MetaTrader 5 for desktop and with the MetaQuotes documentation; they can change with the platform version. The windows and figures in the examples are made up and only serve to explain the method. A walk-forward is a simulation on past data: passing it doesn’t guarantee what a strategy will do afterwards. Leveraged gold trading, which on MetaTrader 5 brokers is usually done with CFDs, carries a high level of risk and you can lose some or all of your capital: most retail CFD accounts lose money (how many traders lose money). The AUREUM figures we quote come from a simulation (backtest), not from a live account. Past or simulated results do not guarantee future results. This content is educational and is not financial or investment advice.

AUREUM: automated rules on gold, with its backtest published

Software that runs two strategies on XAU/USD in your own MetaTrader 5 account, where every trade opens with its loss and profit limits already calculated. Its 2024–2026 backtest, with both strategies together, is published with its drawdowns: a maximum drawdown of 22.35% across 345 trades. It’s a simulation, not a live account, and trading leveraged CFDs can lose you money.

See the full report →