This simulator shows how optimizing parameters on historical data creates strategies that appear profitable but fail in live trading.
Best In-Sample Strategy
-
Out-of-Sample Performance
-
Why Overfitting Happens
Overfitting occurs when a trading strategy is excessively optimized to historical data, capturing random noise rather than genuine market patterns. This simulation demonstrates:
How testing many parameter combinations guarantees finding something that "worked" in the past
The performance gap between in-sample (backtest) and out-of-sample (real-world) results
Why most published trading strategies fail in live markets
P(False Strategy) = 1 - (1 - α)n
Where:
α: Probability a random strategy appears significant (typically 5%)
n: Number of strategies tested
With 100 trials at α=5%, there's a 99.4% chance at least one worthless strategy will appear significant.
How to Avoid Overfitting
Use walk-forward analysis instead of single backtests
Limit parameter combinations (reduce degrees of freedom)
Test on multiple market regimes (bull/bear/neutral markets)
Use out-of-sample data that wasn't used for optimization