EA optimisation and overfitting: why perfect backtests mislead
By Benjamin Lee · Published 2026-10-11 · 1 min read
Optimisation finds the settings that performed best on past data. Used carelessly it produces a strategy that fits the past perfectly and the future badly. This guide explains the trap and how to avoid it.
What optimisation does
The Strategy Tester tries many combinations of the inputs and ranks the results. It is a search for the best fit to historical data, not a prediction of future performance.
What overfitting is
Overfitting, or curve fitting, happens when settings are tuned so tightly to one stretch of history that they capture its noise rather than a real, repeatable edge. The result looks excellent in the test and falls apart on new data.
Warning signs
A few patterns suggest an over-optimised set.
- Tiny changes to one input swing the result from great to poor.
- The best setting sits on a narrow, isolated peak.
- Very few trades produce most of the profit.
- It only works on one symbol or a short period.
Safer ways to optimise
Keep the number of optimised inputs small. Split the data into an in-sample period for optimising and a separate out-of-sample period for checking. Choose settings from a stable plateau where neighbouring values also work, then forward test on a demo account.
Frequently asked questions
Should I optimise a purchased EA?
Usually the developer's recommended setfile is the starting point. Only change inputs you understand, and test every change out of sample.
What is out-of-sample testing?
Testing the chosen settings on a period of data that was not used during optimisation.
Is a high profit factor proof the EA is good?
No. A high profit factor from an optimised test can be a sign of overfitting. Check it on out-of-sample and forward data.
Trading foreign exchange, gold and CFDs carries a high level of risk and may not be suitable for all investors. Past performance, backtests and live results do not guarantee future returns. This guide is general education, not financial advice.
More guides
- How to forward-test an Expert Advisor on a demo account
- Can Expert Advisor backtests be manipulated? How fake results are made and how to spot them
- What is a forex Expert Advisor (EA)? A plain-English guide
- Drawdown explained: how to read an EA's risk
- Spread, slippage and swap: the hidden costs of EA trading
- How to install an Expert Advisor (EA) on MetaTrader 5