Orometra

Guide

Forward testing in MT5: what it is and how to set it up

The forward test is the simplest way to know whether an optimization found something real or just fitted the past. MT5 has it built in, but you have to turn it on, give it enough data and know how to read it. This guide covers all three, with an example of how to read the forward table.

What forward testing is

The in-sample is the data used to choose the parameters. The forward is a later stretch that the optimizer did not use. Since you cannot test on the future, keeping the end of your history aside simulates what would have happened if you had optimized on the past and then traded the following months.

Why it matters: when you test thousands of combinations, the best one is partly the best and partly the luckiest, and the backtest cannot tell those two parts apart (the overfitting guide explains why). The forward did not take part in the choice, so the luck that pushed a pass to the top in-sample is not there. How much of the result survives tells you how much of it was real.

How to turn it on in MT5

In the Strategy Tester (Ctrl+R), Settings tab, next to the dates there is the Forward option. You can choose 1/2, 1/3 or 1/4 of the period, or Custom to set the date where the forward starts. MT5 always takes the final stretch. It only applies when you optimize.

Example. Dates from 1 January 2020 to 1 January 2024 with Forward 1/4: MT5 optimizes on 2020–2022 (three years) and re-tests the passes on 2023 (one year). With 1/3 it would be 32 months of optimization and 16 of forward, starting on 1 September 2022.

How much of the period to keep aside

There is no magic fraction. A quarter or a third is usually a reasonable balance: enough history to optimize and enough forward for it to mean something. What decides it is the number of trades the forward will contain, because a profit factor or a drawdown measured over 10 or 15 trades is almost pure chance.

Estimate it before optimizing: look at how many trades a year your EA makes in a single test and multiply by the length of the forward. An EA with about 120 trades a year leaves about 120 in a one-year forward, but only about 40 in a four-month one. If the number comes out low, lengthen the whole period rather than shortening the forward.

As a reference, Orometra requires in the forward the same minimum number of trades you set for the in-sample, rescaled to the forward’s estimated length, and never fewer than 30.

Which passes are tested in the forward

According to the MT5 help, the forward does not run every pass, only the best ones of the optimization by the criterion you chose: the top 10% in a complete search and the top 25% in a genetic one, with a minimum number of passes. Real exports do not always match that. In one we examined, a genetic optimization of 810 passes sent 256 to the forward, more than 25% (202), which fits the minimum of 256 passes quoted on the MQL5 forums. In another, a genetic optimization of 5,517 passes sent all 5,517. We do not know yet what decides it. Check your own export: if the forward table has as many rows as the optimization one, every pass was tested; if it has fewer, Orometra tells you.

When only the best ones reach the forward, this has two consequences. First, the forward table is not a random sample: it only has passes that were already good in-sample, chosen by your criterion. Second, the neighbors of the best pass, the configurations one step away, may be missing from it, so the forward alone cannot always tell you whether the zone around your pass holds up.

How to read the forward table

Each row is a pass. Back Result is its criterion in the optimization period and Forward Result, the same criterion in the forward. The rest of the columns (profit, profit factor, drawdown, trades) are those of the forward period. Sort the table by Back Result and read down the Forward Result column.

Illustrative example, criterion: balance (profit in money)
PassBack ResultForward ResultForward trades
184212,400−90038
99110,9001,70041
42839,8002,30044
42909,6002,10045
42779,5002,00043

How to read it: the in-sample winner, pass 1842, loses money in the forward; passes 4283, 4290 and 4277, which in this example differ by one step in a parameter and were all slightly worse in-sample, all stay profitable. That pattern, an isolated winner that collapses next to a group of similar configurations that hold, is what a peak versus a plateau looks like. Also check that the forward has enough trades: with around 40, these figures are indicative, not conclusive.

A worse forward is normal and expected: the optimization chose what best fitted the past, and part of that was luck. The question is not whether it gets worse, but whether what remains is still worth trading.

The third stretch: the period you never touch

As soon as you use the forward to decide (to pick a pass, change a range or tweak the EA and optimize again), it takes part in the choice and stops being a blind test. That is why it pays to keep a third stretch out of the tester dates altogether. If your history runs to the end of 2024, for example, optimize with forward up to the end of 2023 and do not look at 2024. When you have chosen your configuration, run a single test with it on 2024, once. That test is the cleanest evidence you will have; in Orometra we call it the unseen period.

Common mistakes

Next step

Export the optimization tab and the forward tab to XML and drop both files into Orometra. It finds the plateaus in the in-sample and then requires your minimums again in the forward to validate them: if many configurations of a plateau fail there, the plateau drops in rank. Inside the validated plateau it picks the configuration with the best combined in-sample and forward rank, averaged with its neighbors. Because the forward takes part in that choice, it is not a blind test: whatever level Orometra gives, a test on a period you have not used can keep it there or lower it.

Analyze my results How Orometra decides →