Is my backtest overfit?
Test enough strategies and one of them will look good by luck. The deflated Sharpe ratio (Bailey and López de Prado, 2014) gives the chance that your best backtest's Sharpe ratio is real, once you count how many strategies you tried, how long the test ran and the shape of its returns.
Deflated Sharpe ratio 0.85: could be luck.
The chance its true Sharpe ratio is above zero, counting all 50 tries: 85%.
- Luck's best
- 1.02
- The best Sharpe ratio 50 strategies with no edge would show over 5 years of daily returns, by chance.
- Tries to fake it
- 1,417
- Strategies with no edge it would take for the best one to show 1.50, by chance.
- Data needed
- 2.3 years
- Below this much data, the best of 50 tries with no edge is expected to reach 1.50.
| Strategies tried | Luck's best Sharpe | Your deflated Sharpe |
|---|---|---|
| 1 | 0.00 | > 0.99 |
| 10 | 0.70 | 0.96 |
| 100 | 1.13 | 0.79 |
| 1,000 | 1.46 | 0.53 |
| 10,000 | 1.73 | 0.30 |
How it works
Picking the best of many backtests also picks the luckiest. Strategies with no edge at all still show Sharpe ratios scattered around zero, and the best of them sits higher the more of them there are. Over T returns that scatter is about √(1 / (T − 1)), and the expected best of N draws is a known function of N, so luck's best Sharpe ratio is:
Here γ ≈ 0.5772 is the Euler-Mascheroni constant and Φ⁻¹ the inverse of the normal distribution. The deflated Sharpe ratio measures your Sharpe ratio against that luck instead of against zero, with the returns' skewness (γ₃) and kurtosis (γ₄) taken into account:
Both Sharpe ratios are per period here (the annual figure divided by the square root of the periods in a year), and T is the number of returns. When you know the spread of the Sharpe ratios across your tries, it takes the place of √(1 / (T − 1)), as in the original paper. The data needed is the minimum backtest length: the expected best of N draws, divided by the annual Sharpe ratio, squared, in years.
The Gauntlet holds every idea to the same expected-best bar, on t-statistics: a first idea needs t above 2.01, the 100th 2.53. How the Gauntlet tests a strategy.
What it can't see
- Tries you didn't count. Every setting you changed and every idea you dropped counts. Close variations of one idea count as fewer independent tries than their number, so the true N sits somewhere between the two.
- Costs, look-ahead or survivorship inside the backtest: it takes the Sharpe ratio as given.
- The future. A high deflated Sharpe ratio says the past result is unlikely to be luck alone, not that it will continue.
Sources
- Bailey, D. H. and López de Prado, M. (2014). The Deflated Sharpe Ratio: Correcting for Selection Bias, Backtest Overfitting and Non-Normality. The Journal of Portfolio Management, 40(5).
- Bailey, D. H., Borwein, J. M., López de Prado, M. and Zhu, Q. J. (2014). Pseudo-Mathematics and Financial Charlatanism: The Effects of Backtest Overfitting on Out-of-Sample Performance. Notices of the American Mathematical Society, 61(5).
The first paper's worked example (an annual Sharpe ratio of 2.5 over five years of daily returns, 100 tries whose Sharpe ratios have a variance of 0.5, so a spread of √0.5 ≈ 0.71, skewness −3, kurtosis 10) comes to 0.90 here, as it does there. Open the example in the calculator.
More calculators
- How many trades do I need?
How many trades an edge takes before it can be told apart from luck, at the Gauntlet's own bar.
- Position size
Shares from the account, the risk per trade and the stop, with the prices at 1R, 2R and 3R.
- The Gauntlet
The full test of a trading idea: 15 years of large US stocks, each stock's own costs, bull and bear markets and the same plan on random dates. How it tests.
The calculators are general statistics on the numbers you enter, worked out in your browser: what you type into them isn't sent anywhere. Research and education only, not investment advice.
Honest backtests, by email
New Gauntlet tests, killed-edge autopsies and the rare rule that clears every check. Occasional, no hype.