The optimization has finished. Hundreds of rows appear in the MT5 Strategy Tester, and one of them looks like it deserves a trophy.
Naturally, the temptation is to save that set file and congratulate yourself on a successful afternoon.
But what exactly did the winning EA settings win? A competition on historical data. The next market session was not one of the judges.
This is where optimization becomes a surprisingly interesting risk-management problem. The better you get at finding a perfect historical result, the more careful you need to be about what that result actually means.
The leaderboard has a selection problem
Imagine an EA with three adjustable inputs: a moving-average period, an entry threshold and a stop distance. Give each input ten possible values and there are 1,000 combinations in a complete search.
Some combinations will perform better than others on the chosen historical sample. Even a strategy without a durable advantage can produce an impressive winner by chance.
Optimization is not inherently bad. It helps us investigate how inputs affect a trading system. The trouble starts when we confuse finding a historical winner with discovering a repeatable edge.
Overfitting is what happens when the selected rules or settings capture peculiarities of the development data that do not generalize well to other conditions.
The optimizer did its job. We may have asked it the wrong question.
Meet the champion and its boring neighbor
Consider two entirely hypothetical settings tested on the same instrument, period and starting deposit of $10,000, with the same cost assumptions.
Setting A produces $3,200 in net profit across 35 trades, with 31% maximum relative equity drawdown. Setting B produces $1,900 across 210 trades, with 12% maximum relative equity drawdown.
On a separate later historical segment, using the same starting deposit for each test, A loses $1,100 while B makes $150.
These are invented figures, not actual EA results.
If we rank only by historical net profit, A wins. If we examine the amount of trading evidence, equity risk and later behavior, the decision becomes less obvious.
B is not automatically a good strategy. Its modest forward profit might also be luck. But the example shows why the first row of an optimization table is the beginning of an investigation, not the end.
Try looking sideways instead of upwards
Suppose a moving-average period of 47 produces a spectacular result. What happens at 46 and 48? What about 45 and 49?
If the results collapse whenever the period changes slightly, that isolated peak deserves scrutiny. Perhaps the strategy depends on a narrow timing coincidence in the historical sample.
A broader region of reasonably consistent outcomes can be a more useful research candidate. It suggests the behavior may not depend entirely on one precise input.
There are exceptions. Some legitimate rules have sharp thresholds, and a smooth region can still be unprofitable. Parameter stability is evidence to examine, not a certificate of quality.
Give the EA an exam it hasn't studied for
In desktop MT5, open Strategy Tester with Ctrl+R and configure an optimization run. Select the EA, instrument, timeframe, historical dates, modeling method and appropriate test conditions.
Use the Forward setting to reserve a later portion of the selected historical interval. MT5 can evaluate selected optimization candidates on that separate portion. The platform's historical forward test is not the same as running an EA on a demo account in real time.
Decide what acceptable evidence looks like before examining the forward results. Consider trade count, drawdown, costs and whether the strategy still behaves as intended.
Now comes the uncomfortable part.
If the forward result disappoints, resist the urge to adjust the inputs repeatedly until that period looks beautiful too. Once its results influence your choices, that period is no longer untouched evidence.
Giving a student the answer sheet and then celebrating their exam score is not a particularly rigorous assessment method.
A revised strategy needs another genuinely unseen evaluation period if you want independent evidence.
Keep a small research log
Before starting another optimization, record:
- The strategy version and the reason for each adjustable input.
- The symbol, timeframe, test dates, modeling mode and cost assumptions.
- The parameter ranges, optimization criterion and risk limits.
- The reserved forward dates and your candidate-selection criteria.
- The selected settings, nearby results, drawdown and forward outcome.
This makes it harder to quietly change the rules after seeing a disappointing result. It also helps distinguish a strategy improvement from an improvement in your ability to fit one dataset.
Check that the test includes meaningful market activity for the strategy. A long calendar period with very few trades may still offer limited evidence.
What if the forward test fails?
A weak forward result does not prove overfitting on its own. Data limitations, changed market behavior, unrealistic cost assumptions and ordinary statistical variation can also explain it.
Investigate those possibilities. Check whether a handful of trades dominate the historical result. Examine sensitivity to trading costs and nearby settings. Consider whether the original rules have a plausible rationale beyond their historical score.
Sometimes the most useful outcome is rejecting a candidate rather than rescuing it.
Even a strategy that survives historical validation needs further examination of execution behavior, including demo testing where appropriate. Neither historical nor demo performance guarantees live profitability.
The next time MT5 hands you a spectacular optimization winner, give it something more useful than a trophy: a harder test.


