Overfitting is the most common reason a strategy that looked excellent in testing disappoints the moment it meets new data. The backtest wasn't wrong about the past. It was too right about it: the rules and parameters had learned the noise of one particular stretch of history, and noise doesn't repeat.
The difficulty is that an overfit backtest looks exactly like a good one. Smooth equity, strong profit factor, tidy drawdown. You find it by testing around the result, not by staring at it. This guide lists ten warning signs and a quick test for each, so you can check your own EA before you rely on it.
One point up front: no single sign proves a strategy is overfit, and clearing all ten doesn't prove it isn't. The aim is to collect evidence from several independent angles. When two or three signs point at the same weakness, take it seriously.
What overfitting actually is
Any backtest result has two ingredients: whatever genuine, repeatable behaviour the strategy captures, and the random features of the sample it was tested on. Optimization can't tell them apart. Give an optimizer enough parameters and enough attempts, and it will find a combination that fits the random part beautifully.
That's also called curve-fitting. The more freedom the design process has, through more parameters, more filters, more variants tried, the more of the result tends to be fitted noise.
Overfitting is different from a coding error. A bug such as look-ahead bias makes a backtest wrong, not just too specific, and needs different checks; those are covered in look-ahead bias and other code bugs that make EA backtests lie.
10 warning signs of an overfit backtest
1. Too many free parameters for the number of trades
Every adjustable input is another way to fit the sample. A strategy with eight optimized inputs and eighty trades has very little data per decision it made.
Quick test: count every input the optimizer touched, including filters you switched on and off. Compare it with the number of trades. There is no exact threshold, but many practitioners want dozens of trades per free parameter. If you are far below that, simplify before testing anything else.
2. Oddly specific parameter values
A moving average of 50 or a stop of 2x ATR may reflect a design choice. A moving average of 113 with an RSI threshold of 27.5 usually reflects an optimizer finding the exact values that suited one sample.
Quick test: round each parameter to a plain value and re-run. If the result collapses, the precision was doing the work.
3. Performance cliffs in a parameter sweep
This is the most direct test. Sweep each key parameter across nearby values while holding the others fixed. Robust parameters form a plateau. Fitted ones form a spike.
Illustrative teaching example. These figures come from "System A-14", an anonymized, composite daily-bar trend system built for our sample stress-test report. It is not a live system or a client result.
| Trend-filter lookback (days) | 40 | 45 | 50 (baseline) | 55 | 60 |
|---|---|---|---|---|---|
| Profit factor | 0.89 | 1.11 | 1.34 | 0.97 | 0.81 |
Illustrative example only. Historical simulation, not predictive of future or live results.
| ATR stop multiple | 1.8x | 2.0x | 2.2x (baseline) | 2.4x | 2.6x |
|---|---|---|---|---|---|
| Profit factor | 1.21 | 1.28 | 1.34 | 1.31 | 1.25 |
Illustrative example only. Historical simulation, not predictive of future or live results.
The stop multiple forms a plateau: small changes, small effects. The lookback forms a cliff: a shift of five days either way removes most of the apparent edge. Same strategy, same baseline profit factor, very different evidence. The cliff is the warning sign, and it sits on the parameter that drives the core trend logic.
Quick test: sweep each core parameter across at least five nearby values. If neighbours of the chosen value fall below a profit factor of 1.0, treat the chosen value as suspect. When you do find a plateau, choose a value from its centre, not its highest point.
4. Large in-sample to out-of-sample decay
Some decline from the data you tuned on to data you held back is normal. A large decline across every metric suggests a good part of the in-sample result was fitted.
Illustrative teaching example (System A-14):
| Metric | In-sample | Out-of-sample |
|---|---|---|
| Profit factor | 1.52 | 1.19 |
| Win rate | 43% | 38% |
| Max drawdown | 16.1% | 18.6% |
| Trades | 148 | 64 |
Illustrative example only. Historical simulation, not predictive of future or live results.
On its own this is a visible but not disqualifying decay, a flag to carry forward rather than a verdict. How to set up the split so it means something is covered in out-of-sample testing for EAs.
5. Walk-forward efficiency that drifts down
A single split can be lucky. Walk-forward analysis repeats the optimize-then-test cycle across many windows. If each in-sample optimization keeps looking strong while each out-of-sample segment gets weaker, the optimizer is fitting each window's noise.
In the A-14 teaching example, in-sample profit factors stayed between 1.47 and 1.63 in all six windows, while walk-forward efficiency drifted from 0.88 down to 0.60 and two of the last three out-of-sample windows lost money. (Illustrative example only.) The full method is in how to walk-forward test an EA.
6. Filters that exist to delete specific losing trades
Watch for rules that only make sense with hindsight: don't trade on Tuesdays, skip a particular month, avoid one hour of the day, ignore signals after a particular date. Each one may remove a cluster of historical losers. None of them is likely to describe a lasting market behaviour unless you can explain why it should.
Quick test: for every filter, write one sentence on the market mechanism it captures. If you can't, remove it and re-run. If performance drops sharply, the filter was fitted to specific trades.
7. Results that depend on a handful of trades
Some strategies make their entire profit from a few outsized winners. That isn't automatically overfitting, since trend systems often work this way, but it means the result rests on very little evidence.
Quick test: remove the largest winners and recompute.
import numpy as np
def profit_factor(pnl):
pnl = np.asarray(pnl)
gains = pnl[pnl > 0].sum()
losses = -pnl[pnl < 0].sum()
return gains / losses if losses else float("inf")
def without_top_winners(pnl, n=5):
"""Drop the n largest winning trades."""
return np.sort(np.asarray(pnl))[:-n]
for n in (0, 3, 5, 10):
trimmed = pnl if n == 0 else without_top_winners(pnl, n)
print(n, round(profit_factor(trimmed), 2))
If removing three or five trades from a few hundred turns the strategy negative, ask whether those trades came from a repeatable pattern or a one-off event.
8. An equity curve that looks too good
Very high win rates with small average wins and occasional large losses can hide grid, martingale or no-stop logic. Very smooth curves with almost no drawdown over many years are rare in real markets. Neither proves overfitting, but both call for a closer look at what the code is actually doing.
Quick test: check the largest single loss, the maximum number of positions open at once, and whether position size ever increases after a loss. If an AI assistant wrote some or all of the code, see how to validate an AI-generated EA.
9. A huge search behind a single winner
If you generated thousands of strategies automatically, or tried hundreds of rule variants by hand, the best one will look good partly by chance. This is selection bias. The more you search, the better the best result looks, whether or not any edge exists.
Quick test: record how many variants you tested. Hold back data that none of the variants has ever seen, and judge only the finalists on it. Expect the best in-sample performer to look noticeably worse there. Monte Carlo can help gauge how much of a result depends on trade order, though it can't remove selection bias; see Monte Carlo testing a trading strategy.
10. An edge that disappears with slightly higher costs
If a small increase in spread, commission or slippage wipes out the result, the strategy is either trading too often for its edge or its edge was partly an artefact of optimistic fills.
Quick test: re-run with costs increased by a meaningful margin over your broker's typical figures. A robust strategy should weaken, not invert. How costs and execution differ between testing and live trading is covered in why an EA trades worse live than in its backtest.
A 30-minute overfitting triage
When you have a new backtest and limited time, run these in order. Each step is quick, and each one checks a different weakness.
- Count parameters and trades. Note the ratio.
- Round the parameters to plain values and re-run once.
- Sweep the single most important parameter across five nearby values.
- Remove the top five winners and recompute profit factor.
- Raise costs and re-run once.
- Compare the last 25–30% of the data with the rest, if you didn't hold it back at the start.
If two or more steps show a collapse, stop optimizing and go back to the design.
What to do if your backtest looks overfit
- Simplify. Remove filters you can't justify and freeze parameters that don't need optimizing.
- Choose from plateaus, not peaks. Prefer a parameter value surrounded by similar results over the single best value.
- Re-test on data the strategy has never seen. You get one clean look at a final holdout. Use it after the design is frozen, not during.
- Run a walk-forward analysis to see whether the logic holds when re-optimized and traded forward.
- Size for the uncertainty. If you go ahead with a strategy that shows some warning signs, do it knowingly, with smaller size and a written stop level.
Frequently asked questions
What does an overfit backtest mean?
It means the strategy's rules or parameters have been tuned so closely to one historical sample that part of the result comes from that sample's random features. Those features don't repeat, so performance on new data is usually worse.
Is curve-fitting the same as overfitting?
In trading, the two terms are used almost interchangeably. Both describe fitting a strategy to noise in historical data rather than to behaviour that is likely to persist.
Can an overfit strategy still make money?
It can, by chance, for a while. The problem is that the backtest no longer tells you much about what to expect, so sizing and expectations based on it are unreliable.
How do I avoid overfitting when building an EA?
Keep parameters few, decide your data split before testing, choose parameters from stable plateaus, track how many variants you test, and judge the final design on data it has never seen. Even then, these steps reduce overfitting risk rather than remove it.
Does a parameter plateau prove a strategy is robust?
No. It removes one specific warning sign. A strategy can have smooth parameters and still fail out-of-sample for other reasons, such as a regime change or unrealistic costs.
Want a second pair of eyes?
Start with our free Sample Stress-Test Report. It walks one anonymized, illustrative strategy through a full stress test, start to finish, so you can see what rigorous validation looks like before you test your own.
Read the Sample Stress-Test ReportWant your own backtest checked? The Strategy Audit + 60-minute call is a paid service at a launch price of £100, credited in full against our build and portfolio offers. You send an MT4/MT5 Strategy Tester report or trade-list CSV; what we can check depends on the files you supply, and walk-forward and parameter sweeps are not included because they need the strategy itself. It is analysis of strategy testing, not investment advice, and does not promise any trading or evaluation outcome. See the Strategy Audit
Disclaimers
CollosoTrading provides educational content and analytical services for retail and professional algorithmic traders. We do not provide regulated investment advice, financial advice, or personal recommendations. Trading derivatives, leveraged products, and CFDs carries a high level of risk and may result in losses exceeding deposits. Past performance, including any verified or unverified historical results referenced on this site, is not indicative of future results. Consult an independent regulated financial adviser before making investment decisions.
All figures are backtests or simulations unless marked LIVE. Hypothetical or backtested performance results have inherent limitations and may not reflect actual trading. No representation is made that any account will or is likely to achieve profits or losses similar to those shown. Individual results vary. All figures in this article come from an anonymized, illustrative teaching example. We do not guarantee the outcome of any prop firm challenge.