Overfitting is tuning a trading strategy so closely to past data that it captures random noise instead of a real pattern, making the backtest look excellent while live results disappoint.

Also known as: curve fitting, over-optimisation, data mining. Level: Intermediate.

In short

  • More parameters and more tweaks mean more overfitting risk.
  • Great in-sample, poor out-of-sample is the classic sign.
  • Testing many strategies and picking the best guarantees some lucky winners.
  • Simple rules that work across markets are usually more robust.

How it works

Overfitting, also called curve fitting, happens when a trading strategy or model is tuned so closely to past data that it captures random noise rather than a real, repeatable pattern. It looks excellent in a backtest and then performs poorly in live trading.

If you try enough combinations of settings, some will look great on past data purely by chance. It's like flipping thousands of coins and picking the one that landed heads ten times in a row: impressive, but meaningless for the next flip.

Warning signs include many rules or parameters, settings that work only in a narrow range (a 17-day average works but 16 and 18 do not), very smooth equity curves, few trades, and results that depend on a handful of big winners.

Researchers such as David Bailey and Marcos López de Prado have shown that with enough trials, very high backtest Sharpe ratios can appear even when the true edge is zero. Their deflated Sharpe ratio adjusts for how many strategies were tested.

Common defences include out-of-sample testing (developing on one period and testing on another), walk-forward analysis, testing on several markets, keeping rules simple, checking that nearby parameter values also work, and recording every test you run.

Paper trading or trading small size for a period before committing full capital is the final check. If live results fall far short of the backtest, overfitting is a likely cause.

Bar chart showing an overfitted strategy dropping from +35% in-sample to −3% out-of-sample, while a robust one drops only from +12% to +9%.
Illustrative. A smaller drop on unseen data is a sign of a real edge.

An example with numbers

Example 1: A trader tests RSI periods from 2 to 50 and thresholds from 10 to 40, picking the combination with the best past return. It made 35% a year in the backtest and loses money the following year.

Example 2 (the check): She keeps 2021–2024 aside. The “best” settings return −3% on that period, while simple default settings return +6%: a clear sign of overfitting.

How it differs by market

Market What to know
Global A universal problem in trading research, machine learning and academic finance.

Where people go wrong

  • Optimising every parameter to the best past value.
  • Not keeping any data aside for testing.
  • Not counting how many variations were tried.

Common questions

What is overfitting in trading?

Making a strategy fit past data so precisely that it learns noise, not real patterns.

How do I know if I've overfitted?

If results collapse on data you didn't use to build the strategy, or change a lot with small parameter tweaks.

How can I avoid overfitting?

Use fewer rules, test out of sample, use walk-forward analysis, and check that results hold across markets and periods.

Is optimisation always bad?

No, but it must be limited and validated on unseen data.