Run two hundred variations of a strategy on five years of daily data and keep the best one. Under the assumptions of this article, that best one will usually show an annualised Sharpe ratio around 1.3, a t-statistic above 3, and a Probabilistic Sharpe Ratio above 99.9%. None of those numbers is a bug. Each is a correct answer to a question nobody should be asking: how good does this strategy look if I pretend it was the only one I tried?

Backtest overfitting is not mainly about bad code or look-ahead bias, though both are common. It is a statistical problem: selection under noise. This article puts numbers on it. It covers the sampling error of the Sharpe ratio, the Probabilistic and Deflated Sharpe Ratios, the effective number of trials, and the Probability of Backtest Overfitting estimated by combinatorially symmetric cross-validation. Every number below comes from code that is shown and was run with fixed seeds.


1. The Sharpe Ratio Is an Estimate, and a Noisy One

1.1 Units first

Most errors in this area come from mixing units, so we fix them up front. Let r1,…,rTr_1, \dots, r_T be per-period excess returns (daily, in all examples here). The estimator is

SR^=μ^σ^,\widehat{\mathrm{SR}} = \frac{\hat\mu}{\hat\sigma},

a per-period Sharpe ratio, and TT is the number of periods. Every formula in this article uses those units. Annualisation happens only at the end, for display, by multiplying by q\sqrt{q} with q=252q = 252 for daily data. This rule is valid only if returns are i.i.d. (see §1.3).

1.2 Standard error: Lo and Mertens

For i.i.d. normal returns, Lo (2002) gives the asymptotic distribution

SR^  ∼a  N ⁣(SR,  1+12SR2T).\widehat{\mathrm{SR}} \;\overset{a}{\sim}\; \mathcal{N}\!\left(\mathrm{SR},\; \frac{1 + \tfrac12 \mathrm{SR}^2}{T}\right).

The 12SR2\tfrac12 \mathrm{SR}^2 term comes from estimating σ\sigma as well as μ\mu. For daily data it is negligible: a per-period SR of 0.06 contributes 0.0018. So in practice SE(SR^)≈1/T\text{SE}(\widehat{\mathrm{SR}}) \approx 1/\sqrt{T} per period. In annual units that gives the rule of thumb most people never internalise:

SE(SR^ann)  ≈  qT  =  1years.\text{SE}\big({\widehat{\mathrm{SR}}}_{\text{ann}}\big) \;\approx\; \sqrt{\frac{q}{T}} \;=\; \frac{1}{\sqrt{\text{years}}}.

A one-year backtest has an annualised-Sharpe standard error of about 1.0. Five years gives about 0.45, and ten years about 0.32. To reject SR=0\mathrm{SR} = 0 at t=2t = 2 you need roughly (2/SRann)2(2 / \mathrm{SR}_{\text{ann}})^2 years of data:

True annual SRYears for t≈2t \approx 2Years for t≈3t \approx 3
0.51636
1.049
2.012.25

Mertens (2002) relaxes normality while keeping i.i.d. Let γ3\gamma_3 be the skewness and γ4\gamma_4 the raw kurtosis (γ4=3\gamma_4 = 3 for a normal). Then

Var⁡(SR^)  ≈  1−γ3 SR+γ4−14SR2T.\operatorname{Var}\big(\widehat{\mathrm{SR}}\big) \;\approx\; \frac{1 - \gamma_3\, \mathrm{SR} + \frac{\gamma_4 - 1}{4} \mathrm{SR}^2}{T}.

Setting γ3=0,γ4=3\gamma_3 = 0, \gamma_4 = 3 recovers Lo's 1+12SR21 + \tfrac12 \mathrm{SR}^2. Two consequences follow:

  • Negative skew inflates the error, and the effect is proportional to SR\mathrm{SR}. Short-volatility, carry and market-making P&L all have that profile.
  • Fat tails inflate it quadratically in SR\mathrm{SR}.

At daily frequency, with small per-period SRs, the correction is modest. At monthly frequency it is not. Take a monthly strategy with per-period SR=0.5\mathrm{SR} = 0.5 (about 1.73 annualised), γ3=−2\gamma_3 = -2 and γ4=12\gamma_4 = 12. The numerator is 1+1+2.75×0.25=2.691 + 1 + 2.75 \times 0.25 = 2.69, against 1.1251.125 under normality. The standard error is 55% larger than a naive calculation reports.

1.3 Annualisation under autocorrelation

The q\sqrt{q} rule assumes serially uncorrelated returns. Lo (2002) gives the general aggregation factor for a qq-period Sharpe ratio:

SR(q)  =  η(q) SR,η(q)=q q+2∑k=1q−1(q−k) ρk ,\mathrm{SR}(q) \;=\; \eta(q)\, \mathrm{SR}, \qquad \eta(q) = \frac{q}{\sqrt{\,q + 2\sum_{k=1}^{q-1} (q-k)\,\rho_k\,}},

where ρk\rho_k is the lag-kk autocorrelation of per-period returns. Positive autocorrelation, typical of smoothed or illiquid marks and of trend-following P&L at short horizons, makes η(q)<q\eta(q) < \sqrt{q}, so the naive annualised Sharpe is overstated. Negative autocorrelation does the opposite. Strategies that mark to model or hold stale prices tend to have strongly positive ρ1\rho_1, and their quoted annualised Sharpe ratios can be inflated by a large factor. If you report an annual figure, compute η(q)\eta(q) from the data rather than assuming 252\sqrt{252}.


2. The Probabilistic Sharpe Ratio

Bailey and López de Prado (2012) turn the Mertens distribution into a probability. Given a benchmark SR∗\mathrm{SR}^* in per-period units, the Probabilistic Sharpe Ratio is

PSR^(SR∗)  =  Φ ⁣((SR^−SR∗)T−11−γ^3 SR^+γ^4−14 SR^2),\widehat{\mathrm{PSR}}(\mathrm{SR}^*) \;=\; \Phi\!\left( \frac{(\widehat{\mathrm{SR}} - \mathrm{SR}^*)\sqrt{T-1}} {\sqrt{1 - \hat\gamma_3\,\widehat{\mathrm{SR}} + \frac{\hat\gamma_4 - 1}{4}\,{\widehat{\mathrm{SR}}}^2}} \right),

the estimated probability that the true Sharpe exceeds SR∗\mathrm{SR}^*. It penalises short track records, negative skew and fat tails, which the raw Sharpe ignores. Its weakness is the one this article is about: PSR assumes the strategy was the only one tested. Feed it the winner of a search and it confidently certifies noise.

The building blocks, used throughout:

# sharpe_stats.py
import numpy as np
from scipy.stats import norm, skew, kurtosis

EULER_GAMMA = 0.5772156649015329

def sharpe(r):
    """Per-period Sharpe ratio (no annualisation, zero risk-free rate)."""
    return r.mean() / r.std(ddof=1)

def sharpe_se(sr, T, g3=0.0, g4=3.0):
    """Std. error of the per-period Sharpe estimate (Mertens 2002).
    g4 is raw kurtosis (3 for a normal); g3=0, g4=3 recovers Lo (2002)."""
    return np.sqrt((1.0 - g3 * sr + (g4 - 1.0) / 4.0 * sr**2) / (T - 1))

def psr(r, sr_star=0.0):
    """Probabilistic Sharpe Ratio: P[true SR > sr_star], per-period units."""
    sr = sharpe(r)
    g3 = skew(r)
    g4 = kurtosis(r, fisher=False)          # raw kurtosis
    z = (sr - sr_star) / sharpe_se(sr, len(r), g3, g4)
    return norm.cdf(z)

def expected_max_sr(n_trials, sr_var):
    """E[max of n_trials zero-skill Sharpe estimates], per-period units."""
    sd = np.sqrt(sr_var)
    return sd * ((1 - EULER_GAMMA) * norm.ppf(1 - 1.0 / n_trials)
                 + EULER_GAMMA * norm.ppf(1 - 1.0 / (n_trials * np.e)))

def dsr(r, n_trials, sr_var):
    """Deflated Sharpe Ratio: PSR against the expected maximum of noise."""
    return psr(r, sr_star=expected_max_sr(n_trials, sr_var))

3. Selection: The Expected Maximum of Noise

3.1 The order statistic

Suppose you run NN independent trials, none with any skill. Each estimated Sharpe is approximately N(0,V)\mathcal{N}(0, V), with V≈1/TV \approx 1/T per period. The best of them is not zero. For large NN, extreme value theory approximates the expected maximum of NN i.i.d. standard normals as

E[max⁡nZn]  ≈  (1−γ) Φ−1 ⁣(1−1N)  +  γ Φ−1 ⁣(1−1Ne),\mathbb{E}\Big[\max_n Z_n\Big] \;\approx\; (1-\gamma)\,\Phi^{-1}\!\Big(1 - \tfrac{1}{N}\Big) \;+\; \gamma\,\Phi^{-1}\!\Big(1 - \tfrac{1}{N e}\Big),

with γ≈0.5772\gamma \approx 0.5772 the Euler–Mascheroni constant. Scaling by V\sqrt{V} gives the expected maximum Sharpe of NN zero-skill trials:

SR0  =  V[{SR^n}]  [(1−γ) Φ−1 ⁣(1−1N)+γ Φ−1 ⁣(1−1Ne)].\mathrm{SR}_0 \;=\; \sqrt{V\big[\{{\widehat{\mathrm{SR}}}_n\}\big]}\;\left[(1-\gamma)\,\Phi^{-1}\!\Big(1 - \tfrac{1}{N}\Big) + \gamma\,\Phi^{-1}\!\Big(1 - \tfrac{1}{N e}\Big)\right].

This is the bar that a selected strategy must clear. The bar grows with NN, roughly like 2ln⁡N\sqrt{2 \ln N}: slowly, but without limit.

Expected maximum annualised Sharpe of N zero-skill trials versus N on a log axis, for 1, 5 and 10-year backtests
Figure 1. The noise bar rises with every trial and falls only with sample length. At N = 200 it is 2.77 for a 1-year backtest, 1.24 for 5 years and 0.87 for 10 years. Analytic formula with V = 1/T.

3.2 The Deflated Sharpe Ratio

Bailey and López de Prado (2014) define the Deflated Sharpe Ratio as the PSR evaluated against that bar:

DSR^  =  PSR^(SR0).\widehat{\mathrm{DSR}} \;=\; \widehat{\mathrm{PSR}}(\mathrm{SR}_0).

It answers the question that matters: given that this strategy is the best of NN, and given its track-record length, skew and kurtosis, what is the probability that its true Sharpe is positive beyond what selection alone would produce? The usual decision rule is to require DSR^>0.95\widehat{\mathrm{DSR}} > 0.95.

3.3 The experiment

We generate 200 strategies, each with five years (1,260 days) of i.i.d. normal daily returns, zero mean and 1% daily volatility. No strategy has any skill. We select the one with the best Sharpe, as a researcher scanning a parameter grid would.

import numpy as np
from sharpe_stats import sharpe, psr, dsr, expected_max_sr

rng = np.random.default_rng(42)
T, N = 1260, 200                      # 5 years of daily returns, 200 trials
R = rng.normal(0.0, 0.01, size=(T, N)) # zero mean: no strategy has skill

srs = R.mean(0) / R.std(0, ddof=1)    # per-period Sharpe of every trial
best = srs.argmax()
r_best = R[:, best]

print(f"best per-period SR : {srs[best]:.4f}")
print(f"best annualised SR : {srs[best] * np.sqrt(252):.2f}")
print(f"t-stat of best     : {srs[best] * np.sqrt(T):.2f}")
print(f"PSR(SR*=0)         : {psr(r_best):.4f}")

sr_var = srs.var(ddof=1)              # cross-sectional variance of trial SRs
sr0 = expected_max_sr(N, sr_var)
print(f"E[max SR] (annual) : {sr0 * np.sqrt(252):.2f}")
print(f"DSR                : {dsr(r_best, N, sr_var):.4f}")

Output:

best per-period SR : 0.0968
best annualised SR : 1.54
t-stat of best     : 3.44
PSR(SR*=0)         : 0.9997
E[max SR] (annual) : 1.30
DSR                : 0.7022

Read the lines one at a time:

  • Annualised Sharpe 1.54 over five years from pure noise. With a plausible story attached, many allocators would take that meeting.
  • t-statistic 3.44. That clears the t>3t > 3 hurdle of Harvey, Liu and Zhu (2016), discussed in §5.
  • PSR 0.9997. PSR does its job correctly and still says "almost certainly skill", because it was told this was a single trial.
  • Expected maximum of 200 noise trials: 1.30 annualised. The winner beats the expected best of noise by only about 0.24, roughly half an annual standard error.
  • DSR 0.70, below 0.95. Once the number of trials is counted, the evidence is not significant.
Histogram of the 200 in-sample annualised Sharpe ratios, with the expected maximum of noise at 1.30 and the selected best at 1.54 marked
Figure 2. All 200 trials have a true Sharpe of zero. The winner, at 1.54, sits only slightly beyond the 1.30 that the best of 200 noise draws is expected to reach. Simulated data, seed 42.

What happens after selection makes the same point. Continue all 200 strategies for two more years on fresh noise (an independent seed, 43, so the numbers above are unchanged). The in-sample winner then earns an annualised Sharpe of 0.20, adding about 6% to the 121% it made in-sample.

Cumulative return of 200 zero-skill strategies over five years, the best highlighted, then its flat out-of-sample continuation over two more years
Figure 3. Chosen at year 5, the winner looks like a steady compounder. After selection it goes roughly flat (annualised Sharpe 0.20 over two years), because nothing distinguished it except luck. In-sample seed 42, out-of-sample seed 43.

The same return series gives PSR = 0.9997 and DSR = 0.70. The only difference is whether you disclose that it was the best of 200. The number of trials is not a footnote: it is part of the test statistic.

Note on VV: the code uses the cross-sectional variance of the 200 estimated Sharpes, as Bailey and López de Prado recommend, rather than the theoretical 1/T1/T. With independent trials the two agree closely: the 1/T1/T version gives an annualised bar of 1.24 versus 1.30 here. The distinction becomes decisive once trials are correlated.


4. How Many Trials Did You Really Run?

4.1 Correlated trials are not independent trials

The formula for SR0\mathrm{SR}_0 assumes NN independent draws. Real searches are nothing like that. Neighbouring lookback windows, thresholds that differ by one tick, and the same signal on overlapping universes all produce highly correlated P&L. Counting each variant as an independent trial overstates NN and makes DSR too harsh. Counting the whole grid as "one idea" makes it far too lenient.

A common heuristic is the average-correlation approximation

Neff  ≈  ρˉ+(1−ρˉ) N,N_{\text{eff}} \;\approx\; \bar\rho + (1 - \bar\rho)\,N,

which interpolates between Neff=1N_{\text{eff}} = 1 when every trial is the same (ρˉ=1\bar\rho = 1) and Neff=NN_{\text{eff}} = N when trials are independent. It is better than nothing, but in the experiment below it remains badly miscalibrated. The reason is that correlation affects the bar in two ways: it reduces the count, and it also shrinks the cross-sectional dispersion of the Sharpe estimates.

4.2 Experiment

We build 200 zero-skill strategies with pairwise return correlation ρ=0.6\rho = 0.6. Each one loads 0.6\sqrt{0.6} on a common noise factor and 0.4\sqrt{0.4} on its own idiosyncratic noise. We repeat 500 times and compare the simulated expected maximum Sharpe with three candidate bars.

import numpy as np
from sharpe_stats import expected_max_sr

rng = np.random.default_rng(7)
T, N, rho, n_sims = 1260, 200, 0.6, 500
ann = np.sqrt(252)
maxes, bench_cs = [], []
for _ in range(n_sims):
    common = rng.normal(0, 0.01, size=(T, 1))
    idio = rng.normal(0, 0.01, size=(T, N))
    R = np.sqrt(rho) * common + np.sqrt(1 - rho) * idio   # pairwise corr = rho
    srs = R.mean(0) / R.std(0, ddof=1)
    maxes.append(srs.max())
    # benchmark built from the cross-sectional dispersion of the trials
    bench_cs.append(srs.mean() + expected_max_sr(N, srs.var(ddof=1)))

n_eff = rho + (1 - rho) * N            # average-correlation approximation
print(f"simulated E[max SR] (annual)         : {np.mean(maxes) * ann:.2f}")
print(f"formula, N={N}, iid variance 1/T    : {expected_max_sr(N, 1/T) * ann:.2f}")
print(f"formula, N_eff={n_eff:.0f}, iid variance   : {expected_max_sr(n_eff, 1/T) * ann:.2f}")
print(f"formula, N={N}, cross-sect. variance: {np.mean(bench_cs) * ann:.2f}")
simulated E[max SR] (annual)         : 0.77
formula, N=200, iid variance 1/T    : 1.24
formula, N_eff=81, iid variance   : 1.10
formula, N=200, cross-sect. variance: 0.78

The true expected maximum is 0.77. Treating the trials as independent puts the bar at 1.24, far too high. Shrinking NN to Neff=81N_{\text{eff}} = 81 helps only a little (1.10), because the bar depends on NN only through 2ln⁡N\sqrt{2\ln N}. The approach that works is to keep NN and use the observed cross-sectional variance of the trial Sharpes, centred on their cross-sectional mean. It gives 0.78, almost exactly right. Under the factor structure the trials share a common component, and only the idiosyncratic part, with variance (1−ρ)/T(1-\rho)/T, generates spread for selection to exploit. The empirical dispersion measures that spread directly.

The practical rules:

  1. Log every trial's return series, not just the winner's. Without the cross-section you cannot estimate VV.
  2. If trials fall into families (different signals, each with a parameter grid), cluster them, for example hierarchically on the correlation matrix. Then treat the number of clusters as NN and the dispersion of cluster-representative Sharpes as VV. This is the approach López de Prado advocates in later work, and it is more robust than any single scalar NeffN_{\text{eff}}.

5. Why a t > 3 Hurdle Is Not Enough

Harvey, Liu and Zhu (2016) surveyed hundreds of published cross-sectional return factors. Using multiple-testing adjustments (Bonferroni, Holm, Benjamini–Hochberg–Yekutieli), they argued that a newly proposed factor should clear t>3.0t > 3.0 rather than the conventional 2.0. The point is sound, and the hurdle is a large improvement over 1.96. But that threshold was calibrated to the number of hypotheses tested by the profession as they estimated it, not to the number your own research process tested.

The experiment in §3.3 produced t=3.44t = 3.44 from 200 zero-skill trials. A private grid search over a few hundred configurations is a routine afternoon. A fixed tt threshold cannot replace accounting for your own NN. Since t=SR^Tt = \widehat{\mathrm{SR}}\sqrt{T}, the DSR is effectively a hurdle that scales with NN, TT and the shape of the return distribution together.


6. Probability of Backtest Overfitting (CSCV)

DSR asks whether the selected strategy's performance exceeds what selection would produce. A complementary question is whether the selection procedure itself tends to pick strategies that underperform out of sample. Bailey, Borwein, López de Prado and Zhu answer it with combinatorially symmetric cross-validation (CSCV) and the statistic they call the Probability of Backtest Overfitting (PBO).

6.1 Procedure

Stack the per-period returns of all NN trials into a T×NT \times N matrix MM and split its rows into SS contiguous blocks of equal size (SS even). For every one of the (SS/2)\binom{S}{S/2} ways to choose half the blocks:

  1. The chosen blocks form the in-sample set JJ, and the complementary blocks form the out-of-sample set Jˉ\bar J. Both have the same length, which is what "symmetric" refers to.
  2. Compute every trial's Sharpe on JJ and on Jˉ\bar J.
  3. Let n∗n^* be the trial with the best in-sample Sharpe.
  4. Find its relative rank out of sample, ω∈(0,1)\omega \in (0,1), and its logit λ=ln⁡ ⁣(ω/(1−ω))\lambda = \ln\!\big(\omega/(1-\omega)\big).

Then

PBO^  =  #{λ≤0}(SS/2),\widehat{\mathrm{PBO}} \;=\; \frac{\#\{\lambda \le 0\}}{\binom{S}{S/2}},

the fraction of splits in which the in-sample winner ranks at or below the median out of sample. A selection procedure with no real information should land near 0.5. Values well below 0.5 mean the procedure picks trials that keep working.

6.2 Implementation

A naive implementation recomputes means and variances for all (168)=12,870\binom{16}{8} = 12{,}870 splits from the raw matrix. Precomputing per-block sums and sums of squares makes each split an O(S⋅N)O(S \cdot N) operation:

# pbo.py
import numpy as np
from itertools import combinations

def pbo_cscv(R, S=16):
    """Probability of Backtest Overfitting via CSCV.
    R: (T, N) matrix of per-period returns, one column per trial."""
    T, N = R.shape
    blocks = np.array_split(np.arange(T), S)
    # sufficient statistics per block -> Sharpe of any union of blocks is cheap
    n  = np.array([len(b) for b in blocks], dtype=float)          # (S,)
    s1 = np.stack([R[b].sum(0) for b in blocks])                  # (S, N)
    s2 = np.stack([(R[b] ** 2).sum(0) for b in blocks])           # (S, N)

    def sr(idx):
        k = n[idx].sum()
        m = s1[idx].sum(0) / k
        v = (s2[idx].sum(0) - k * m**2) / (k - 1)
        return m / np.sqrt(v)

    logits, is_best, oos_best = [], [], []
    for combo in combinations(range(S), S // 2):
        is_idx = np.array(combo)
        oos_idx = np.setdiff1d(np.arange(S), is_idx)
        sr_is, sr_oos = sr(is_idx), sr(oos_idx)
        star = sr_is.argmax()                        # the trial you would pick
        rank = (sr_oos < sr_oos[star]).sum() + 1     # 1..N, N = best OOS
        w = rank / (N + 1)                           # relative rank in (0,1)
        logits.append(np.log(w / (1 - w)))
        is_best.append(sr_is[star]); oos_best.append(sr_oos[star])

    logits = np.array(logits)
    return {
        "pbo": float((logits <= 0).mean()),
        "logits": logits,
        "sr_is": np.array(is_best),
        "sr_oos": np.array(oos_best),
    }

6.3 Noise versus edge, one realisation

We apply it first to the exact 200 noise strategies from §3.3. Then we take the same matrix and add genuine drift to one column, at true annualised Sharpe ratios of 0.5, 1.0 and 2.0:

import numpy as np
from pbo import pbo_cscv

ann = np.sqrt(252)
rng = np.random.default_rng(42)
T, N = 1260, 200
noise = rng.normal(0.0, 0.01, size=(T, N))

res = pbo_cscv(noise, S=16)
print(f"noise only : PBO = {res['pbo']:.3f}, "
      f"median IS SR = {np.median(res['sr_is']) * ann:.2f}, "
      f"median OOS SR = {np.median(res['sr_oos']) * ann:.2f}")

for true_sr in (0.5, 1.0, 2.0):          # annualised Sharpe of one real strategy
    R = noise.copy()
    R[:, 0] += true_sr / ann * 0.01      # shift the mean of column 0
    res = pbo_cscv(R, S=16)
    print(f"edge SR={true_sr:.1f}: PBO = {res['pbo']:.3f}, "
          f"median OOS SR of pick = {np.median(res['sr_oos']) * ann:.2f}")
noise only : PBO = 0.300, median IS SR = 1.79, median OOS SR = 0.78
edge SR=0.5: PBO = 0.323, median OOS SR of pick = 0.73
edge SR=1.0: PBO = 0.243, median OOS SR of pick = 0.68
edge SR=2.0: PBO = 0.059, median OOS SR of pick = 1.99

Two results deserve attention.

First, the noise-only PBO is 0.30, not 0.5, and the median out-of-sample Sharpe of the pick is a positive 0.78. This is not a flaw in the code. It shows what CSCV can and cannot see. Every split re-partitions the same realised path. In this realisation one column happens to have a full-sample Sharpe of 1.54 (the §3.3 winner), so it tends to win in-sample on many splits and stay above median out of sample. CSCV measures how stable the selection is within the data you have. It cannot tell a lucky path from a skilful one. That is DSR's job, and it is why the two statistics complement each other rather than substitute for one another.

Second, edge is detectable only when it is large relative to sampling error. A true annual Sharpe of 0.5 among 199 noise trials over five years is invisible: the PBO of 0.32 is indistinguishable from the noise-only case, because the real strategy rarely wins in-sample. Its edge is about one annual standard error, while the noise maximum is around 2.8 standard errors. At a true Sharpe of 2.0, the real strategy wins almost every split, PBO falls to 0.06, and the out-of-sample Sharpe of the pick (1.99) matches its true value.

Distributions of the CSCV logit λ across 12,870 splits for the noise-only set and for the set containing one true Sharpe 2.0 strategy
Figure 4. PBO is the mass left of λ = 0. With noise only (PBO 0.300) the logits spread widely. With one genuine Sharpe 2.0 strategy (PBO 0.059) they pile up at the right edge, where the in-sample winner is also the out-of-sample best. Simulated data, seed 42, S = 16.

6.4 PBO has its own sampling distribution

Because a single realisation can mislead, we repeat the experiment over 100 seeds. We use S=10S = 10 to keep run time short; there are 252 splits per run.

import numpy as np
from pbo import pbo_cscv

ann = np.sqrt(252)
T, N = 1260, 200
pbo_noise, pbo_edge = [], []
for seed in range(100):
    rng = np.random.default_rng(seed)
    noise = rng.normal(0.0, 0.01, size=(T, N))
    pbo_noise.append(pbo_cscv(noise, S=10)["pbo"])
    R = noise.copy(); R[:, 0] += 2.0 / ann * 0.01
    pbo_edge.append(pbo_cscv(R, S=10)["pbo"])
pbo_noise, pbo_edge = np.array(pbo_noise), np.array(pbo_edge)
print(f"noise : mean PBO = {pbo_noise.mean():.2f}, "
      f"5-95% = [{np.quantile(pbo_noise,.05):.2f}, {np.quantile(pbo_noise,.95):.2f}]")
print(f"edge  : mean PBO = {pbo_edge.mean():.2f}, "
      f"5-95% = [{np.quantile(pbo_edge,.05):.2f}, {np.quantile(pbo_edge,.95):.2f}]")
noise : mean PBO = 0.53, 5-95% = [0.27, 0.76]
edge  : mean PBO = 0.17, 5-95% = [0.01, 0.39]

On average, noise gives PBO ≈ 0.53, as theory predicts, and a genuine Sharpe-2 strategy gives 0.17. But the 90% ranges overlap. A noise-only search lands at 0.27 or lower one time in twenty, and a real edge lands at 0.39 or higher one time in twenty. A single PBO estimate is evidence, not a verdict.

PBO measures how reliable your selection procedure is on the data you have. DSR measures whether the selected result beats what selection would produce. Overfitting can hide from either one. It struggles to hide from both.

6.5 Choosing S and reading the output

  • SS trades resolution against block length. Larger SS gives more splits, but each block is shorter, and blocks must be long enough that the Sharpe in each half means something and that serial dependence does not leak across block boundaries. With daily data, SS between 10 and 16 over five or more years is a reasonable range.
  • Look beyond the headline PBO. The pairs (SR^IS,SR^OOS)({\widehat{\mathrm{SR}}}_{\mathrm{IS}}, {\widehat{\mathrm{SR}}}_{\mathrm{OOS}}) for the selected trial give the performance degradation slope: regress OOS on IS. Strongly negative slopes are the signature of a search that rewards in-sample noise. The share of splits with SR^OOS<0{\widehat{\mathrm{SR}}}_{\mathrm{OOS}} < 0 is the probability of an out-of-sample loss.
  • CSCV inherits your data's regime structure. With contiguous blocks, a single regime shift can dominate. That is a feature if you want to know whether the selection survives regimes, and a confound if you do not.

7. Putting It Together

QuestionToolNeeds
Is this single, pre-specified strategy's Sharpe distinguishable from zero?PSR(SR∗=0\mathrm{SR}^* = 0), Mertens SEReturn series, TT, skew, kurtosis
Is the selected strategy better than the best of noise?DSRAbove, plus NN and the cross-section of trial Sharpes
Does my selection procedure pick trials that persist?PBO via CSCVFull T×NT \times N matrix of trial returns
Is my annualised figure even comparable?Lo's η(q)\eta(q)Autocorrelations ρ1,…,ρq−1\rho_1, \dots, \rho_{q-1}

All four tools need one thing standard backtest reports omit: the record of everything you tried.


8. Research Hygiene Checklist

  1. Log every trial. Store the configuration, the code hash, and the full per-period return series for every backtest you run, including the ones you discard. This is what makes DSR and PBO computable afterwards.
  2. Report NN. Always disclose the number of trials, and the number of clusters if you clustered. A Sharpe ratio without NN cannot be interpreted.
  3. Pre-register before you look. Write down the hypothesis, universe, sample period, cost model, parameter ranges and the selection metric before you run anything. Every later change is a new trial and gets counted.
  4. Separate the hold-out physically. Reserve a final out-of-sample period you have never touched, ideally kept in a separate store you cannot query casually. Use it once. If you go back after looking, it is no longer a hold-out.
  5. Report Sharpe with its standard error. Use Mertens rather than Lo whenever skew or kurtosis are material, and compute annualisation with η(q)\eta(q) when returns are autocorrelated.
  6. Use DSR > 0.95 as a gate, with VV taken from the observed cross-section of trial Sharpes, not from 1/T1/T.
  7. Run CSCV on the full trial matrix and report the PBO, the degradation slope and the probability of an out-of-sample loss. Treat one PBO as a noisy estimate.
  8. Prefer fewer, economically motivated trials. The bar rises with 2ln⁡N\sqrt{2 \ln N}, but every trial you never run is free. A hypothesis grounded in a mechanism (who is forced to trade, and why) shrinks NN before the search even starts.
  9. Budget for decay. Even a strategy that passes all of the above should be sized for an out-of-sample Sharpe meaningfully below its backtest. Selection bias never goes to zero; it only becomes measurable.

References

  • Bailey, D. H., Borwein, J. M., López de Prado, M., & Zhu, Q. J. "The Probability of Backtest Overfitting." Journal of Computational Finance.
  • Bailey, D. H., & López de Prado, M. (2012). "The Sharpe Ratio Efficient Frontier." Journal of Risk, 15(2).
  • Bailey, D. H., & López de Prado, M. (2014). "The Deflated Sharpe Ratio: Correcting for Selection Bias, Backtest Overfitting, and Non-Normality." Journal of Portfolio Management, 40(5).
  • Harvey, C. R., Liu, Y., & Zhu, H. (2016). "…and the Cross-Section of Expected Returns." Review of Financial Studies, 29(1).
  • Lo, A. W. (2002). "The Statistics of Sharpe Ratios." Financial Analysts Journal, 58(4).
  • Mertens, E. (2002). "Comments on Variance of the IID Estimator in Lo (2002)." Working paper, University of Basel.

Research and education, not investment advice.