MarketsSep 2025–nowProject
Equity strategy backtester
Excel / VBA, then Python
- Sharpe · 15 markets
- 0.76
- Markets positive
- 12/15
- Correlation with S&P
- 0.06
- Rules tested, then frozen
- 228
Context
I built a backtester in Excel to test simple trading rules on real data. My first rule, a 20/200-day moving-average crossover, looked good but only traded three times in five years, which proves nothing. So I went looking for a rule that holds up on data it has never seen.
What I did
- 01Built the backtester in Excel and VBA: signals at the close, fills at the next open, costs and a full trade log.
- 02Tested 228 rule variants on the S&P 500 from 1991 to 2009 only, then froze one rule before looking at anything newer.
- 03Ran the frozen rule on 2010–2026 and on 14 other markets, and checked it against the same trades placed on random days.
- 04Found that buying short dips really works, but only in big equity indices, and less than it used to.
- 05Tested 12-month trend-following, taken straight from the published research, across all 15 markets. It was the one edge that held up.
Outcome
12-month momentum held up everywhere: a Sharpe of 0.76 across 15 markets since 1995, almost uncorrelated with stocks. It's a real edge, but a small one, and weaker since 2011.
Limitations
- It's a small edge. Without Bitcoin, the Sharpe since 2011 is 0.31, which matches how trend-following funds actually did in the 2010s.
- It doesn't beat simply holding the S&P on raw return. Its case is that it makes money when stocks fall.
- The data is free daily closes from Yahoo Finance. Index prices leave out dividends, and the commodity futures have roll jumps.
- Shorting assumes futures or CFDs with no financing cost, and the 10% volatility target can mean up to 3× leverage in calm markets.
- The original Excel rule traded three times in five years, so its numbers (in the last chart) say nothing about whether it works.
Charts
Full size (opens in a new tab)
Full size (opens in a new tab)
Full size (opens in a new tab)
Full size (opens in a new tab)Tools
- Excel
- VBA
- Python
- pandas