Overfitting is one of the most common ways systematic strategies lose money. If you test enough ideas against the same history, some of them will look good by chance. The usual significance test, a single trial judged at p < 0.05, says nothing useful once you have run thousands of trials and kept the best one.
This note describes the checks we run before we trust a backtest: the Deflated Sharpe Ratio, three placebo tests (phase-scrambled surrogate data, factor ablation, and a lead-lag inversion), and Combinatorial Purged Cross-Validation. None of these methods is ours. They come from the published literature, and we note the sources as we go. What follows is how we apply them and the thresholds we use.
1. Multiple Testing and the Deflated Sharpe Ratio
The Sharpe ratio $\widehat{\text{SR}}$ was designed to describe one strategy evaluated once. When a researcher or an automated search evaluates $N$ candidates on the same data and picks the best, the reported Sharpe ratio is biased upward. Statisticians call this the multiple comparisons problem; in practice it is often called data dredging or $p$-hacking.
It usually happens without bad intent. Someone tries a few hundred lookback lengths, thresholds or model settings, discards the ones that lose money, and reports the survivor. The trouble is that the best of $N$ strategies with no skill at all still has a positive expected Sharpe ratio, and that expectation grows roughly with $\sqrt{2 \ln N}$.
1.1 The Expected Maximum Sharpe Ratio
Let $\{X_1, X_2, \dots, X_N\}$ be $N$ independent standard normal variables, $X_n \sim \mathcal{N}(0, 1)$, standing in for the Sharpe ratio estimates of strategies with no true edge. Their maximum $M_N = \max_{n=1,\dots,N} X_n$ converges to a Gumbel distribution. Bailey and López de Prado (2014) give this approximation for the expected maximum Sharpe ratio under the null of zero skill:
Here $\gamma \approx 0.5772156649$ is the Euler-Mascheroni constant, $\Phi^{-1}$ is the inverse standard normal CDF, and $e$ is Euler's number. The hurdle $\text{SR}^*$ scales with the spread of Sharpe estimates across trials, $\mathbb{V}[\{\widehat{\text{SR}}_n\}]$. The table shows the hurdle when that variance is one, so the values are in units of the cross-trial standard deviation. The last column is the per-trial $p$-value needed to keep the overall false-positive rate at 5%.
| Number of Trials ($N$) | Expected Max Sharpe ($\text{SR}^*$), unit variance | Implied $p$-Value Threshold |
|---|---|---|
| 1 | 0.00 | $p < 0.0500$ ($t > 1.96$) |
| 10 | 1.54 | $p < 0.0051$ ($t > 2.80$) |
| 100 | 2.51 | $p < 0.0005$ ($t > 3.48$) |
| 1,000 | 3.24 | $p < 0.00005$ ($t > 4.06$) |
| 10,000 | 3.85 | $p < 0.000005$ ($t > 4.59$) |
| 100,000 | 4.38 | $p < 0.0000005$ ($t > 5.06$) |
The practical point is simple. An automated search over $100,000$ configurations should be expected to produce a best result more than four standard deviations above zero from noise alone. How that translates into an annualized Sharpe ratio depends on the length of the backtest and how correlated the trials are, but a headline Sharpe ratio means little unless $N$ is disclosed alongside it.
The values in Table 1 are the exact expected maxima of $N$ standard normal draws; the closed-form approximation in equation (1) gives slightly higher numbers.
1.2 The Deflated Sharpe Ratio
The Deflated Sharpe Ratio (DSR), also from Bailey and López de Prado, turns this into a test. It estimates the probability that the true Sharpe ratio is above the hurdle $\text{SR}^*$, given the sample length $T$, the number of trials $N$, the variance across trials $\mathbb{V}[\{\widehat{\text{SR}}_n\}]$, and the skewness $\hat{\gamma}_3$ and kurtosis $\hat{\gamma}_4$ of returns. The Sharpe ratios in this formula are per period, not annualized, and $\hat{\gamma}_4$ is plain kurtosis (3 for a normal distribution), not excess kurtosis:
We require $\text{DSR} \ge 0.95$. A candidate that falls short is dropped. This is the third of the twelve research gates we describe elsewhere on this site.
2. Three Placebo Tests
The DSR is necessary but not enough. It is a parametric test, and it cannot tell you why a strategy made money. So we also run three placebo tests. Each one removes something the strategy is supposed to depend on and checks that the performance goes away.
Test I: Phase-Scrambled Surrogate Data
A curve-fitted strategy often depends on coincidences in one particular price history. To test for that we need data that looks statistically like the market but has a different sequence of events. A simple bootstrap, drawing returns with replacement, is not ideal because it destroys the autocorrelation in the series.
Instead we generate Fourier phase-scrambled surrogates, following Theiler et al. (1992). These keep the power spectrum of the original series, and therefore its linear autocorrelation, while randomizing everything else about its timing. They do not preserve nonlinear structure such as volatility clustering, which is worth remembering when reading the results.
-
Discrete Fourier Transform: Take the log-return series $\mathbf{x}(t) = \{x_0, x_1, \dots, x_{T-1}\}$ into the frequency domain:
where $A(k) = |X(k)|$ is the amplitude spectrum and $\phi(k) = \arg(X(k))$ is the phase spectrum.$$ X(k) = \sum_{t=0}^{T-1} x(t) e^{-i \frac{2\pi}{T} k t} = A(k) e^{i \phi(k)}, \quad k = 0, \dots, T-1 $$(3)
- Keep the amplitudes: By the Wiener-Khinchin theorem, the autocorrelation function $\rho(\tau)$ is the inverse Fourier transform of the power spectral density $S(f) = |A(f)|^2$. Any transformation that leaves $A(k)$ alone leaves the linear autocorrelation alone.
-
Randomize the phases: Draw a new phase vector $\phi^*(k)$ uniformly on $[-\pi, \pi]$:
So that the inverse transform $\mathbf{x}^*(t)$ is real-valued, the phases must be anti-symmetric:$$ \phi^*(k) \sim \mathcal{U}[-\pi, \pi], \quad k = 1, \dots, \frac{T}{2} - 1 $$(4)$$ \phi^*(T - k) = -\phi^*(k), \quad \phi^*(0) = 0, \quad \phi^*(T/2) = 0 $$(5)
-
Inverse transform: Build the surrogate series:
$$ x^*(t) = \frac{1}{T} \sum_{k=0}^{T-1} A(k) e^{i \phi^*(k)} e^{i \frac{2\pi}{T} k t} $$(6)
How we use it: We generate $M = 1,000$ surrogate series and run the candidate strategy on each. A strategy whose edge depends on the actual sequence of market events should lose that edge on the surrogates. Our rule is that if the strategy earns an annualized Sharpe ratio $\widehat{\text{SR}}_{\text{surrogate}} > 0.20$ on more than 1.0% of surrogate paths ($p_{\text{surr}} > 0.01$), we reject it. A strategy that still performs on scrambled data is being paid for something the scrambling left in place, such as drift or plain autocorrelation, or it is fitted to noise. These thresholds are our own choices, not standard values.
Test II: Factor Ablation and Beta Orthogonalization
Models with many inputs, such as gradient-boosted trees or neural networks, can hide a lot of redundancy. A model may use 40 features when most of them are restatements of one another, and the whole thing may be a disguised bet on a common market factor such as equity momentum or duration.
We check this in two steps:
-
Remove market betas: Before evaluating factor $f_k$, we regress it on five broad market series, $\mathbf{B} = [\text{SPY}, \text{TLT}, \text{DXY}, \text{VIX}, \text{BCOM}]$:
Only the residual $\epsilon_k(t)$ goes into the signal. That is the part of the factor not explained by broad market moves.$$ f_k(t) = \alpha_k + \boldsymbol{\beta}_k^\top \mathbf{B}(t) + \epsilon_k(t) $$(7)
-
Ablate each feature: For a model using factors $\mathcal{F} = \{f_1, f_2, \dots, f_K\}$, we replace each feature $f_k$ in turn with uniform noise $\mathcal{U}[-1, 1]$ and measure the drop in performance:
If $\Delta \text{Sharpe}_k \le 0.15$, or if the drop in Mean Directional Accuracy (MDA) is statistically indistinguishable from zero ($z < 2.58$), we remove factor $f_k$. Features that do not earn their place only add ways for the model to overfit.$$ \Delta \text{Sharpe}_k = \text{Sharpe}(\mathcal{F}) - \text{Sharpe}(\mathcal{F} \setminus \{f_k\}) $$(8)
Test III: Lead-Lag Inversion
A cause comes before its effect. If a feature $f(t)$ really helps predict the return $r(t + \Delta t)$, the cross-correlation $\rho(\tau) = \text{Corr}(f(t), r(t + \tau))$ should be lopsided around $\tau = 0$: informative about the future, not about the past. This only works as a warning sign for signals that have no reason to depend on past returns. A momentum signal is built from past returns and will correlate with them, and a leak that only looks forward will not show up here at all.
Backtests pick up future information in ways that are easy to miss:
- Two-sided filters: Centered moving averages, Hodrick-Prescott filters, or Savitzky-Golay filters, where the value at $t$ uses $t+1, \dots, t+k$.
- Corporate-action adjustments: Adjusted price series that let a signal see a split or dividend before it was announced.
- Revised data: Using revised macroeconomic figures (GDP, payrolls, CPI) or restated company accounts instead of the values that were actually published at the time.
The test: We run the same model against past returns instead of future ones:
If the model appears to predict past returns ($t - k$) with any strength (we use $t_{\text{rev}} > 1.50$ as the cutoff), we treat that as evidence of a lookahead leak and reject the factor until the leak is found. Some signals, such as momentum, are built from past returns and need this test adapted with care.
3. Combinatorial Purged Cross-Validation
Standard $k$-fold cross-validation assumes observations are independent and identically distributed. Financial time series are not. Returns are autocorrelated, the distribution shifts over time, and labels that span several days overlap with one another.
Applied naively, $k$-fold lets the model train on data from just after the period it is tested on, and information leaks. We use Combinatorial Purged Cross-Validation (CPCV), introduced by Marcos López de Prado, to deal with this.
3.1 Combinatorial Splits
Split the history into $N$ contiguous blocks and hold out $k$ of them for testing. CPCV uses every one of the $\binom{N}{k}$ ways of choosing the test blocks. With $N = 6$ and $k = 2$:
That is 15 train/test splits, and the test blocks from those splits can be recombined into several complete out-of-sample paths (five, in this configuration). The benefit is that you get a distribution of Sharpe ratios and drawdowns to look at, not one history that may have been lucky.
3.2 Purging and Embargoing
Two adjustments keep information from leaking between training and test sets:
-
Purging: Suppose an observation at time $t_i$ has a label that depends on the window $[t_i, t_{i, \text{end}}]$. If the test set $S_{\text{test}}$ starts at $t_{\text{start}}$, any training observation whose label window overlaps the test interval is removed:
$$ S_{\text{train, purged}} = \{ i \in S_{\text{train}} \mid t_{i, \text{end}} < t_{\text{start}} \lor t_i > t_{\text{end}} \} $$(11)
-
Embargoing: Volatility has memory, so what happens at the end of a test block still affects the market for a while afterwards. We drop training observations that fall within a buffer of length $h$ after each test block:
We set $h$ to at least 10 trading days for daily strategies and 15,000 bars for intraday models. These are our settings; the right value depends on how long the labels and features look back.$$ S_{\text{train, final}} = S_{\text{train, purged}} \setminus \{ i \in S_{\text{train}} \mid t_{\text{end}} \le t_i \le t_{\text{end}} + h \} $$(12)
4. A Worked Example: A Post-Earnings Drift Factor
The example below is illustrative. The factor name and the numbers are there to show how the tests fit together and what a typical failure looks like. It is not a performance record of a strategy we traded.
Illustrative Example: Factor Alpha-882 (Earnings Drift + Order Flow)
- Asset Class: US Large-Cap Equities (S&P 500 Universe)
- Unadjusted Backtest Sharpe: 2.48 (daily rebalanced, no transaction costs)
- Backtest Annualized Return: 28.4% | Max Drawdown: -7.8%
- Trials: $N = 4,200$ parameter combinations tested.
Table 2: Test Results (Illustrative)
| Stage | Test | Result | Status |
|---|---|---|---|
| Multiple Testing | Deflated Sharpe Ratio (DSR) | DSR = 0.42 (Hurdle SR* = 2.62) | Fail |
| Test I | Phase Scrambling (1,000 paths) | Surrogate Sharpe = 1.15 (p = 0.38) | Fail |
| Test III | Lead-Lag Inversion | Inverted t-stat = +3.41 | Fail (lookahead) |
| Trading Costs | Square-Root Impact + 1.5bp Fee | Net Sharpe = -0.18 | Rejected |
What went wrong: In this example the lead-lag inversion is the giveaway. The earnings data feed had mapped later restatements back onto the original release date, so the backtest was seeing corrected numbers before the market did. The phase-scrambling result points the same way: the factor did nearly as well on scrambled data, which suggests it was mostly collecting the upward drift in equities over the sample period.
The pattern is a familiar one. A backtest with a Sharpe ratio near 2.5 looks convincing on its own, and each test takes away part of the story until nothing is left after costs.
5. Questions Worth Asking
If you are evaluating a systematic strategy, your own or someone else's, these are the questions we find most useful. They follow directly from the tests above.
- How many trials? How many configurations, parameter sets and feature sets were tried before this one was chosen? Without $N$, a Sharpe ratio is hard to interpret.
- What is the Deflated Sharpe Ratio? What does the result look like once the full trial count is taken into account?
- How does it do on surrogate data? Has the strategy been run on phase-scrambled or otherwise randomized series, and what did the distribution of results look like?
- How was it cross-validated? Were overlapping labels purged and an embargo applied, or was plain walk-forward or $k$-fold used?
- Is the data point-in-time? Are macro and company figures stored as first published, with revisions kept out of historical decisions?
- Does it predict the past? What happens when the signal is tested against earlier returns ($t - k$)?
- What does each feature contribute? How much does performance drop when each one is removed?
- How are costs modeled? Does the backtest include market impact, for example a square-root model ($\sigma \sqrt{V/ADV}$), or does it assume fills at the mid?
- Was any data held back? Is there a period the researchers did not look at while building the model, and how did the strategy do on it?
6. Conclusion
Finding a rule that fits the past is easy. Finding one that reflects something real about how markets work is much harder, and a backtest alone cannot tell the two apart.
Our approach is to try to break each candidate before putting money behind it. The Deflated Sharpe Ratio, the placebo tests and purged cross-validation do not guarantee that a strategy will work. They do remove a large share of the ones that would not have, and they do it cheaply.