Overfitting and Curve Fitting
Overfitting means a strategy fits noise instead of a real pattern. Learn the warning signs, why it happens, how to measure it and practical ways to avoid it.
Overfitting, also called curve fitting, happens when a strategy or model is tuned so closely to historical data that it captures random noise rather than a genuine, repeatable pattern. An overfit strategy produces a smooth, impressive backtest and then fails on new data, because the noise it learned will not repeat. It is the single most common reason trading strategies fail, and it affects both simple rule based systems and complex machine learning models.
How overfitting happens#
| Cause | Example |
|---|---|
| Too many parameters | A strategy with eight indicators, each with its own settings |
| Too many trials | Testing thousands of combinations and keeping the best. See P-Hacking and Multiple Testing |
| Rules added after looking at losses | "Skip trades on Mondays in March" because those lost in the backtest |
| Small samples | Few trades make noise look like signal |
| Complex models | Machine learning models with high capacity relative to data. See Machine Learning in Trading |
| Reusing test data | Adjusting until the out of sample period looks good. See In-Sample vs Out-of-Sample Testing |
A simple illustration#
Warning signs#
- Very high backtest Sharpe ratios (for example above 2 or 3 for slow strategies) without a strong reason.
- Many rules and parameters relative to the number of trades.
- Sharp performance peaks: small parameter changes destroy results. See Parameter Optimization.
- Rules that only make sense in hindsight.
- Large drop from in sample to out of sample performance.
- Smooth equity curves with almost no losing periods.
Measuring overfitting#
| Tool | What it does |
|---|---|
| Out of sample and walk forward tests | Compare unseen performance with in sample. See Walk-Forward Analysis |
| Deflated Sharpe ratio | Adjusts a Sharpe ratio for the number of trials (Bailey and López de Prado, 2014) |
| Probability of backtest overfitting (PBO) | Uses combinatorial cross validation to estimate how often the best in sample strategy underperforms out of sample |
| Parameter sensitivity maps | Show whether good results form a broad plateau or a narrow spike |
| Information criteria (AIC, BIC) | Penalise model complexity |
How to avoid overfitting#
- Start with a clear hypothesis grounded in economics or market structure.
- Keep it simple: fewer rules and parameters.
- Record every test and count trials.
- Prefer robust regions of parameter space over the single best value.
- Use realistic costs, which often eliminate overfit edges.
- Validate out of sample and with walk forward tests.
- Test on other markets and periods without changing rules.
- Use regularisation in machine learning models. See Model Evaluation and Cross-Validation.
- Trade small first and compare live results with expectations.
Underfitting#
The opposite problem, underfitting, means a model is too simple to capture a real pattern. In trading, overfitting is far more common and dangerous, because markets are noisy and the incentive to find a great backtest is strong.
Frequently asked questions#
What is overfitting in trading?#
Tuning a strategy so closely to historical data that it captures random noise rather than a real pattern, causing it to fail on new data.
How can I tell if my strategy is overfit?#
Warning signs include many parameters, very high backtest performance, sensitivity to small parameter changes and much worse out of sample results.
How do I avoid curve fitting?#
Use a clear hypothesis, keep rules simple, record all tests, prefer robust parameter regions, model costs and validate on unseen data.
Next, learn about using information from the future by mistake in Look-Ahead Bias.
3 quick questions on this lesson. Get them all right to finish it.
Turn on JavaScript to take the quiz.
Mentioned in
- The Trading Research ProcessResearch and Backtesting
- Why Strategies FailResearch and Backtesting
- Backtesting MethodologyResearch and Backtesting
- Walk-Forward AnalysisResearch and Backtesting
- Trading MythsStart Here
- Quant Trading Learning PathStart Here