Overfitting meaning
Overfitting, also called curve fitting, is tuning a trading strategy so closely to past price data that it learns the random noise of that period instead of a pattern that repeats.
An overfitted strategy produces an impressive backtest and then performs much worse on data it has not seen. A backtest is a test of trading rules on historical prices.
Ready to try it on a real or demo account?
Partner link · trading carries a high risk of loss
A hypothetical example
A trader builds a moving-average crossover system for a currency pair. To find good settings, they run an optimisation over a wide grid of inputs:
- fast and slow moving-average lengths
- stop-loss and take-profit distances
- a time-of-day filter
- a filter that skips certain weekdays
The optimiser tests every combination on the same stretch of history and picks the one with the highest profit. The resulting equity curve rises smoothly with shallow drawdowns.
The trader then runs the chosen settings on a later period that was not used in the optimisation. The curve goes flat or falls. The weekday filter had only removed a handful of losing trades that happened by chance. The exact moving-average lengths were not special either; neighbouring values gave much weaker results.
The "edge" lived in that particular sample, not in the market. Traded live with leverage, such a system can lose money fast, because the trader trusts results that were never real.
Where you meet the term
- MetaTrader Strategy Tester. The tester in MetaTrader 5 and MetaTrader 4 has an optimisation mode that searches many input sets. MT5 can also split the history into a period used for optimisation and a later forward period, which is a basic check against curve fitting.
- Strategy reports and EA sales pages. A long, very smooth backtest with no losing months is a common sign of an over-optimised expert advisor.
- Quant research and news. Articles on systematic funds and machine learning use "overfitting", "data snooping" and "look-ahead bias" when published results fail to repeat.
Precise definition and edge cases
In statistics, a model is overfitted when it has more free parameters or flexibility than the data can support. It then fits the in-sample data (the data used to build it) better than a simpler model, while making larger errors out of sample (on new data).
Points experienced traders check:
- Degrees of freedom. Each added rule, filter or input raises the chance of fitting noise. A small number of trades with many parameters is a weak test.
- Parameter stability. A robust setting sits on a broad plateau of good results. A sharp, isolated peak points to curve fitting.
- Multiple testing. Trying many variants and reporting only the winner inflates results even when each test is honest. This is data snooping.
- Walk-forward analysis. The strategy is optimised on a rolling window and tested on the period that follows, again and again.
- Look-ahead bias. Using information that was not available at the time of the trade. It is a separate error but produces the same false confidence.
- Underfitting. The opposite problem: rules too simple to capture a real pattern.
A good out-of-sample result lowers the risk of overfitting but does not remove it. Market regimes change, and fat tails and black swan events rarely appear in a limited sample.
Related terms
- Equity curve
- Correlation coefficient
- Annualized return
- Fat tails and tail risk
- Trading strategies
- Technical analysis
- Risk management
- Trading glossary
Frequent questions
Is curve fitting the same as overfitting?
Yes. In trading, the terms are used interchangeably for tuning rules to past noise.
Does optimisation always cause overfitting?
No. Optimisation is a tool. Overfitting comes from too many parameters, too little data, or picking the single best result without testing it out of sample.
How do I spot an overfitted backtest?
Look for very smooth results, many filters, few trades, and settings whose performance collapses when changed slightly. Then test on data that was not used to build the strategy.
Does a demo account prove a strategy is not overfitted?
A demo account adds forward data, but a short demo period is still a small sample. It does not prove that a strategy will make money.
