Setup
The Fundamental Problem
A backtest is a simulation of a trading strategy applied to historical data to estimate future performance. The core challenge is that the future is not the past — and research processes that iterate over historical data until a "good" strategy is found will produce results that are statistically meaningful in-sample but economically meaningless out-of-sample.
Backtesting is the most abused tool in quantitative finance. Bailey et al. (2014) estimate that the majority of published financial research results are false discoveries, driven by data mining over a finite sample. The antidote is rigorous statistical testing with explicit multiple hypothesis adjustment.
Conventions throughout. Returns are continuously compounded unless stated. Daily returns assumed 252 trading days per year. Sharpe ratio computed as annualised mean excess return divided by annualised return standard deviation. All statistics are defined for excess returns (above cash).
Theory
1. The Sharpe Ratio: Distribution and Inference
The Sharpe ratio of a strategy with daily excess returns is:
Annualised: multiply by (daily frequency).
Asymptotic distribution. Under returns with finite kurtosis (Lo 2002):
where is the excess kurtosis of returns. For (Gaussian returns):
A t-statistic for testing against :
which follows an approximately standard normal distribution under .
Minimum track record. Solving for such that the one-sided test at level rejects :
For (annualised) in daily data, : this gives years of daily data to establish statistical significance at 5%.
2. Multiple Hypothesis Testing: The False Discovery Problem
Suppose a researcher tests independent strategies, each with , at significance level . Expected false discoveries under all-null hypotheses:
For : expect 5 false discoveries even if every strategy has zero alpha. If only the best Sharpe is reported, selection bias inflates it systematically.
Bonferroni correction. Test each hypothesis at level . Controls the familywise error rate (FWER) — probability of any false discovery. Overly conservative when is large.
Benjamini-Hochberg (BH) procedure. Controls the false discovery rate (FDR) — expected proportion of discoveries that are false:
- Order p-values: .
- Find the largest such that .
- Reject all .
BH controls FDR under independence (and under positive dependence, PRDS condition). For correlated strategies, the Benjamini-Yekutieli (BY) procedure controls FDR under arbitrary dependence at the cost of a factor in the threshold.
3. The Deflated Sharpe Ratio
Bailey and López de Prado (2014) propose the Deflated Sharpe Ratio (DSR) to adjust for the selection bias introduced by testing multiple strategies:
where:
- is the observed maximum Sharpe across tried strategies,
- is the expected maximum of iid standard normals (approximation),
- is average pairwise correlation of the strategy returns,
- is excess kurtosis of the selected strategy's returns,
- is the Euler-Mascheroni constant.
DSR means the observed Sharpe, after deflating for search over strategies, remains statistically significant.
Minimum Backtest Length. The expected maximum Sharpe ratio over trials grows as . A backtest of length with strategies tried produces a statistically robust conclusion only if:
For , : minimum daily observations ( years).
4. Walk-Forward Backtest Design
A properly structured backtest:
- Split data before touching it. Designate an out-of-sample (OOS) holdout of at least 20–30% of history. The model is never fitted on this period.
- Training/validation split. Use purged walk-forward CV (see ML Signal Generation module) on the in-sample period to select hyperparameters.
- Single test on holdout. Run the finalised strategy once on the OOS period and report those results.
- Report honestly. Report: number of strategies tried, number discarded, all parameter combinations explored. Failure to disclose is p-hacking.