Mean Reversion Entry Timing | Alvarez Quant Trading 09.05.
2018, 23+35
Home Blog AmiBroker
April 25, 2018 in Mean Reversion , Stocks by Cesar Alvarez
Mean Reversion Entry Timing
One of the first tests I did when I got AmiBroker twenty years ago was a mean reversion test. It was
a classic set up, a stock in an uptrend, followed by a pullback. But the entry differed from what I do
now. The entry waited for a confirmation of the trend back up. The trade would enter when the
stock crossed above the previous day’s high. The exit was also different. The exit was on a close
below the lowest low of the last (2,5) days. The results were not very good, so I gave up on it. I did
not do test entering on the open or on further intraday pullback or exiting on the bounce. If I had, I
would have started my mean reversion trading several years earlier, which would have added
several more years of large edges trading. Oh well, I was just a beginner researcher then.
Recently I got curious about waiting for confirmation before entering a trade. Now that I know
more about entries and exits, would it give good results. How would these results compare to
waiting for further intraday pullback or entering at the open? Time to discover.
The Setup
Testing was done from 2007 to 2017.
Stock is member of the S&P500 index
2-period RSI of stock is under (5,10,15,20)
Stock is above the 100-day moving average (the spreadsheet also has results for 50, 150, 200). I
[Link] Strona 1 z 15
Mean Reversion Entry Timing | Alvarez Quant Trading 09.05.2018, 23+35
choose 100 just to be different from my normal testing.
Today’s MA100 is greater than the MA100 21 days ago. We want moving average in an uptrend
The SPX is above the its 200-day moving average. Want a bull market.
On setup, we have one of three ways of entering: on the next open, intraday selloff, intraday trend
resumption. Signals are ranked from highest 100-day historical volatility to lowest. Invest in a
maximum of 7 stocks at 14.2% per position. I forgot how I ranked the signals or position sizing from
20 years ago but this alone could make a big difference.
First, we will look at using an RSI exit.
Entry on Open – RSI Exit
Entry
If previous bar is a set up, then enter at the open
Exit
If 2-period RSI closes above (20,40,60,80) exit on next open
[Link] Strona 2 z 15
Mean Reversion Entry Timing | Alvarez Quant Trading 09.05.2018, 23+35
Results
For all the comparisons, we will be looking at the top 5 runs and the average of those. For space
reasons I am not showing the 2007 & 2008 results but they are in the spreadsheet.
[Link] Strona 3 z 15
Mean Reversion Entry Timing | Alvarez Quant Trading 09.05.2018, 23+35
This the standard mean reversion strategy. From here we will compare the results. The CAR is about
where I would expect giving that the strategy is trading S&P500 stocks. I would expect better
results using the Russell 3000. The % winners at 65% and low are Avg % p/l are as expected.
Intraday Pullback – RSI Exit
This is my favorite method to enter my mean reversion trades.
Entry
If previous bar is a set up, then enter at a limit price at the previous day’s low.
Only place the number of orders so if they all are filled, then will be in 7 positions. No leverage
is used.
Exit
If 2-period RSI closes above (20,40,60,80) exit on next open
[Link] Strona 4 z 15
Mean Reversion Entry Timing | Alvarez Quant Trading 09.05.2018, 23+35
Results
[Link] Strona 5 z 15
Mean Reversion Entry Timing | Alvarez Quant Trading 09.05.2018, 23+35
This really did surprise me. I expected the CAR and the Avg % p/l to be significantly higher than
“Entry on Open, RSI Exit.” The yearly comparison with “Entry on Open, RSI Exit” is about the same
most years. I was surprised that the Intraday pullback did better in 2017.
Trend Resumption – RSI Exit
Entry
If previous bar is a set up and today the high is greater than previous day’s high, then enter at
the previous day’s high.
Exit
If 2-period RSI closes above (20,40,60,80) exit on next open
Results
Again I am surprised. The average CAR is much higher than I expected. This has the best run so far
with 16.02 CAR but notice how quickly the CAR drops. This is not a good sign. This is not the
typical exit for this type of trade but I wanted to use the RSI exit to compare with the other two
entry types.
Entry on Open, N-Day Exit
[Link] Strona 6 z 15
Mean Reversion Entry Timing | Alvarez Quant Trading 09.05.2018, 23+35
In this case, I do a trailing stop of the N-day low of lows because this is the stop used for the trend
resumption entry.
Entry
If previous bar is a set up, then enter at the open
Exit
If today’s close is below the (2,5,10,15,20) day low of lows, then exit on next open
Results
The average CAR being better than the RSI exit surprised me. I was not expecting this. The higher
MDD did not surprise me. The RSI exit had an average hold of 7 bars vs 21 bars here. Some big
differences in the year return. For 2017 you have 5.60% vs 22.32%. Also notice that with the n-day
low exit we are now have winners at 29% vs 65% for the RSI exit. This is more like a trend following
for % winners.
Intraday Pullback, N-Day Exit
Now this is not the typical exit for this entry.
[Link] Strona 7 z 15
Mean Reversion Entry Timing | Alvarez Quant Trading 09.05.2018, 23+35
Entry
If previous bar is a set up, then enter at a limit price at the previous day’s low.
Only place the number of order so if they all are filled, then will be in 7 positions. No leverage
is used.
Exit
If today’s close is below the (2,5,10,15,20) day low of lows, then exit on next open
Results
The surprises keep on coming. The CAR is the highest of all the tests but then so is the MDD. I was
expecting poor performance on this test. Again the low % winners would make this hard to trade.
Look at how slowly the CAR drops that is a good sign. I must investigate this more.
Trend Resumption, N-Day Exit
This is the test from 20 years ago.
Entry
[Link] Strona 8 z 15
Mean Reversion Entry Timing | Alvarez Quant Trading 09.05.2018, 23+35
If previous bar is a set up and today the high is greater than previous day’s high, then enter at
the previous day’s high.
Exit
If today’s close is below the (2,5,10,15,20) day low of lows, then exit on next open
Results
[Link] Strona 9 z 15
Mean Reversion Entry Timing | Alvarez Quant Trading 09.05.2018, 23+35
These results are better than expected. I was expecting a negative CAR. But they are still much
worse than the other results. Waiting for the confirmation that the trend is going back up, costs
you. Compare these results with the “Entry on Open, N-Day Exit” with the CAR almost double.
Spreadsheet
Fill the form below to get the spreadsheet with all the results and additional stats. See yearly
breakdown and many more value.
Final Thoughts
These tests were full of surprises for me. The most significant one being the “Intraday Pullback, N-
Day Exit.” I must do more research on that. Maybe a future blog post. What this help remind of is
never make assumptions about what the test results will be. And more important back to old tests.
Sometimes markets change or even more important, we have learned more about how to enter and
exit trades that makes a difference.
Backtesting platform used: AmiBroker. Data provider: Norgate Data (referral link)
Good quant trading,
[Link] Strona 10 z 15
Mean Reversion Entry Timing | Alvarez Quant Trading 09.05.2018, 23+35
Fill in for free spreadsheet:
First Name
Last Name
Email *
Privacy Policy
Submit
Share this:
Twitter LinkedIn Google Pocket RSS Feed
Related Posts
Is mean reversion dead? The ABCs of creating a mean Is mean reversion dead – reader
reversion strategy – Part 2 suggested research
Click Here to Leave a Comment Below
[Link] Strona 11 z 15
Mean Reversion Entry Timing | Alvarez Quant Trading 09.05.2018, 23+35
Peter A - April 25, 2018 ! Reply
Hello César!
I am a subscriber and read all your posts diligently.
I have a quick question for you: In all the years that you have been trying to
find the best strategies, have you found one that you are mostly using
today in your own trading?
Would you mind sharing it with me, and where can I find the strategy?
Many thanks, and keep up the good work!
Peter
PS: I am alos a subsriber to Arthurh Hill blogs on [Link], and he
always gives you good reports!
Cesar Alvarez - April 25, 2018 ! Reply
I trade about 6 different strategies. Four of them are 1-4 years old. One
of them is about 10 years old. I stopped trading it about 3 years ago
because I was having difficulties with trading it because it is a short
stretagy. I recently started trading that again. The last one is probably
about 5 years old. Strategies come and go and I am always looking for
something better from my continous learning. I do not sell the rules to
any of my strategies. Some of the strategies I do trade can be found at
[Link]
[Link] Strona 12 z 15
Mean Reversion Entry Timing | Alvarez Quant Trading 09.05.2018, 23+35
Manuel - April 26, 2018 ! Reply
lets catch up
Nice post !
Manuel
Cesar Alvarez - April 26, 2018 ! Reply
You can always contact me through my contact page,
[Link]
Leave a Reply:
Name* Email* Website
SUBMIT
[Link] Strona 13 z 15
Mean Reversion Entry Timing | Alvarez Quant Trading 09.05.2018, 23+35
Previous post
Disclaimer Testimonia
The information and analysis on this site is provided for informational "After working with Cesar
purposes only. Nothing herein should be interpreted as personalized and barely profitable to c
investment advice. Under no circumstances does this information
represent a recommendation to buy, sell or hold any security. None of the - Individual Investor
information on this site is guaranteed to be correct, and anything written
here should be subject to independent verification. You, and you alone,
are solely responsible for any investment decisions you make. The ideas
and strategies should never be used without first assessing your own "There no way I'd be profe
personal and financial situation, or without consulting a financial professional advice and h
professional. I may hold positions for myself or clients in the securities or - Mark Angil, RBD Adapt
industries mentioned here. There is a very high degree of risk involved in
trading securities. Your use of any information on this site is entirely at
your own risk. My thoughts and opinions will also change from time to
time as I learn and accumulate more knowledge.
“...I've known Cesar for 8
resource for financial mar
coding. ...."
Rob Davenport - LCA Ca
“... Eventually, I realized t
engineered by Cesar. ...
understand, and that is ve
- Ronen Marom
[Link] Strona 14 z 15
Mean Reversion Entry Timing | Alvarez Quant Trading 09.05.2018, 23+35
Copyright text 2015 by Alvarez Quant Trading.
[Link] Strona 15 z 15