Skip to content

Optimization Best Practices

Overfitting occurs when a strategy is too perfectly tuned to historical data and fails in live trading.

  • Unrealistically high returns (>100% annually)
  • Very high win rate (>80%)
  • Many parameters (>5)
  • Isolated optimal values (no stable region)
  • Poor out-of-sample performance
  1. Use Sufficient Data

    • Minimum 5 years for daily strategies
    • Include different market conditions
  2. Limit Parameters

    • Start with 2-3 parameters
    • Add complexity only if justified
  3. Use Walk-Forward Analysis

    • Always validate out-of-sample
    • Aim for >50% efficiency ratio
  4. Look for Stable Regions

    • Avoid isolated peaks
    • Choose parameters where nearby values also work
  • At least 30 trades for basic statistics
  • 100+ trades for reliable estimates

When testing many parameter combinations, some will look good by chance.

  • 100 combinations → expect ~5 false positives at 95% confidence
  • Use stricter thresholds for more combinations

Always include realistic costs:

Cost TypeTypical Value
Commission$0.005/share or $1/trade
Slippage0.1% - 0.5% per trade
Spread0.05% - 0.2%
  1. Develop strategy with clear hypothesis
  2. Backtest on training data (60% of history)
  3. Optimize parameters on training data
  4. Validate on test data (40% of history)
  5. Walk-Forward for final validation
  6. Paper Trade before going live

Stop and reconsider if you see:

  • Need to re-optimize frequently
  • Performance varies wildly by period
  • Strategy only works on specific stocks
  • You’re adding indicators to “fix” issues