Skip to content
Rishikesh Mistry
Rishikesh Mistry

London Local time in London: --:--

Open to conversations about trading and startups

rishikesh.mistry@outlook.com

MarketsSep 2025–Oct 2025Project

Equity strategy backtester

Excel / VBA

Return over 5 years
+70.5%
Sharpe · vs 0.48
0.70
Max drawdown · vs −25%
−10%
Settings tested
105

Context

I wanted to test simple trading rules on real data before trusting them, so I built a backtester.

What I did

  1. 01Automated signal generation and P/L tracking for SMA and RSI strategies over five years of S&P data.
  2. 02Optimised the parameters to improve the Sharpe ratio.
  3. 03Tested risk-management tools on top of each strategy.

Outcome

In-sample, a 20/200-day crossover matched buy-and-hold over five years (+70.5% against +70.4%) with less than half the drawdown, lifting the Sharpe ratio from 0.48 to 0.70.

Limitations

  • Three trades. At 20/200 the strategy traded three times in five years, far too few to show the rule works; the 100% win rate means nothing.
  • No out-of-sample test. The settings were searched on the same five years they're judged on, so the best one (20/225) is fitted to this history.
  • One instrument, one regime: SPY only, over a window that was mostly a bull market with one drawdown (2022).
  • Prices exclude dividends and cash earns nothing while out of the market, which understates both sides, buy-and-hold most.
  • Costs are $1 a trade with fills at the next open: no spread, slippage or tax.

Charts

Strategy equity against buy-and-hold SPY from 2021 to 2026: both end near +70%, but the strategy's worst drawdown is 10% against 25% for the index.Full size (opens in a new tab)
Results against simply holding SPY, with drawdowns underneath.
SPY price with its 20-day and 200-day moving averages, buy and sell markers at each crossover, and shading where the strategy is invested.Full size (opens in a new tab)
Every signal: buy when the fast average crosses above the slow one, sell when it crosses back.
Heat map of Sharpe ratios for 105 pairs of fast and slow averages. The best, 20/225, scores 0.76; the default 20/200 scores 0.70; buy-and-hold scores 0.48.Full size (opens in a new tab)
The parameter search. The best cell is fitted to this history, so expect less from it on new data.

Tools

  • Excel
  • VBA
Next · MarketsExxonMobilCommodities trading placement, landed with one cold email