EA optimisation is the process of finding parameter values that improve a strategy’s historical performance. Done correctly, it refines genuine edge. Done incorrectly, it produces parameters that look excellent on historical data and fail immediately in live trading. The difference is the discipline of walk-forward analysis.
The core problem with optimisation
Optimisation is a search over a parameter space for the combination that maximises a chosen metric (total return, Sharpe ratio, profit factor) on a historical dataset. The problem: with enough parameter combinations, you can always find settings that look exceptional on any historical data — including random noise.
This is curve-fitting (also called overfitting). A curve-fitted EA has memorised the specific price movements of the backtest period rather than discovered a real edge. It will underperform or fail in forward testing.
The walk-forward solution
The antidote to curve-fitting is out-of-sample testing. Reserve a portion of your historical data — typically the most recent 20-30% — as a “validation set” that you never include in optimisation. Then:
- Optimise parameters on the older in-sample data (e.g. 2020-2024)
- Test the best parameters on the out-of-sample data (e.g. 2025 only) without any further adjustment
- If performance holds up on the out-of-sample period, the parameters have some genuine predictive value
MT5’s Strategy Tester has a built-in “Walk Forward Optimisation” mode that automates this process over rolling windows.
Stability testing — the practical shortcut
If walk-forward optimisation seems complex, a simpler signal of over-optimisation is parameter sensitivity. After finding the best parameters, test variations: if the default ATR multiplier is 2.0, test 1.8 and 2.2 as well.
- Stable parameters: performance at 1.8 and 2.2 is similar to 2.0. The result is not highly sensitive to this parameter — the edge is real.
- Curve-fitted parameters: performance drops sharply at 1.9 or 2.1. The 2.0 value was optimised specifically to the historical data; a slight change collapses the result.
Always prefer parameters that sit in a flat-performance neighbourhood, even if their absolute peak performance is slightly lower than a more sensitive optimum.
What to optimise (and what not to)
Optimise:
- Stop-loss multipliers (ATR-based stops have natural parameter ranges)
- Trend filter thresholds (ADX levels, EMA periods)
- Session filters (time-of-day entry windows)
Do not optimise:
- Risk-per-trade percentage — this is a position sizing decision, not an edge parameter
- Exit targets that are set to maximise backtest profit — the market forward is not the market backward
When to stop optimising
A practical stopping rule: once your Sharpe ratio on the out-of-sample period exceeds 1.5 and your walk-forward efficiency (out-of-sample profit / in-sample profit) is above 0.5, stop optimising. Further refinement at this point is adding curve-fitting risk without proportional edge improvement.
The final check before going live: run the optimised EA on a demo account for one month and compare trade-by-trade results against the backtest. If demo performance is within 20% of backtest Sharpe, the parameters are viable. If demo severely underperforms, re-examine execution model assumptions (spread, slippage) in the backtest settings.