Glossary

What is selection bias in backtesting?

Selection bias in backtesting, also called data snooping, is the optimism of picking the best of many tested variants: the more settings you try, the better the best one looks by chance alone.

Also called: data snooping

Every variant you test, in one sweep or over many evenings in the Strategy Tester, is another draw. Even if none of them has an edge, the best of many draws comes out high. The number at the top of a list is a maximum, and it has to be judged against how many settings were tried.

Bailey, Borwein, López de Prado and Zhu show the scale: for strategies with no real edge and five years of data, about 45 independent configurations are enough for the best one to show an annualized in-sample Sharpe ratio of about 1, while its expected out-of-sample Sharpe ratio is zero. Their Probability of Backtest Overfitting estimates the probability that the best in-sample configuration ranks below the median out of sample.

In practice

Our post on sample size works through a sweep in which every setting is a coin flip with 10 trades: one such setting wins 9 or 10 of them about 1% of the time, but across 100 settings the chance that at least one does is about 66%.

Illustrative numbers from the post, not a backtest result.

Read more

Topic: Overfitting

Part of the guide: Overfitting and luck

Sources