RealTest strategies / RealTest Short Term Mean Reversion Strategy

RealTest Short Term Mean Reversion Strategy

A RealTest strategy that buys short-term pullbacks in S&P 500 stocks that are still in a confirmed uptrend, following the Connors and Alvarez methodology. By only buying dips inside a rising trend, it stays with strong stocks going through temporary weakness rather than ones that are breaking down. Tested on survivorship-free Norgate data with commissions modeled, and trading live since October 2024.

Live traded since Oct 2024Trading costs included Survivorship-bias-free data
$100k$300k$1.0M$3.0M'02'04'06'08'10'12'14'16'18'20'22'24'26 In-sample Out-of-sample Live $3.3M $565k
Strategy SPY buy & hold
Sharpe ratio?
0.92
+100%vs SPY 0.46
Best year?
+120.2%
4.5×SPY best: 27.0% in 2003
Max drawdown?
-20.2%
59% smallervs SPY -49.9%

Robustness and stress testing

See how results changed when we varied the settings, assumptions or trades.

What if trading costs are higher or fills come a day late?

Short-Term Mean Reversion RealTest strategy cost stress test: backtest equity curves with commissions and slippage from zero to 10 times baseline and a one-day fill delay

See how each test is run →

What happened in every crash

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

Strategy monthly returns

JanFebMarAprMayJunJulAugSepOctNovDecYear
200010.62.316.813.015.33.84.52.2-0.512.9-6.910.2120.2%
20010.50.84.42.4-0.50.74.00.6-9.12.83.24.914.9%
20021.8-3.81.03.91.51.3-0.50.0-1.4-0.10.61.86.1%
2003-0.72.34.62.10.45.53.53.1-1.65.61.52.432.5%
20040.10.73.3-5.31.92.0-1.5-1.7-0.5-0.7-0.02.20.3%
20050.62.2-0.73.45.00.01.5-0.70.00.2-0.70.711.9%
20061.51.41.72.0-3.53.30.10.00.8-1.0-0.51.06.9%
20070.9-0.3-0.1-0.10.40.0-1.914.30.02.12.50.418.9%
2008-9.4-0.36.9-2.01.3-0.1-4.02.24.2-7.90.0-0.1-9.9%
20092.1-0.3-1.15.22.23.10.20.42.0-1.68.10.622.7%
2010-3.010.10.2-1.4-0.2-1.51.8-0.71.00.70.50.98.2%
2011-0.24.11.60.01.60.6-1.5-3.3-0.48.00.21.412.4%
20121.00.91.4-0.41.26.61.30.50.0-0.80.30.012.5%
2013-0.00.50.32.70.81.70.6-1.10.81.6-0.7-0.66.6%
2014-1.21.6-1.51.60.90.20.60.7-0.42.4-0.30.65.3%
20151.2-0.1-0.1-0.60.20.00.58.70.83.50.60.816.2%
20160.16.80.00.00.00.40.81.50.1-2.80.7-1.56.0%
2017-1.4-0.61.10.30.5-0.00.61.10.32.50.71.46.6%
20180.62.4-0.10.0-0.20.60.61.11.01.63.8-0.011.9%
2019-0.10.5-0.10.8-1.60.8-0.6-0.80.4-0.30.40.0-0.6%
2020-0.3-1.15.20.00.80.30.1-0.12.8-2.25.10.010.9%
20212.410.8-2.5-0.90.20.09.95.22.30.90.51.633.8%
2022-1.43.56.62.45.4-5.60.20.00.13.01.8-0.615.9%
20230.51.5-1.20.4-0.30.00.5-1.7-0.0-0.71.90.00.9%
20240.80.62.65.50.70.6-1.30.40.6-1.82.41.813.5%
20252.80.1-5.08.8-2.60.00.10.70.10.44.60.510.4%
20260.92.75.01.50.91.714.80.5-0.8-4.3-3.120.4%

Strategy overview

Why it buys pullbacks in strength

A stock in a steady uptrend that dips for a few days is usually seeing normal profit-taking, not the end of its trend. Short-term traders and nervous holders sell into the weakness, and once that selling clears, the stock tends to pick the trend back up. The strategy only looks for these dips in stocks that are already trending higher, so it is buying temporary weakness in a strong name rather than trying to catch a stock that is genuinely falling apart.

How it was tested

The rules come from the Connors and Alvarez book Short Term Trading Strategies That Work, quantified exactly and tested properly. The backtest runs on S&P 500 stocks including names later removed from the index, so survivorship bias does not inflate the results, and it includes Interactive Brokers commissions and a limit-order buffer. The approach uses few parameters and was checked with walk-forward analysis, so you can see how the published idea holds up with real costs rather than taking the book on faith.

How it fits your trading

This is a solid foundation strategy. The logic is well-known and easy to understand, and the trend filter keeps it out of the worst situations, so it is a natural first mean-reversion system to run and to build a portfolio around. It works on liquid large-cap stocks and takes little time to manage, and it sits comfortably next to a trend or breakout strategy that profits in different conditions.

Specification

StyleMean reversionUniverseS&P 500 current & past stocksTimeframeDailyOrder generationAfter the close, before next openSideLongAverage hold7 trading daysTrade frequency4.0 per monthEntry executionLimit order (placed before open, active open to close)Exit executionLimit order (placed before open, active open to close)DataNorgate Data (US Stocks Platinum, EOD) SoftwareRealTest or PythonCommission$0.005 / shareLimit price buffer0.1% past limitSPY benchmarkNo fees applied (favors SPY)

What you get

RealTest by MHP Trading logo
RealTest strategy code (.rts)
Reproduce the backtest above and check every trade. Setup video →
Trading strategy rules plain text document
Plain text rules
Rebuild the strategy in any software you use.
Python programming logo for quantitative trading backtest
Python backtest code (.py)
Open it in Python and run the backtest.

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 Short Term Mean Reversion Strategy?
A RealTest strategy that buys short-term pullbacks in S&P 500 stocks that are still in a confirmed uptrend, following the Connors and Alvarez methodology. By only buying dips inside a rising trend, it stays with strong stocks going through temporary weakness rather than ones that are breaking down. Tested on survivorship-free Norgate data with commissions modeled, and trading live since October 2024.
Why should this edge keep working?
A stock in a steady uptrend that dips for a few days is usually seeing normal profit-taking, not the end of its trend. Once that short-term selling clears, the stock tends to resume its uptrend. The strategy only buys these dips in stocks that are already trending higher, so it is buying temporary weakness in a strong name rather than one that is genuinely falling apart. Buying pullbacks within an uptrend is one of the most tested ideas in short-term mean reversion.
Do I need RealTest to run this strategy, or can I use Python?
No. The .py runs in Python 3 without RealTest. The .rts runs in RealTest by MHP Trading, including the free version. The plain text rules work in any software.
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.1% past limit, so the equity curve is after costs.
When did live trading start?
Live trading started in October 2024. The equity curve shows the backtest from 2000 and real performance from that point on.
What's included in the download?
RealTest strategy code (.rts). Plain text rules. Python backtest code (.py).
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 (both RealTest and Python) with a perpetual single-user license. You can freely adjust parameters, rewrite position sizing, combine rules with other strategies, or embed the logic into your own custom quant pipeline.
What market data do I need?
Norgate Data (US Stocks Platinum, EOD), the data behind this backtest. The .rts and the .py read it directly.
Can I automate execution?
Yes. In RealTest, you can send orders to Interactive Brokers through OrderClerk. With the Python code, you can connect to Interactive Brokers or Alpaca directly.
Can I ask questions about the code or the strategy?
Yes. Email info@setupalpha.com and you will get an answer, before or after you buy.

Changelog

2024-10-09Rules locked. Live trading starts.

No rule changes since.

Portfolio growth since 2000
3,188.5%
SPY same period: 465.3%
$790one-time
Instant download
MetricStrategySPY
Sharpe0.920.46
ROR13.82%–
Sortino0.730.44
MAR0.68–
Net profit$3.2M$465k
Expectancy2.21%–
Max exposure151.78%100%
Worst year-9.9%-33.2%

Download the complete strategy now

Active Script - C:\REALTEST\Strategies\short_term_mean_reversion.rts
RealTest Short Term Mean Reversion Strategy full RealTest script
Python programming logo for quantitative trading backtest
Python backtest code (.py)
Open it in Python and run the backtest.
RealTest Short Term Mean Reversion Strategy
$790one-time
Instant download