Skip to content
Log in
← Glossary

overfitting

Tuning a rule until it fits past data perfectly, which makes it look great there and fail on new prices.

Overfitting is tuning a rule so closely to past data that it captures noise as if it were a useful pattern. The rule can then look unusually successful on the data used to build it and fail on new observations.

It often happens when many settings are tried and only the best historical result is kept. Small quirks in one period become hidden conditions in the rule, even though they may not recur.

A separate, untouched data period can help reveal the problem, but it cannot guarantee future success. A complicated rule with a perfect-looking backtest deserves careful skepticism.

Example

Nora tests 20 versions of a rule on 40 made-up Spark Coin days. By chance, one version wins on 30 days and loses on 10, with an average gain of $2 on wins and a loss of $3 on losses.

Working: 30 × $2 = $60 gains; 10 × $3 = $30 losses; net before costs = $30. But on 20 later days, it wins 8 and loses 12: 8 × $2 − 12 × $3 = $16 − $36 = −$20 before costs. The first result may reflect chance and tuning, not a durable pattern.

Common mistakes

  • Trying many settings and reporting only the winner.
  • Reusing test data to keep adjusting the rule.
  • Confusing a precise fit to past prices with evidence about future prices.
  • Most people who trade lose money.

Learn it in the course

  • Backtest basics and traps · Test a rule on past prices and see the traps: one lucky period, hindsight, too many tweaks and missing failures.