Mean Reversion and Market Filters


mean reversion NO filter, all
Click to enlarge.

So I have this mean-reversion trading system. The details are unimportant, but it’s very simple: a stock falls a specific, giant percentage. I then set a limit order for another giant percentage below that previous close. If it executes the next day, I then hold it for a few days. If it closes above 6%, I sell it at the close. Of course I have to guess if it’s going to be above the 6% mark to sell it at that close, but most of the time it’s pretty obvious. “Close enough for equities,” I always say.

You can see the cumulative gain/loss chart above. Not too shabby, although there were some lumpy drawdowns in the backtest.

Note how this system seems to make its major gains during weak markets, and yet it’s a long rather than short system. Cool, huh?

So I got to thinkin’: this system falls under the heading “catch a falling knife.” It would be silly to catch said knife when the market as a whole is on a temporary upswing, only to have the market work against the trade when it loses steam in the following days. I wonder if some sort of market-health filter would improve this system?┬áTurns out, yes it does!

First off, about my testing:

I don’t just test on all my data and curve-fit the results into something destined to fail in the real world. Instead, typically I will develop my ideas using the period 2010-2012, since this was a time period that had some serious bumps in it, but wasn’t in a full-out bear market. I use the current list of the Russell 3000…yes I can hear some of you in the back row shouting “what about survivor bias?!” I’ll get to that. Hey I’m just developing my ideas and it’s easier this way. I will usually limit my trades to above a certain price (e.g. close > $5) with a median 21-day volume greater than 100k shares. I start with an account of $30,000, have a fixed position size of $1500 (i.e. no compounding), $4.95 commission each way, and a maximum of five trades at a time.

Once I’ve got a system that looks promising, I test it on out-of-sample data from 2013 to the current day. Still using the current Russell 3000 list though. If it looks good, then I test it on all stocks meeting the criteria, including delisted stocks, for the NYSE, NASDAQ and Amex exchanges. It takes about an hour on my aging laptop to run a test using the delisted set, therefore I don’t do it until I’m almost ready to move to the real world.

So when I added this market-health filter, it was before testing it on the out-of-sample data. Happy now?

I reasoned that a short-term RSI reading of SPY could give me a decent indication of the short-term health of the market. I settled on a 2-period RSI, and the best results were obtained when the SPY RSI(2) was <25.

mean reversion w filter, all
Click to enlarge.

Not quite as much total profit as the system without the filter, but the reward is that drawdowns are much more pleasant. Here are more graphs, because graphs make me look cool. This time, some drawdown graphs (no-filter and with-filter):

drop and wait no filter DDdrop and wait w filter DD

Here’s a comparison:

Screen Shot 2015-11-16 at 4.57.46 PMThe market filter version has a higher CAR/MDD, higher Sharpe ratio, and – my favorite – a higher win rate.

But after awhile, I began pining for that extra profit. Could I possibly have that extra profit AND keep my drawdowns low? Was a short-term timing filter always necessary? There seemed to be times when it was hurting me, and times when it helped.

Full disclosure: at this point I’m not working with unseen out-of-sample data. I already trade this system with the filter in place, but I can be curious right? I just have to keep in mind that this could be curve-fitting in some way. But think of it like this: if there’s a sound logical reason for some sort of switching the filter on and off, then it’s worth investigating.

So let’s zoom in on a few areas. First, 2011 and 2012, without and with the filter. Total profit is higher without the filter, but it’s also a bumpier ride. Most of the action for either system happens at the most volatile part of 2011.


mean reversion NO filter, 2011-2012
Click to enlarge.
mean reversion w filter, 2011-2012
Click to enlarge.

Looking at the period from 2008 to the end of 2010, we get these two graphs:

mean reversion NO filter, 2008-2010
Click to enlarge.
mean reversion w filter, 2008-2010
Click to enlarge.


Without the filter, we see more total profit, but with some pretty chunky drawdowns as well. All the action is centered around the end of 2008, when the market sh** hit the fan.

Now let’s look at a low-volatility period: 2013-2014. The results are surprising! Without the filter, the results just fall apart. When the filter is in place, there are far fewer trades, but they are much more successful, and profit is higher as well.

mean reversion NO filter, 2013-2014
Click to enlarge.
mean reversion w filter, 2013-2014
Click to enlarge.

One possible cause is that in a low-volatility, steadily rising market environment, any big plummet in an individual stock’s price might really be warranted (rather than panic-driven), and bargain hunters don’t pile in. Or perhaps it’s simply that in an environment where most stocks are going up, why bother taking risks with scary price drops? So when the stock drops, it doesn’t pick itself back up again.

Meanwhile, when volatility is high (or perhaps just “normal”), perhaps sellers tend to overreact, and then bargain hunters are more willing to see “value”.

My next step would be to investigate a longer-term market health filter, to determine if it improves the results by switching the short-term RSI filter on and off. I could look at VIX, or VIX vs its moving average, or market breadth, or even simple moving averages.

Or I could just leave the filter in place!