0bps

Learn / Track VI / lesson 2 of 5

Overfitting and the deflated Sharpe ratio

Why the best of many backtests is almost always worse than it looks, and how to correct for how hard you searched.

11 min read

The selection problem

Try enough variations of a strategy and one will look excellent purely by chance. The best result from a search is a biased estimate of the truth, and the bias grows with the number of trials.

Suppose every variant you try has a true Sharpe of zero. With NN independent trials, the expected maximum Sharpe you will observe is approximately

E[max⁡SR^]≈σSR((1−γ) Z−1 ⁣(1−1N)+γ Z−1 ⁣(1−1Ne))\mathbb{E}[\max \widehat{SR}] \approx \sigma_{SR}\left((1-\gamma)\,Z^{-1}\!\Big(1 - \frac{1}{N}\Big) + \gamma\, Z^{-1}\!\Big(1 - \frac{1}{Ne}\Big)\right)

where Z−1Z^{-1} is the inverse normal CDF, γ≈0.5772\gamma \approx 0.5772 is the Euler–Mascheroni constant, and σSR\sigma_{SR} is the standard deviation of the Sharpe estimates across trials. For 100 trials this is roughly 2.5 σSR2.5\,\sigma_{SR}; for 1,000, about 3.3 σSR3.3\,\sigma_{SR}.

What that means in practice

With three years of daily data, the standard error of an annualised Sharpe is about 0.58. Test 100 worthless strategies and the best will show an annualised Sharpe of around 1.4. Test 1,000 and the winner shows about 1.9. Neither has any edge.

The deflated Sharpe ratio

Bailey and López de Prado’s deflated Sharpe ratio (DSR) asks: given how many trials you ran, and given the skewness and kurtosis of the returns, what is the probability that the true Sharpe exceeds zero?

DSR=Z ⁣((SR^−SR0)T−11−γ^3 SR^+γ^4−14SR^2)\text{DSR} = Z\!\left(\frac{(\widehat{SR} - SR_0)\sqrt{T - 1}}{\sqrt{1 - \hat\gamma_3\,\widehat{SR} + \frac{\hat\gamma_4 - 1}{4}\widehat{SR}^2}}\right)

Here SR^\widehat{SR} is the per-period Sharpe, TT the number of observations, γ^3\hat\gamma_3 and γ^4\hat\gamma_4 the skewness and kurtosis, and SR0SR_0 the expected maximum Sharpe under the null from the formula above. A DSR above 0.95 is reasonable evidence of a real edge. Run it on your own numbers with the Sharpe significance tool.

Notice the denominator: negative skew and fat tails increase the uncertainty of the Sharpe estimate, so strategies that sell tail risk need even more evidence.

Symptoms of an overfit strategy

  • Many parameters relative to the number of trades.
  • Oddly specific values (an RSI period of 13, a stop at 2.37 ATR).
  • Performance that collapses when a parameter moves a little — a sharp peak rather than a broad plateau in parameter space.
  • Great in-sample results, ordinary or negative out-of-sample.
  • A narrative invented after seeing the backtest.

Defences

  1. Count your trials honestly, including the ones you abandoned, and deflate.
  2. Hold out data you never touch until the very end — and only once.
  3. Prefer plateaus to peaks: choose parameters from the middle of a broad region of good performance.
  4. Fewer degrees of freedom: simpler rules, fewer filters.
  5. Validate properly: walk-forward and purged cross-validation.
  6. Demand a reason: an economic or behavioural story for the edge, stated before testing.
About the 5,800 specs in the vault

The vault is a superb idea library, but every published backtest in it is the survivor of an unknown number of trials by its author. Treat each one as a hypothesis to re-test on fresh data with honest costs, not as evidence.

Put it to work

esc

Try , , or .

↑↓ move↵ open