Anyone who has backtested knows the temptation: tweak a parameter here, add a filter there, and watch the equity curve look better and better. The problem is that, past a certain point, each tweak stops improving the strategy and starts describing the past. That is overfitting, and it is the main reason strategies that shine in testing disappoint live.
What overfitting is
Overfitting is when a strategy adapts to the noise in historical data rather than to behavior that tends to repeat. With enough parameters and filters, any rule can be made to look profitable in any period, because it starts "memorizing" the quirks of that stretch of market.
Warning signs
- Too-good results: a very high win rate, almost no drawdown and a straight-line equity curve rarely survive outside the test.
- Many parameters: each extra parameter is one more degree of freedom to fit the past.
- "Brittle" parameters: a 13-period average works, but 12 and 14 lose money. That is luck, not an edge.
- Few trades: with a small sample, a few lucky wins change everything.
- Rules with exceptions: "don't trade on Tuesdays, except in expiration week" is usually a fit to specific events.
How to avoid it
1. Keep data aside for validation
Use one part of the history to develop and another, which you have not looked at, to validate (out of sample). If performance drops sharply on the new data, the strategy was overfitted.
2. Prefer stable parameter regions
Instead of picking the combination with the best result, look for a range of parameters where results are reasonable across all neighboring combinations. Robustness beats the peak.
3. Walk-forward
Walk-forward analysis repeats the process of optimizing on one stretch and testing on the next, moving forward in time. It simulates what would happen if you re-optimized the strategy periodically and only used parameters chosen in the past.
4. Test on other instruments and periods
A logic with a real basis usually works, even if with different results, on similar instruments and in different periods. If it only works on one instrument and one year, be suspicious.
5. Simplify
Between two strategies with similar results, the simpler one tends to be more robust. Every rule must justify its existence.
The final test: trade small
Even a strategy validated out of sample should go through a period of trading with reduced size or on a demo account. Comparing live results with backtest results, recorded in a trading journal, is the last barrier against overfitting.
The step-by-step for an honest test is in the backtesting guide, and the metrics to judge the result are in the guide on win rate, payoff and drawdown.
Educational content. Past results, including backtests, do not guarantee future results. Nothing in this article is investment advice.
