Home/Glossary/Overfitting
Statistics & testing

What is overfitting?

Overfitting is when a trading rule is tuned so closely to past data that it captures that period’s noise rather than a repeatable pattern, so it performs well in the backtest and poorly afterwards.

Every adjustable setting, such as an indicator length, a threshold or a filter, gives a rule more ways to fit the past. With enough settings, almost any history can be fitted almost perfectly. The tell is fragility: results that collapse when a setting moves slightly, when the test starts a year later or when the rule is run on another coin. Testing on data the rule never saw, keeping parameters few and using a strict significance bar are the usual defences.

Why it matters

Overfit strategies are the most common reason a backtest that looked excellent loses money live. Crypto makes it worse: histories are short, a few big bull and bear markets dominate them, and a rule tuned on one bull market may simply be a long-only bet in disguise.

Example

Say you test 200 combinations of moving-average lengths on BTC from 2019 to 2023 and pick the best, which shows a 180% return. Run on 2024 to 2026 data, the same settings return less than buying and holding. The 180% was mostly the best of 200 lucky draws, not a property of the rule. A sturdier rule would rank well across neighbouring settings and across start years.

Common mistakes

  • Reporting the best of many tested settings without saying how many were tried.
  • Re-tuning after seeing the out-of-sample results, which quietly turns the test data into training data.
  • Adding filters that each remove a few past losing trades.

Questions

How do I know if my strategy is overfitted?

Check whether it still works on data it was not tuned on, on other coins and with slightly different settings. A large gap between in-sample and out-of-sample results is the clearest sign.

Does more data solve overfitting?

It helps, but only if the extra data is not used for tuning. CryptoPatterns.ai runs its market regime trend-filter table from several start years with a cost per switch, because a single start date can make any rule look good.

Related terms

Part of the crypto trading glossary. Definitions are educational, not financial advice.