What overfitting is, and how to spot it in a backtest
Words on this page
- Overfitting
- Fitting rules so tightly to past data that they describe its accidents. The rules then look excellent on that data and ordinary, or worse, on anything new.
- Setting
- A number in a rule you can change, such as how many months a trend is measured over. Statisticians call settings parameters.
- Held-back years
- Years of data kept aside while designing the rules and used once, at the end, as a fair test (out-of-sample data).
- Noise
- The random part of price moves: real, but with no pattern that repeats.
How it happens
Every past price series contains a pattern you could exploit, if you already know the prices. Add enough settings and conditions and a rule can be bent to catch the good months and dodge the bad ones of that particular history. None of that bending carries over to the future, because the accidents it caught won't happen the same way again.
Each step feels like an improvement: one more filter here, a slightly different setting there, each change making the chart a little better. That is how overfitting happens.
Signs a backtest is overfitted
None of these proves it alone; several together are a strong warning:
- Many settings, each at an oddly precise value that was picked because it tested best.
- The result falls apart when one setting is nudged a little in either direction.
- It does well on the years it was designed on and poorly on years it never saw.
- Most of the advantage comes from a few months, often around one crash.
- Nobody can say why the rule should work, only that it did.
- Dozens of versions were tried, and only the best one is being shown.
Habits that keep it out
- Fewer rules, with round settings you could have chosen before looking at any data.
- A reason first: write down why the rule should work before you test whether it did.
- Held-back years, tested once. If you go back and change the rule after seeing them, they are no longer held back.
- A nudge test: move every setting a little and check that the result changes a little, not a lot.
- Count the versions you tried, and judge the best one against what luck alone would produce from that many tries.
- Practice money in real time after the rules are set: those months can't be overfitted.
How BasisPoint checks for it
The Signal or noise verdict at the end of every backtest asks whether a result holds on years it was never tuned on, and its luck check raises the bar with every strategy you try. If you already have results from elsewhere, the free tool Is my strategy luck? asks how many versions you tried for the same reason.
Questions
Is overfitting the same as luck?
They are cousins. Luck is a good result that happened by chance; overfitting is searching through many rules until one matches past chance. Both look like skill on a chart and fade in real time.
Does a simple rule mean it isn't overfitted?
Not by itself. A simple rule chosen as the best of a hundred simple rules can be just as overfitted. Counting the versions you tried matters as much as keeping rules simple.
Can I check my own backtest for it?
Partly: nudge the settings, test on held-back years and count your versions. The free luck check covers the counting and the lucky-stretch part for results you already have.
Education only: not investment advice and not a recommendation to buy or sell anything. Facts about BasisPoint checked on November 21, 2026.
