Strategy Lab, run of 2026-10-29: 4,096 trading strategies on twenty years of the S&P 500
Firsthand data: our own backtest, run on 2026-10-29 by the Strategy Lab script (scripts/strategy-lab/lab.py in AutomationSolution). Every number below comes from that run. Nothing here is investment advice.
The question
If you try every combination of twelve well-known trading rules on the S&P 500, some will "beat the market" on past data. How many of those were skill, and how many were the luck of having tried 4,096 things?
What we did
- Data: SPY (the S&P 500 fund), daily adjusted closes (dividends included) from Yahoo Finance, fetched 2026-10-29.
- Twelve rules, each a yes/no filter read at the close; a strategy holds SPY the next day when all its switched-on rules say yes, otherwise it sits in cash earning nothing. All 4,096 on/off combinations; the one with no rule is buy and hold.
- Every switch in or out of the market costs 5 basis points (0.05%).
- In sample (where you would "discover" a strategy): 2006-01-13 to 2017-12-29. Out of sample (the future it then meets): 2018-01-02 to 2026-10-28.
- Score: the Sharpe ratio (average daily return divided by its day-to-day swings, scaled to a year), with no risk-free rate.
- The deflated Sharpe ratio (Bailey and López de Prado, 2014): the chance a strategy's true Sharpe is above zero once you account for having picked it from 4,096 tries. We call a strategy a survivor at 0.95 or more.
The twelve rules:
trend200: price above its 200-day averagegolden: 50-day average above the 200-daytrend20: price above its 20-day averagenot_overbought: 14-day RSI below 70dip: price below its 5-day average (buy the dip)near_high: within 2% of its 50-day highcalm: 20-day volatility below its one-year averageno_monday: skip Mondayswinter: only November to April (sell in May)momentum12m: up over the last 12 monthsup_yesterday: closed higher than the day beforeturn_of_month: last 3 or first 3 trading days of a month
Findings
- Buy and hold: Sharpe 0.52 in sample, 0.81 out of sample; growth 8.5% and 14.5% a year; worst drop -55.2% and -33.7%.
- 439 of the 4,095 rule combinations beat buy and hold's Sharpe in sample. 31 of those also beat it out of sample.
- The best strategy in sample was
golden+winter+momentum12m: Sharpe 0.89 in sample, in the market 36.8% of days, 28 switches. Out of sample its Sharpe was 0.18: rank 1,077 of 4,096. - The top tenth in sample (409 strategies) had a median out-of-sample rank of 1,183 of 4,096; 30 of them beat buy and hold out of sample.
- Rank correlation between in-sample and out-of-sample Sharpe across all strategies: 0.15 (1 = the past ranking predicts the future one perfectly, 0 = not at all).
- The luck bar: had none of the 4,096 strategies any skill, the best of them would still be expected to show an annual Sharpe of about 1.20, by chance alone. The best real one showed 0.89.
- Survivors of the deflated Sharpe test at 0.95: 0.
Survivors (best ten by deflated Sharpe):
| Rules | Sharpe in sample | Sharpe out of sample | Deflated Sharpe |
|---|---|---|---|
| none |
What each rule did on average (mean Sharpe of strategies with the rule on, minus with it off):
| Rule | Says | In sample | Out of sample |
|---|---|---|---|
| calm | 20-day volatility below its one-year average | +0.09 | +0.14 |
| trend20 | price above its 20-day average | -0.10 | +0.06 |
| momentum12m | up over the last 12 months | +0.00 | +0.00 |
| trend200 | price above its 200-day average | -0.02 | -0.02 |
| winter | only November to April (sell in May) | +0.16 | -0.03 |
| not_overbought | 14-day RSI below 70 | +0.04 | -0.03 |
| golden | 50-day average above the 200-day | -0.04 | -0.03 |
| near_high | within 2% of its 50-day high | -0.11 | -0.05 |
| dip | price below its 5-day average (buy the dip) | +0.31 | -0.08 |
| up_yesterday | closed higher than the day before | -0.09 | -0.13 |
| no_monday | skip Mondays | -0.16 | -0.19 |
| turn_of_month | last 3 or first 3 trading days of a month | +0.14 | -0.23 |
Best strategy out of sample, for comparison (found only by looking at the future): calm+winter+momentum12m, Sharpe 1.06;
in sample it had 0.86.
Worked example for the reader
A reader backtests 50 rule combinations and keeps the best. The deflated Sharpe asks how good the best of 50 coin flips would look. With the spread of results in this run, the bar for 4,096 tries was an annual Sharpe of about 1.20; fewer tries lower it, more raise it. The more you search, the more of your best result is luck.
Sources
- Bailey, D. H. and López de Prado, M. (2014), "The Deflated Sharpe Ratio: Correcting for Selection Bias, Backtest Overfitting and Non-Normality", Journal of Portfolio Management. https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2460551
- Harvey, C. R., Liu, Y. and Zhu, H. (2016), "... and the Cross-Section of Expected Returns", Review of Financial Studies. https://doi.org/10.1093/rfs/hhv059
- Bouman, S. and Jacobsen, B. (2002), "The Halloween Indicator, 'Sell in May and Go Away': Another Puzzle", American Economic Review. https://doi.org/10.1257/000282802762024683
- Moskowitz, T., Ooi, Y. H. and Pedersen, L. H. (2012), "Time Series Momentum", Journal of Financial Economics. https://doi.org/10.1016/j.jfineco.2011.11.003
- Data: Yahoo Finance, SPY daily adjusted close. https://finance.yahoo.com/quote/SPY/history/
What this cannot tell you
- Cash earns nothing here. In years when cash paid 4-5% (2006-07, 2023-25) rules that sit out are understated.
- One market, one split date. Another split or another market could rank the rules differently.
- The 4,096 strategies are not independent (many share rules), so the deflated Sharpe's count of tries is an upper bound and the test is strict.
- Costs are a flat 5 basis points per switch; taxes and slippage on big orders are not modelled.
- A rule that failed here can still work elsewhere, and past survival does not promise future returns.