Backtesting

How to Avoid Overfitting in Trading Strategies

6 min read

Overfitting is the most common and dangerous mistake in strategy development. It occurs when a strategy is so perfectly tuned to historical data that it fails completely in live trading.

The Harsh Truth: Most strategies that show 200%+ returns in backtesting are overfit. They're curve-fitted to historical data and will likely lose money in live trading.

Signs Your Strategy is Overfit

Red FlagExample
Too many parametersSMA 17 crossing SMA 43 (why not 20/50?)
Perfect results90%+ win rate with tiny drawdowns
Only works on one stockGreat on RELIANCE, fails on everything else
Complex rules10+ conditions to enter a trade
Specific time periodsOnly works from 2018-2020

How to Avoid Overfitting

Rule 1: Keep It Simple

The best strategies are often the simplest. Limit yourself to 2-3 conditions maximum.

Overfit StrategyRobust Strategy
RSI 13 < 28 AND SMA 17 > SMA 43 AND MACD > 0.5 AND Volume > 1.2MRSI 14 < 30 AND Close > SMA 200
Rule of Thumb: If you can't explain your strategy in one sentence, it's probably too complex.

Rule 2: Use Standard Parameters

Stick to commonly used indicator periods:

IndicatorStandard ValuesAvoid
SMA/EMA10, 20, 50, 100, 20017, 43, 67
RSI1411, 13, 17
MACD12, 26, 910, 22, 7
Bollinger20, 215, 1.7

Rule 3: Test on Multiple Stocks

A robust strategy should work across similar stocks:

  • If it only works on RELIANCE but not TCS, INFY, or HDFC → Overfit
  • If it works on 7 out of 10 large-cap stocks → More likely robust

Rule 4: Out-of-Sample Testing

  1. Develop strategy on 70% of data (2015-2021)
  2. Test on remaining 30% (2022-2024)
  3. If performance drops significantly → Strategy is overfit

Rule 5: Expect Realistic Returns

MetricRealisticLikely Overfit
Annual Return15-30%100%+
Win Rate40-60%80%+
Max Drawdown15-30%<5%
Sharpe Ratio1.0-2.03.0+
Reality Check: Warren Buffett has averaged ~20% annually. If your backtest shows 200% returns, you've found an error, not a goldmine.

Building Robust Strategies

Focus on strategies based on proven market logic:

  • Trend following: Prices tend to continue (momentum)
  • Mean reversion: Prices return to average
  • Breakouts: Price breaks through key levels

These concepts have worked across markets and time periods because they're based on human psychology, not data mining.

Quick Checklist Before Trading Live

  • Strategy has 3 or fewer conditions
  • Uses standard indicator parameters
  • Works on multiple similar stocks
  • Tested on out-of-sample data
  • Returns are realistic (not too good to be true)
  • You can explain the logic in plain English
Compliance disclosure: This article is for informational and educational purposes only and does not constitute financial advice. Simulations referenced use historical backtesting data, which does not guarantee future results. VivaTrades is not a SEBI-registered Investment Adviser or Research Analyst. Market investments are subject to risks; please read all disclosure documents before investing.

Ready to test this?

Apply what you've learned with real Indian stock data.

Start backtesting

Related research in Backtesting