RealTest Strategies / SPY ETF Mean Reversion Strategy

SPY ETF Mean Reversion Strategy

A RealTest mean-reversion strategy that trades a single instrument, the SPY ETF. It buys the broad market when it pulls back and sells into the recovery, so there is no stock picking and no single-company risk. The code comes in RealTest and TradingView Pine Script. Tested on data back to 2000 with costs modeled, and trading live since November 2024.

Beating SPY
$100k grows to $761k. SPY only $585k
Steady Growth
Last 4 years profitable streak.
Low Drawdown Period
Strategy remained below 10% drawdown for the last 90.5 months.
Live Market Performing
Performs in live market conditions since 2024-11-11
Premium

Portfolio Growth

+36%

660.9%

SPY 485.4%

Sharpe Ratio

+46%

0.7

SPY 0.48

Max Drawdown

+44%

-27.8%

SPY -49.9%

SPY ETF Mean Reversion Strategy equity curve vs SPY benchmark $100k$300k '02'04'06'08'10'12'14'16'18'20'22'24'26
Strategy SPY ETF

Strategy Overview

Why it works on the index

The whole market swings on short-term fear and relief just as individual stocks do. When SPY drops sharply over a few days, a lot of that selling is emotional rather than a change in the long-term trend, and the index tends to recover once the pressure eases. The strategy buys those pullbacks and sells into the bounce, working the same overreaction that mean reversion uses on single stocks, but on the broad market where the trend is steadier.

How it was tested

Trading one instrument removes a lot of the ways a backtest can mislead. There is no survivorship bias to correct for and no thin-stock fills to worry about, because SPY is the most liquid instrument in the market. Commissions on US ETFs are effectively zero and slippage is tiny, and both are still included in the results. The rule is simple, uses few parameters, and was checked with walk-forward analysis and Monte Carlo simulation, shown on this page.

How it fits your trading

This is one of the simplest strategies to run. It trades a single, liquid instrument, so it scales from a small account to a large one without changing anything, and the near-zero costs mean very little is lost to friction. Because it comes in both RealTest and TradingView Pine Script, you can run it on either platform. It works well as a steady base position next to strategies that trade individual stocks.

What You Get

RealTest by MHP Trading logo
RealTest Strategy Code (.rts)
Complete RealTest (.rts) strategy code. Import, backtest, and modify.
Trading strategy rules plain text document
Plain Text Rules
Full strategy logic in plain text. Clear rules for implementation on any trading platform.
TradingView Pine Script logo
TradingView Pine Script
Full Pine Script code. Implements the exact same strategy rules for your charts.

Advanced Backtest Insights

Stress Test Analysis

Crisis PeriodDatesPortfolioSPY
Dotcom Crash 2000-03-10 → 2002-10-09 -3.1% -41.8%
2008 Financial Crisis 2007-10-09 → 2009-03-09 -15.0% -49.9%
COVID-19 Crash 2020-02-19 → 2020-03-23 -4.1% -28.7%
2022 Bear Market 2022-01-03 → 2022-10-12 -2.9% -21.3%
2025 Tariffs Crash 2025-02-19 → 2025-04-08 -4.9% -16.3%

Monthly Returns

YearJanFebMarAprMayJunJulAugSepOctNovDecTotalMaxDD
20001.2-0.20.5-1.63.4-0.1-3.40.8-4.3-1.4-0.11.7-3.6%-13.1%
20010.0-4.23.20.01.42.31.1-1.7-10.00.52.82.5-2.9%-16.2%
2002-1.63.7-0.7-4.33.3-3.28.80.6-1.46.70.5-1.510.4%-7.1%
2003-2.4-1.81.96.40.5-2.81.9-0.7-2.64.02.50.06.6%-9.8%
2004-0.10.9-0.21.71.50.0-0.01.6-0.91.70.61.08.1%-2.8%
2005-0.90.8-1.6-0.00.00.21.02.1-0.3-0.80.01.41.8%-3.7%
20063.31.02.12.1-0.6-0.41.60.01.21.52.91.316.9%-4.2%
20070.90.40.30.04.11.0-4.44.90.0-0.74.21.012.0%-5.9%
2008-5.80.02.74.34.8-2.82.41.65.3-9.9-4.80.6-2.9%-26.0%
20092.7-11.5-1.38.63.1-1.02.03.31.8-4.63.03.48.5%-18.7%
2010-2.42.30.0-0.2-0.3-5.03.60.80.00.0-0.80.0-2.3%-8.0%
20110.52.40.31.32.4-1.42.5-7.63.91.61.41.99.0%-13.1%
20120.00.01.80.8-2.82.20.31.40.61.71.62.610.6%-5.3%
20131.90.32.20.90.02.70.3-0.50.20.53.32.515.2%-3.1%
2014-2.00.12.60.31.92.02.40.70.8-1.10.00.88.8%-6.1%
20152.10.02.10.01.0-1.4-0.45.84.32.30.51.118.7%-4.1%
2016-5.21.60.01.62.60.50.0-0.03.30.00.10.34.5%-7.7%
20171.50.6-1.10.90.0-0.30.90.60.00.00.00.03.0%-1.9%
2018-0.3-6.30.70.82.2-0.10.91.80.1-2.9-0.9-3.2-7.3%-12.9%
20190.00.01.30.0-1.53.01.92.0-0.3-1.10.01.87.3%-3.7%
2020-0.4-4.69.22.59.31.63.40.4-0.4-4.34.40.021.9%-8.1%
2021-1.76.51.71.52.22.23.00.0-1.31.70.84.022.3%-3.3%
2022-2.8-1.22.40.32.5-3.05.5-5.2-1.00.01.11.5-0.4%-8.1%
20234.8-2.43.20.94.51.70.4-1.10.1-0.30.20.613.1%-3.6%
20242.40.01.8-1.6-0.12.0-0.33.70.90.25.1-0.714.2%-4.7%
20253.20.2-5.012.00.62.70.03.11.01.22.80.924.1%-8.4%
20260.00.9-2.60.50.03.1-0.21.7%-6.2%
Avg-0.0-0.41.01.51.70.21.30.70.0-0.11.21.08.1%-8.0%
MetricPortfolioSPY
Sortino Ratio0.410.45
MAR Ratio0.29-
Net Profit$661k$485k
Expectancy0.65-
Trades3261
Win Rate71.78%-
Max Exposure104.95%100.0%
Best Year24.1%27.0%
Worst Year-7.3%-33.2%

Statistical Edge Verification

Science, governed by mathematics

Live Market Performance
Performs in real market conditions since 2024-11-11
Verified
Statistical Validation
Validated across In-Sample & Out-of-Sample data
Passed
Walk Forward Analysis
Tests robustness across unseen data
Passed
Monte Carlo Stress Test
Resilient against 1,000+ sequence risk simulations
Passed
RealTest trading software logo

Quick start guide

From download to first backtest in 1 minutes

1
You download the .rts file
Click Download
2
You open it in RealTest
File → Open → Select file
3
You import symbols
Click Import
4
You run the backtest
Click Test
OrderClerk automated trading execution interface

Daily Live Trading

For RealTest automated execution

1
Open OrderClerk
Click 'Connect to IB'
2
Import signals
Click 'Import' in RealTest
3
Generate orders
Click 'Orders' in RealTest
4
Execute trades
Click 'Place Orders'

Total daily time: ~5 minutes

Get OrderClerk automation course →

Strategy Details

Style
Mean Reversion
Universe
SPY ETF
Timeframe
Daily
Side
Long
Entry execution
Market On Open
Exit execution
Market On Open

Model assumptions

Included in Backtest

Commission$0 commission on US ETFs
Slippage0.005% Per Side

SPY Buy & Hold Benchmark

Does not include any transaction fees, slippage, or management costs.

Portfolio Builder & Simulator

Visualize your diversification edge

Instantly simulate how this strategy improves your existing portfolio. Check correlations, optimize allocations, and verify the smoothed equity curve before you deploy.

Generate Correlation Matrix
Optimize Capital Allocation
Simulate Combined Metrics
Visual Performance Comparison
Open Strategy Combiner →

Strategy Code Preview

RealTest full source code included in download

SPY ETF Mean Reversion Strategy RealTest code structure

Pick Your Strategy Below

Demo Strategy

$0one-time

Free RealTest demo mean reversion strategy.

  • RealTest .rts file
  • Robustness Verified
  • Does not include SPY ETF Mean Reversion Strategy
RealTest Users' Favorite

SPY ETF Mean Reversion Strategy

$1490one-time

Full strategy code and rules.

  • 660.9% Portfolio Growth
  • In-Sample / Out-of-Sample Validated
  • Survivor-Bias Free
  • Outperforms SPY Benchmark
  • Fully Customizable Source Code
  • Download Once, Use Forever

Multi-Strategies Bundle

$2,700one-time

Instant diversification. You own our complete suite of uncorrelated, robust strategies.