Skip to content

Glossary

What Is Overfitting in Trading Backtests?

Overfitting happens when a trading strategy captures quirks or noise in historical data rather than a relationship that generalizes. It can come from tuning parameters, selecting stocks, choosing dates or adding exceptions after seeing results. A strong backtest is not enough: evaluate the selection process on data it did not use.

What curve fitting looks like

Imagine testing 100 moving-average pairs and retaining only the most profitable one. Even if no pair has a durable edge, random variation can make one look convincing.

Now add a filter that removes losing Mondays and a date range that excludes the worst month. The resulting chart may improve while the strategy's generalization gets worse.

This is not limited to automated optimizers. Discretionary choices about symbols, timeframes and “obvious” exceptions are also searches.

Warning signs

  • One narrow parameter setting wins while its neighbours fail.
  • Performance depends on a few extraordinary trades.
  • The strategy changes after every held-out test.
  • Costs or losing regimes are omitted because they spoil the result.
  • Only the final winner is reported, not the attempts that produced it.

These are reasons to investigate, not definitive proof that a strategy is useless.

Better evidence

Predeclare a small search, use realistic costs and retain a later test period that does not select the rules. Check neighbouring values and different market regimes.

Walk-forward analysis repeats training and testing over time. It evaluates a tuning process, but repeatedly choosing the process based on all its results can still overfit.

Record every revision. A strategy that fails an honest test has supplied useful information. See the optimization guide for a practical workflow.

Limitations

  • No historical validation guarantees future results.
  • A holdout loses its untouched status once it guides further development.

Frequently asked questions

Can a simple strategy be overfit?
Yes. Even one rule can be selected from hundreds of discarded ideas, dates or instruments. The visible rule count does not show the full search.
Does walk-forward testing prevent overfitting?
It can reduce some risks but cannot eliminate them. Choosing windows or redesigning the strategy after seeing all folds makes those outcomes part of development.
Is lookahead bias the same as overfitting?
No. Lookahead uses information unavailable at the decision time. Overfitting selects rules that explain the historical sample too specifically. Both can occur together.

Last updated: