Avoiding Overfitting in Backtests
The biggest trap in backtesting and how to avoid curve-fitting your strategies.
Overfitting is the #1 mistake in backtesting. It happens when you optimize a strategy so precisely to past data that it only works on that specific data — and fails miserably on new, unseen data.
Signs of overfitting include: too many parameters, suspiciously perfect equity curves, strategies that work on one stock but not others, and results that look too good to be true.
To combat overfitting, use out-of-sample testing. Split your data into two periods — optimize on the first, then test on the second without any changes. If performance holds, the strategy is more robust.
Walk-forward analysis takes this further by repeatedly optimizing on a rolling window of data and testing on the next period. This simulates how the strategy would actually perform in real time.
Keep your strategies simple. The fewer parameters and rules, the less likely you are to overfit. A robust strategy with 2-3 rules will almost always outperform a complex one with 15 parameters.
See these concepts in action
Watch our YouTube channel for real backtests applying these principles.
Subscribe on YouTubeMore Guides
What is Backtesting?
Learn the fundamentals of backtesting trading strategies using historical data.
📐BeginnerKey Backtest Metrics Explained
Understanding Sharpe ratio, max drawdown, win rate, and other essential metrics.
🧮AdvancedBacktesting Options Strategies
Special considerations when backtesting options including Greeks, IV, and spreads.