How to detect overfitting in an MT5 backtest
An MT5 backtest is likely overfitted when it rests on few trades, a short period, many optimized parameters, a near-perfect equity curve or poor-quality data. To check, keep part of the history unseen during optimization and test on it, run a walk-forward analysis, and read the Calmar ratio and curve linearity only once the test is long and clean.
What overfitting is
Overfitting means tuning a strategy so closely to the past that it captures noise instead of a real market behaviour. The MT5 optimizer makes this easy. Give it ten inputs with wide ranges and it will find a combination that fits the test period almost perfectly. That combination often fails on the next months, because the noise it learned does not repeat.
The result is a familiar story: a beautiful backtest, then a live account that drifts from the backtest within weeks.
The warning signs
| Sign | Why it is suspicious | What to check |
|---|---|---|
| Too few trades | A handful of trades can look great by chance | The total number of trades in the report, and trades per parameter |
| Short test period | One market regime only | Whether the test covers calm, volatile, trending and ranging phases |
| Many optimized parameters | Each extra input adds a way to fit noise | How many inputs were optimized, and how narrow their best values are |
| Near-perfect equity curve | Real edges have losing stretches | Drawdown periods that look too small for the return |
| Poor data or coarse modelling | Intrabar moves are missing | History quality and modelling mode in the report |
| Fragile parameters | Results collapse when a value changes slightly | Performance of neighbouring parameter values |
Too few trades, too short a period
A strategy with 40 trades over one year tells you little. The result can depend on two or three lucky trades. Prefer tests that span several years and several market phases, with enough trades for the statistics to mean something.
Too many parameters
Every optimized input is a degree of freedom. With enough of them, the optimizer can fit any history. A useful habit: look at the optimization results around the best set. If the best set sits on a narrow peak surrounded by losing combinations, it is probably noise. A broad plateau of decent results is a better sign.
A curve that looks too good
A smooth line with tiny drawdowns and a high return deserves suspicion. Check the trade list. Martingale, grid or averaging logic can hide risk until one bad sequence arrives.
Data quality and modelling
The MT5 report shows the modelling mode and the history quality. "Every tick based on real ticks" is the most realistic mode. "Open prices only" or "1 minute OHLC" can be acceptable for some strategies, but they misjudge stops and targets that sit inside a bar. A low history quality means the tester filled gaps with generated data.
Out-of-sample and walk-forward testing
The simplest defence is out-of-sample testing. Split your history in two. Optimize on the first part only. Then run the chosen settings, unchanged, on the second part. If performance collapses, the first result was mostly fit.
MT5 supports this directly: the strategy tester has a "Forward" option that reserves part of the period for a forward test.
Walk-forward validation repeats the idea over rolling windows. You optimize on one period, test on the next unseen period, then move both windows forward and repeat. The final picture joins all the unseen segments. A strategy that holds up across many windows is more credible than one tested once.
Two rules make these tests honest:
- Do not go back and re-optimize after looking at the out-of-sample result. Once you do, that data is no longer unseen.
- Keep the forward period long enough to contain a meaningful number of trades.
Equity curve linearity and the Calmar ratio
Equity curve linearity, often measured with R², shows how close the curve is to a straight line. Close to 1, growth is steady. Low, results depend on a few trades. High linearity on a long, dense, clean test is a good sign. High linearity on 50 trades is not proof of anything.
The Calmar ratio divides the compound annual growth rate by the maximum drawdown. Above 3 is considered excellent, with a caveat that matters: it only holds if the test is long enough, has enough trades and uses quality data. A short backtest can show a huge Calmar because its worst drawdown simply has not happened yet. Overfitting also inflates it, since the optimizer tends to pick settings that dodged the drawdowns of the test period.
Read these metrics last, once the test itself is trustworthy.
How the free backtest audit helps
The free backtest audit reads the MT5 backtest report you export from the strategy tester as an .xlsx file. The file is analysed in your browser. The audit checks:
- Reliability of the test. A backtest that is too short, has too few trades or uses poor-quality data is flagged instead of getting a misleading good score.
- The Calmar ratio, judged together with duration, trade density and data quality.
- Equity curve linearity. Below a threshold, the strategy needs rework.
- Prop firm compliance: daily drawdown, 95% VaR and exit efficiency (MFE).
- Avoidable drawdown: an estimate of what Crash Guard would change, with optimization patches suggested for the bot.
- Drift signs to keep watching in live conditions.
A good audit does not guarantee live results. It tells you whether a backtest is solid enough to be trusted. For the steps after validation, see the guide on how to protect an MT5 Expert Advisor.
In short
- Few trades, a short period, many parameters, a perfect curve and poor data are the main signs of overfitting.
- Test on data the optimizer never saw: out-of-sample first, walk-forward for a stronger check.
- Prefer parameter plateaus to sharp peaks.
- Read linearity and the Calmar ratio only on a long, dense and clean backtest.