This week’s idea is another mean-reversion system, based on work of Larry Connors and Cesar Alvarez. My first attempt at a mean reversion system, SAT2021-02 Connors RSI 2, was my first successful system on this site, so this type of system has a special place in my heart. This system is very similar, but it utilizes the RSI for both entry and exit signals. Given the success of the first RSI system, I have high hopes for this one. Check out the Reference section at the end of this post for initial source for this idea.
I initially intended to run this on futures and equities, but the results for equities were so interesting that I decided to only focus on those.
Phase 1: Plan & Design
1. Trading Idea
The big idea is a mean-reversion system, using a 2-period RSI for entries and exits, and a simple moving average (SMA) as a trend filter. Here are the entries:
- The trend is bullish (up)
- RSI(2) is below 60 for three bars, continually falling
- The last bar is below the Oversold line (0-10)
- The trend is bearish (down)
- RSI(2) is above 40 for three bars, continually rising
- The last bar is above the Overbought line (90-100)
This system is based on one of the trading methods described by Larry Connors and Cesar Alvarez in Short Term Trading Strategies That Work, and articulated by Oddmund Groette on the Quantified Strategies website.
2. System Definition
RSI, 2 period
|RSI_OverSold(90)||Integer||Yes||Must be above this level for long entry|
|RSI_OverBought(10)||Integer||Yes||Must be below this level for short entry|
|Long_Exit(70)||Integer||Yes||Exit long position when RSI closes above this level|
|Short_Exit(30)||Integer||Yes||Exit short position when RSI closes below this level|
|MA_Trend_Period(200)||Integer||Yes||Number of periods for SMA calculation|
Although I have the parameters and entries designed for short or long positions, I decided to focus on long entries only based on my equities-only focus.
- $70,000, based on test results
- $10,000 per symbol: 10,000 / Latest Close Price
- RSI <= RSI_Oversold and
- RSI [1 bar ago] < RSI[2 bars ago] and
- RSI [2 bars ago] < 60 and
- Close > MA_Trend_Period
- RSI > RSI_Overbought and
- RSI [1 bar ago] > RSI[2 bars ago] and
- RSI [2 bars ago] > 40 and
- Close < 200-period SMA
Catastrophic loss only, $2,000. Stops should rarely, if ever, be hit.
- Exit long position when RSI closes above Long_Exit level
- Exit short position when RSI closes below Short_Exit level
3. Performance Objectives
The system will meet the following objectives:
|System Type (trend, mean-reversion, day, swing, etc.)||Mean-reversion|
|Risk of Ruin||0%|
|Profit Factor||> 1.5|
|Win Percent||> 70%|
|Max Drawdown %||< 35%|
|Profit/Drawdown Ratio||> 2.0|
I added Walk-forward Efficiency, as I am finding this to be a useful measure of the effectiveness of the optimized values. 50% may be too low, but I need to start somewhere with this.
This idea is S.M.A.R.T.: Specific, Measurable, Achievable, Realistic, Time-bound
4. Market Selection
|Equities||Random equities from S&P||Various||I picked a random selection of 180 equities that have been active over the past 20 years and on the S&P 500 during this time.|
Chart Type, Timeframe, Session, Time Zone:
|Chart Type||Regular Candlestick||Charting is only useful for validating entry and exit signals|
|Timeframe / Interval(s)||Daily|
Phase 2: Build
5. Manual Test
Pass. I performed the manual test on multiple equities and some futures, just for reference.
I built this allowing both long and short positions, but I will only turn on long positions for the equities.
7. Unit Test
Phase 3: Test
I optimized the following parameters (long entries only):
These optimizations have 72 combinations of parameters. The MA_Trend_Period , used for the SMA trend filter, is optimized based on an idea from Perry Kaufman, who sometimes favors an 80 day moving average for determining the long term trend.
9. Walk-Forward Analysis
This walk-forward analysis was unanchored. For the walk-forward period, I started on January 1, 2010 and ended on October 2, 2020. Ending on this date allows me to reserve 6 months of data for incubation, assuming these pass Monte Carlo analysis. As per usual, there were a lot of failures, but there were 24 equities I selected.
I am going to look at these equities as a group, or basket, mainly because they trade infrequently, less than 3 trades per year for each instrument. Overall, we are in the market less than 6% of the active trading days with this group. Here are some basic stats:
|Annualized Net Profit||$8,043.15|
|Average Return/Max Drawdown||3.32|
|Average Profit Factor||1.56|
So far, so good, right? I have met my performance goals set earlier in the process, so I should be okay to move to Monte Carlo Simulation. But I will take you on a brief shortcut that you might find interesting.
What would happen if I did not optimize?
The results were interesting. I used my default values I use for this system:
- RSI Oversold Level <= 10
- Long Exit Level >= 70
- Simple Moving Average Length (200)
Well, it performed better without optimization, in one respect, but worse in another (Spoiler alert: This contains the Incubation period results):
Total return was more than $5k, but we would have had a huge drawdown over $11k. Ouch. However, despite the large drawdown (I won’t bore you with the metrics) it would have passed. What can we take from this little experiment?
- Optimization improved the outcome of the primary fitness function: Net Profit
- Optimization is probably not necessary… in a trading system, this is a good thing. It tells us that our system is robust, meaning it would probably work over a variety of parameters. Systems that are too finely tuned tend to be fragile.
- A larger account size would be required to absorb that size of drawdown and maintain a zero risk of ruin, if not using optimized parameters
Our little detour is over, and I am sticking with our optimized values. Let us move to Monte Carlo Simulation with these 24 equities.
10. Monte Carlo Simulation
We passed! Here is what the basket of 24 equities looks like:
This was a tricky one to evaluate. The maximum number of positions the system held on a single day was 14. 14 x $10k = $140k. I don’t know about you, but I cannot justify having $140k tied up for just a 5.8% annualized return, although this number is deceiving since we were in the market less than 6% of trading days over the test period. I decided that I would treat this as a margin account with 2:1 leverage.
$140k purchasing power required / 2 = $70k account size required
The median expected return is okay at 9%, not stellar but workable. There is not a ton of risk in this, but it has the potential to use a lot of capital Otherwise, everything looks good. Nearly a 100% chance of profitability and 0% risk of ruin? Let’s incubate.
We did not make it this far. I ran MET through incubation anyhow, and it is +$400 (marked-to-market) for the past 6 months, but the current position is in a -$2,300 drawdown.
|Instrument||# Trades||Profit Factor||Win Percent||Result|
|Basket of Equities||43||2.19||72%||Pass|
During incubation, I only carried 5 equities at one time, which is $50k in case or $25k cash + margin loan.
This passes incubation.
Phase 4: Deploy
To deploy, I will expand this to a larger basket of equities. This will require a larger set of equities that goes beyond the scope of what I want to do here. However, I will add these to the portfolio. I need to strike a balance between amount of equity required, including margin if needed, and profitability.
12. Production / Portfolio Assignment
This will be assigned to our main portfolio. I will allocate $100k (hypothetical, of course) to this system. This will provide purchasing power of $200k on margin.
Notes and Commentary
I was confident this would work. Working with systems for equities is a pain due to having so many instruments, and if optimized, sets of code. I have 24 different systems, one for each equity. It is almost tempting to go the route of not optimizing at all, but the benefits outweigh the time cost involved.
Speaking of costs, margin borrowing costs are something I did not account for initially, but they would have been about .5% of the Net Profit. The impact would have been minimal.
Continuous Improvement Department:
I noticed a few holes in the system. Here are a few things that can be improved in a future system:
- Limit number of days in position: Nearly every trade that went longer than 8 days was a loss. If a position not profitable after n-bars, get out. This is an exit I have seen elsewhere, and I know it works for some trades.
- ATR Stop Loss: My wife is queen of the ATR stop, so maybe I will take a page from her trading diary and use an ATR stop instead of a fixed stop loss. This may keep us out of a bad trade. It is better than a fixed stop loss, I am sure. For what it is worth, we didn’t hit a stop in our testing.
- Go short: Since this works well long, why not double our trading opportunities and go short, since we are already using margin? I would optimize the short parameters separately.
One final note about Monte Carlo analysis. I use a couple Monte Carlo tools, but the screenshots you see are typically from a Monte Carlo Analysis tool provided by Kevin J. Davey, legendary algo trader and one of my systematic trading mentors. Check the Sources/References section at the end for a link to this valuable (and free) tool. It’s worth every penny.
That is about it! I have at least one more mean reversion idea I want to try, but I will wait a couple months before I release it. Next week, I will try to build a system based on Kaufman’s Efficiency Ratio and some moving averages. You won’t want to miss this!
Trading System Result: SUCCESS
- Larry Connors’ R3 Strategy (It Still Works)
- Short Term Trading Strategies That Work, Larry Connors, Cesar Alvarez
- Free Algorithmic Trading Calculators (scroll down to Monte Carlo Analysis)
Did you like what you read? Do you want to see more? Subscribe now and receive our weekly email, with the Trading System Idea of the Week and other fun stuff.
Don’t worry, we will never, ever, ever sell, overuse, or donate your email address. Promise.