What is overfitting?
By Oalgo · Last reviewed
Overfitting means tuning rules so closely to one stretch of past prices that they describe that stretch and little else. They look good in a backtest and often behave differently on new prices.
Why does overfitting fool people?
#- A backtest can be run as often as you like. Each small change to a rule or a setting is another try on the same prices.
- With enough tries, some settings will fit that period by chance.
- The version you keep is the one that fit best, so the backtest report looks better than the rules deserve.
What are the signs of overfitting?
#- Many rules, filters and exact numbers, each added to fix one past trade.
- A small change in a setting, such as 14 to 15, changes the report a lot.
- Very few trades behind the numbers.
How can you check for it?
#- Test more than one date range, including ranges you did not tune on.
- Keep the rules simple, with few settings.
- Change a setting a little. Rules that work at only one exact value are a warning.
- Forward test the rules. New prices cannot have been tuned on.
None of these proves the rules will hold up. They make a chance fit easier to spot.
Read next
- What is backtesting?Backtesting runs your rules on past prices to see how they would have behaved. Learn what it shows, what it cannot show, and how to read the report.
- What is forward testing?Forward testing runs your rules on new prices as they arrive, with simulated funds only. Learn how it differs from a backtest and when to use it.