RealTest Strategies / RealTest Mean Reversion Trading Strategy

RealTest Mean Reversion Trading Strategy

A RealTest mean-reversion strategy for S&P 500 stocks that waits for a candlestick reversal before buying an oversold name, so entries come only after sellers start to step back. Tested on survivorship-bias-free Norgate data, with Interactive Brokers commissions and limit fills modeled, and trading live since May 2024.

Live traded since May 2024Trading costs included Survivorship-bias-free data
$100k$300k$1.0M$3.0M$10.0M'02'04'06'08'10'12'14'16'18'20'22'24'26 Live $11.8M $592k
Strategy SPY buy & hold
Sharpe ratio?
1.4
+192%vs SPY 0.48
Best year?
+86.0%
3.2×SPY best: 27.0% in 2003
Max drawdown?
-15.5%
69% smallervs SPY -49.9%

Validated four ways

See how each test is run →

Live market performance
Performs in real market conditions since 2024-05-01
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

What happened in every crash

CrisisDatesStrategySPYSame $100k in
Dotcom crash Mar 2000 – Oct 2002 169.8% -41.8%
2008 financial crisis Oct 2007 – Mar 2009 12.5% -49.9%
COVID-19 crash Feb 2020 – Mar 2020 -5.1% -28.7%
2022 bear market Jan 2022 – Oct 2022 4.1% -21.3%

Strategy monthly returns

JanFebMarAprMayJunJulAugSepOctNovDecYear
2000-2.37.94.35.49.61.83.08.51.914.76.03.986.0%
20015.87.51.41.60.02.12.52.3-2.06.5-0.45.537.7%
20023.0-2.23.33.22.6-0.5-1.40.33.80.72.43.119.7%
20032.80.61.40.86.89.14.33.6-0.87.75.41.351.8%
20041.04.12.3-1.21.10.2-2.10.60.91.7-1.03.411.2%
2005-6.32.12.91.01.91.83.40.01.5-1.21.41.69.9%
20064.22.63.93.1-5.01.21.40.4-0.53.20.6-0.215.7%
2007-0.2-1.91.83.01.64.01.23.3-0.14.00.53.222.2%
2008-7.70.93.72.25.72.9-2.60.58.2-1.00.00.012.5%
2009-0.1-5.4-0.36.63.54.0-1.83.19.1-4.75.11.621.4%
2010-4.25.42.11.40.8-2.01.02.10.02.50.92.012.4%
2011-0.02.85.21.32.7-0.91.2-3.51.42.6-1.10.712.7%
20120.81.53.91.9-1.21.81.50.80.93.91.31.019.6%
20130.33.6-0.01.50.83.30.20.61.44.10.90.318.2%
2014-2.11.00.84.90.60.3-2.30.50.8-1.60.22.35.4%
20153.91.00.6-1.43.43.20.90.60.40.31.80.315.9%
2016-1.10.92.20.80.33.70.9-3.11.70.92.5-0.29.7%
20170.9-0.7-0.00.7-0.31.50.2-0.21.12.40.91.28.1%
20180.7-0.93.80.64.51.7-0.81.5-1.1-0.92.5-1.510.3%
2019-0.20.21.31.4-5.62.4-0.50.01.34.40.12.16.6%
2020-1.7-4.94.1-0.03.77.28.32.11.6-1.14.12.828.6%
2021-4.65.80.50.93.7-0.2-1.73.3-0.5-0.41.79.919.1%
2022-4.92.48.5-0.25.4-8.9-0.91.01.71.07.9-1.011.3%
20231.4-0.4-2.30.2-0.92.14.90.7-1.90.50.91.87.2%
20242.47.24.01.53.01.5-2.21.10.61.46.82.634.0%
20251.8-2.7-2.5-3.50.23.03.64.33.82.8-1.03.814.1%
20262.54.9-1.3-0.07.31.65.82.20.525.7%

Strategy overview

Why it waits for confirmation

An oversold stock is not always a stock that is about to turn. Buying purely on an oversold reading can put you into a name that keeps falling through a selloff. This strategy waits for a candlestick reversal, a price-action signature that shows sellers losing control, before it enters. That step means entering when there is already a sign of stabilization, which improves the quality of each entry and keeps you out of the worst of a cascading decline.

How it was tested

The backtest runs on S&P 500 constituents including companies later removed from the index, so survivorship bias does not inflate the results. Every fill is modeled with a limit-order buffer and Interactive Brokers commissions, so the equity curve is after real costs. The rules stay simple and use few parameters, and the strategy was checked with walk-forward analysis and Monte Carlo simulation. Both are shown on this page.

How it fits your trading

The confirmation filter trades less often than a plain oversold system, so it spends more time in cash and puts capital to work only on the higher-quality setups. It is long-only on liquid large-cap US stocks, which makes it steady to run alongside a trend or breakout strategy. The logic is clear enough to follow through a full market cycle without overriding it on the hard days.

Specification

StyleMean reversionUniverseS&P 500 current & past stocksTimeframeDailySideLongAverage hold6 trading daysTrade frequency10.8 per monthEntry executionLimit orderExit executionLimit & marketDataNorgate Data (US Stocks Platinum) SoftwareRealTestCommission$0.005 / shareLimit price buffer0.05% past limitSPY benchmarkNo fees applied (favors SPY)

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
Trade it on any platform without reading the code.

Quick start & live trading

RealTest trading software logo
Quick start guide
From download to first backtest in 1 minute
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'

What traders say

Buying a SetupAlpha strategy didn't save me money, it saved me research time. I estimate it replaced 70–90 hours of development, debugging, and validation. Even if I never trade the strategy exactly as delivered, the research process was worth the investment.

Roman Blackwood
Roman Blackwood
Founder of AI in Trading (+13K subscribers)

I've been using a strategy from SetupAlpha and I'm really impressed with its elegance and stability. The unique approach gives me a fresh perspective and ideas I can apply to other strategies I'm developing. I'm currently working on integrating it into my suite of trading strategies.

TradeQuantiX
TradeQuantiX
Multi-country systematic trader (+4.7K subscribers)

I traded discretionary for over a decade and kept putting off going systematic because I did not know where to start. Having a finished, tested system to take apart was what finally got me moving.

Daniel
Daniel
Crypto trader

I have run it live since 2024 and it is still in my portfolio. It also changed how I test the systems I build myself.

Systematic Traders
Systematic Traders
Algo trader & Substack writer (+6.4K subscribers)

FAQ

What is RealTest Mean Reversion Trading Strategy?
A RealTest mean-reversion strategy for S&P 500 stocks that waits for a candlestick reversal before buying an oversold name, so entries come only after sellers start to step back. Tested on survivorship-bias-free Norgate data, with Interactive Brokers commissions and limit fills modeled, and trading live since May 2024.
Why should this edge keep working?
Buying a stock only because it is oversold can mean buying one that keeps falling. This strategy waits for a candlestick reversal, a price-action sign that sellers are losing control, before it enters. The entry comes after the first evidence of stabilization rather than in the middle of the decline. Waiting for buyers to show up is a standard way to raise entry quality in mean reversion, not a one-time trick.
What is RealTest and what software do I need?
RealTest is a backtesting and trade automation platform for systematic traders, built by Martin Parker at MHP Trading. Each strategy comes as an .rts file you import directly. To trade it live you add OrderClerk and an Interactive Brokers account.
How was this backtested?
Survivorship-free Norgate data from January 2000 to the present, with out-of-sample walk-forward analysis and over 1000 Monte Carlo simulations to test stability.
Are transaction costs included?
Yes. The results include Interactive Brokers commissions, and a limit-order buffer of 0.05% past limit, so the equity curve is after costs.
When did live trading start?
Live trading started in May 2024. The equity curve shows the backtest from 2000 and real performance from that point on.
What's included in the download?
RealTest .rts file (complete source). Plain-text trading rules. Full documentation with parameter explanations.
How does it compare to SPY?
The chart at the top plots this strategy against SPY, the S&P 500 ETF, from 2000 with both starting at $100,000. A metrics table lists the exact numbers side by side: Sharpe, Sortino, net profit and worst year, for the strategy and for SPY over the same period.
Can I modify the code?
Yes. You get the complete source code with a perpetual license, so you can adjust parameters, change position sizing, combine it with other systems, or use it as a starting point for your own research.
What market data do I need?
Norgate Data (recommended) for survivorship-free US equities. Yahoo Finance works for basic testing but lacks delisted stocks. The backtest results shown here use Norgate Platinum.
Can I automate execution?
RealTest to OrderClerk to Interactive Brokers. Generate signals daily in RealTest, execute automatically via OrderClerk to IBKR. Setup course available.
Can I ask questions about the code or the strategy?
Yes. Email setupalpha.capital@gmail.com and you will get an answer, before or after you buy.

Changelog

2024-05-01Rules finalised. Live tracking starts.

No rule changes since.

Portfolio growth since 2000
11,673.1%
SPY same period: 492.5%
$999one-time
Instant download
MetricStrategySPY
Sharpe1.40.48
ROR19.56%
Sortino1.350.46
MAR1.26
Net profit$11.7M$492k
Expectancy1.42%
Max exposure99.9%100%
Worst year5.4%-33.2%

Download the complete strategy now

Active Script - C:\REALTEST\Strategies\mean_reversion_2025.rts
RealTest Mean Reversion Trading Strategy full RealTest script
Trading strategy rules plain text document
Plain text rules
Trade it on any platform without reading the code.
RealTest Mean Reversion Trading Strategy
$999one-time
Instant download