Detecting Overfitting in Momentum Strategies
Research overview
Cross-sectional momentum is among the most carefully studied return patterns in equity markets. The economic idea is simple: stocks that outperformed their peers over the recent past tend, on average, to keep outperforming for a short subsequent window. That pattern survives many markets and decades, but the implementation details do not travel for free. Lookback length, holding horizon, and how tightly the book concentrates into winners all change turnover, crash exposure, and net Sharpe—and all of them are usually chosen by searching historical data.
Parameter search is where quiet overfitting enters. If a researcher evaluates a set of candidate rules on one historical path and reports only
then the reported Sharpe is contaminated by selection luck. Under a null of no edge, the expected maximum of estimated Sharpes grows with . Classical remedies—holdout samples, deflated performance metrics, combinatorial cross-validation, and stress probes—exist, yet they are often applied piecemeal rather than as a single filter.
This project constructs that filter for a concrete strategy. We study a long-only winners momentum book on point-in-time S&P 500 constituents. Each month we rank stocks by past J-month return, buy the top N names with equal weights, and hold the sleeve for K months. When we form overlapping books and average their returns, following the classical Jegadeesh–Titman overlapping-portfolio construction. Net returns subtract commission on turnover plus a square-root market-impact term.
Performance is scored with the Deflated Sharpe Ratio (DSR), which adjusts ordinary Sharpe for the number of trials and for return non-normality. Around that objective we stack three diagnostic layers: (1) train–test disparity, sensitivity, and block-bootstrap screens; (2) combinatorial CSCV/PBO plus walk-forward and windowed cross-validation; (3) stylised stress operators that reverse trends, inflate volatility, impose crash haircuts, and flip regimes.
The exhibits below accompany the prose. The first chart shows how many grid points survive each gate; later sections unpack every stage. The final selection maximises a weighted combination of DSR and absolute maximum drawdown among survivors. That selection is a research diagnostic—evidence that a parameter region looked relatively robust historically—not a claim that the same sleeve will profit live.
Pipeline summary
- Study window 2000-02-29 - 2026-07-31 (318 months, 658 names).
- Parameter grid |J|×|K|×|N| = 3×3×2 = 18 trials; objective = Deflated Sharpe.
- Train-length vs overfitting gap: Pearson ρ=-0.5761 (p=0.0); recommended pi=0.8.
- Stage 1 robustness retained 3 / 18 parameter sets (disparity p>0.05 ∩ non-sensitive ∩ non-outlier).
- CSCV probability of backtest overfitting (PBO) ≈ 0.07142857142857142; mean logit=0.7954123270990925 across 70 combinations.
- Cross-validation top-quartile threshold (mean CV DSR) = 0.351873.
- Selected theta* = (3,6,1) with DSR=0.188573, MaxDD=-0.641047, objective=-0.131951.
- theta* minimizes historical overfitting evidence under this multi-stage filter; it does not guarantee live performance.
- Best average stressed DSR: (6,6,2) - 0.10345 (reversal / vol / crash / regime suite).
How many parameter sets survive each gate
Universe, signal, costs, and objective
Universe. Let denote the investable set of S&P 500 constituents eligible at month-end under a point-in-time membership mask (so additions and deletions enter when they would have been known). Liquid names satisfying a minimum-price filter contribute monthly simple returns
with extreme observations winsorised cross-sectionally. The working sample is monthly from the early 2000s through the end of the available history.
Momentum signal. For lookback , formation-month momentum of name is the cumulative compound return over the prior months,
The long-only book holds the equal-weighted top names,
Those weights are held for months. With monthly reformation, month- portfolio return averages the active overlapping sleeves formed at :
Frictions. Let denote one-way turnover between successive formations. Commission at rate (here bps) and square-root impact yield a cost
where is trailing annualised volatility, is an assumed participation rate in average daily volume, and is a market-impact coefficient. Net returns are (with costs amortised across the holding horizon).
Sharpe and Deflated Sharpe. With monthly net returns and risk-free rate ,
Selecting the maximum of such Sharpes overstates edge. Bailey and López de Prado (2014) define a Deflated Sharpe that tests whether observed performance exceeds the expected maximum under a no-edge null, after correcting for skewness and kurtosis . Writing for that null benchmark,
where is the standard normal cdf. We treat as the primary ranking statistic throughout the pipeline.
Search grid. The discrete space is , , —eighteen combinations. The chart below ranks every grid point by full-sample DSR before robustness filters.
Loading study exhibits… Run npm run data:momentum-overfitting-framework if the dataset is missing.
Training-period length and overfitting gaps
Before filtering individual triples we ask how the length of the training sample shapes optimism. Split the monthly history at fraction so that the first observations train and the remainder test. Define the mean-return gap
We evaluate . Across all pairs compute sample mean and standard deviation , and define the overfit flag set
A Pearson correlation with associated -value summarises whether longer training fractions systematically widen optimism.
Large positive means the strategy looked stronger where history was fitted and weaker where it was held out—the textbook fingerprint of overfit calibration. Later stages therefore lock the default split at ****.
Read the exhibits in order: mean gaps versus ; the full scatter with threshold flags; then per-parameter bars at a chosen .
Loading study exhibits… Run npm run data:momentum-overfitting-framework if the dataset is missing.
Parameter-space size
Even with a fixed strategy family, the number of alternatives searched changes the meaning of “best.” Write . Under a null of zero edge, the expected maximum of estimated Sharpes rises with —the data-snooping effect emphasised by Sullivan, Timmermann, and White (1999) and Harvey and Liu (2015).
We sample random subsets of size , compute the average train–test gap over many draws, and fit
A positive slope would indicate that expanding the searchable space mechanically increases apparent optimism; a flat or negative slope in a particular sample still motivates using DSR’s explicit -trial penalty.
The chart below shows mean gaps versus subset size with a fitted trend.
Loading study exhibits… Run npm run data:momentum-overfitting-framework if the dataset is missing.
Stage 1 — Train–test disparity
Stage 1 asks whether training and testing performance are consistent enough to survive a formal test. For each collect paired mean returns across several split ratios and apply a **paired -test** of the differences
Rejecting at the 5% level () flags systematic disparity; those triples are removed. Parameter sets with continue. The gate does not prove that a strategy is good—it only discards combinations whose historical optimism is statistically hard to ignore.
The sorted -value chart below colours passes in green and failures in red. Hover a bar for the mean disparity and -statistic.
Loading study exhibits… Run npm run data:momentum-overfitting-framework if the dataset is missing.
Stage 1 — Sensitivity analysis
A second Stage 1 concern is brittleness. If a tiny move in , , or collapses DSR, the reported optimum sits on a knife-edge. With discrete neighbours we approximate elasticities by finite differences. For a performance metric (here DSR),
and likewise for and . Axis thresholds are
Any with on any axis is marked sensitive and fails Stage 1. The stacked bars below sum absolute elasticities so brittle corners stand out visually; hover for baseline DSR.
Loading study exhibits… Run npm run data:momentum-overfitting-framework if the dataset is missing.
Stage 1 — Block bootstrap
Ordinary bootstrap treats months as i.i.d., which returns violate through volatility clustering. We use overlapping block resampling of length months. Let be the DSR of each grid member and their mean. Residuals are resampled in blocks to form a bootstrap distribution of the mean residual and a confidence interval .
Parameter sets with are treated as outliers relative to the rest of the search and removed from the Stage 1 intersection
The residual bars below highlight those outliers in red.
Loading study exhibits… Run npm run data:momentum-overfitting-framework if the dataset is missing.
Combinatorial cross-validation and PBO
Stage 2 begins with Combinatorially Symmetric Cross-Validation (CSCV) (Bailey, Borwein, López de Prado, and Zhu, 2015). Form the performance matrix whose columns are monthly returns of each grid trial. Partition the rows into an even number of contiguous blocks and, for every combinatorial assignment of half the blocks to the in-sample set and the complement to the out-of-sample set , select
Record the relative out-of-sample rank of that same trial among all columns on , and map it to a logit
where is the OOS relative rank (higher is better). Large positive logits mean the IS winner remained competitive OOS; negative logits mean the champion faded—the signature of backtest overfitting.
Averaging the failure indicator across the combinatorial folds yields the probability of backtest overfitting,
We also label individual trials by their average OOS relative rank when selected. Trials below the median appear in red on the – scatter (bubble size scales with ). The logit histogram summarises how often IS/OOS consistency held in this sample.
Loading study exhibits… Run npm run data:momentum-overfitting-framework if the dataset is missing.
Walk-forward and windowed validation
CSCV is powerful but abstract. We therefore add classical time-series protocols. Write for Deflated Sharpe of trial on a held-out window .
Walk-forward. Roll an in-sample window, choose on that window, and score the next block. Expanding-window grows the training history while testing successive slices. Rolling-window recomputes DSR inside a fixed-length sliding window and averages those scores. A light nested scheme separates hyperparameter choice from final evaluation folds.
For each parameter set define the protocol average
and retain only the top quartile of that distribution. CSCV survivors that miss the quartile are dropped before stress testing.
Use the toggle on the chart to compare walk-forward, expanding, and rolling DSR side by side, or collapse to mean CV DSR with top-quartile bars highlighted.
Loading study exhibits… Run npm run data:momentum-overfitting-framework if the dataset is missing.
Stress testing
Parameters that look stable in calm holds can still fail when the return process is distorted. Stage 3 applies four stylised stress operators to each surviving monthly path and recomputes Deflated Sharpe under each transform.
Return reversal: —the natural adversary of trend persistence. Volatility shocks: with and log-normal shocks, raising turbulence without a directional bias. Market crashes: apply a haircut factor to a random subset of months. Regime shifts: invert returns over contiguous windows to mimic abrupt leadership changes.
For each report and the average
Combinations with average stressed DSR above the cross-grid median pass. The bar chart and table are sortable by any scenario so you can see which sleeves survive reversal versus which only survive calm volatility.
Loading study exhibits… Run npm run data:momentum-overfitting-framework if the dataset is missing.
Parameter selection
After robustness, CSCV, top-quartile cross-validation, and stress filtering, a candidate set remains. We choose a single with a transparent objective that rewards risk-adjusted level and penalises path damage:
with default weights and . Maximum drawdown is
where is cumulative net wealth. If a later stage returns an empty intersection, the funnel falls back to the previous non-empty survivor set so the page always reports a readable diagnostic.
The retention funnel shows how many of the eighteen grid points remain after each gate. Objective bars and the finalist table list surviving with DSR, Sharpe, MaxDD, and the objective score—click a row to switch the wealth path. Treat as the region with the least historical evidence of overfitting under this pipeline, not as a production mandate.
For parallel vocabulary (White’s Reality Check, Hansen SPA, purged CV, Monte Carlo gates) see the site article on statistical analysis of trading strategies.
Loading study exhibits… Run npm run data:momentum-overfitting-framework if the dataset is missing.
Limitations and how to read the results
Several caveats bound what these diagnostics can say. The point-in-time membership mask is constructed from public index-change histories and remains an approximation to institutional reconstitution calendars. Corporate-action handling in public adjusted prices can differ from research-grade total-return panels. The eighteen-cell grid is deliberately small; expanding it would raise both compute and the DSR trial penalty . Stress operators are parametric caricatures of crises, not historical replay of 2008 or 2020 path-by-path.
Most importantly, the framework assumes the strategy form is already well specified. It filters parameters of a fixed rule. It cannot repair a misspecified signal, missing risk factors, or capacity constraints that only appear at larger notionals. Passing Stages 1–3 is necessary hygiene for parameter choice, not sufficient evidence of an allocatable edge.
References
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), 94–107.
Bailey, D. H., Borwein, J. M., López de Prado, M., & Zhu, Q. J. (2015). The probability of backtest overfitting. *Journal of Computational Finance*, 20(4), 39–69.
Harvey, C. R., & Liu, Y. (2015). Backtesting. *Journal of Portfolio Management*, 42(1), 13–28.
Jegadeesh, N., & Titman, S. (1993). Returns to buying winners and selling losers: Implications for stock market efficiency. *Journal of Finance*, 48(1), 65–91.
Sullivan, R., Timmermann, A., & White, H. (1999). Data-snooping, technical trading rule performance, and the bootstrap. *Journal of Finance*, 54(5), 1647–1691.
Almgren, R., Thum, C., Hauptmann, E., & Li, H. (2005). Direct estimation of equity market impact. *Risk*, 18(7), 58–62.