Sunday, April 20, 2008

Trend-following the RSI(2)

I admittedly got a little distracted this week. What started as a little side project for me actually ended up consuming all of my computational resources and ultimately generated 17,485,793 trades. Yea, 17 million. Fortunately I figured out how to program macro scripts for Traders Studio recently so much of the process was automated.

The primary purpose behind this blog is to explore and test trend-following ideas that can be used in conjunction with a CANLIM approach to the markets. With that said, there has been a lot of discussion recently in part of the blogosphere I follow looking at the 2-period RSI as a short-term mean-reversion indicator. Don't let the title fool you, I am only following this “trend” with a little research of my own. Yea, I know - not that funny.

Woodshedder@IBC
The Dogwood Report
Pennings of an Analyst
TradingMarket

This is natural given the recent range-bound market that highlights the need for a trader to be able to adapt to various market conditions. Markets don’t always trend and knowing when to step back or change approaches is critical to stabilizing returns and minimizing drawdowns. I decided to apply my own approach to testing the RSI(2) this week to determine if it had enough meat to serve as the basis for a short-term mean-recursion trading system. I am typically not a big fan of indicators & oscillators for no other reason than I have not found or seen quantifiable evidence backing up the effectiveness of most of them. I even looked at the ADX a few weeks ago on this blog as an obvious candidate for a trend-following system. Unlike that however, the RSI(2) did impress me.

The setup, entry and exit criteria for the test this week was very simple. The setup was only a liquidity threshold requiring 10-day average volume to be above 100,000 shares. Entry was a market order to buy $1000 worth of shares at open on the day following the RSI(2) falling below a certain threshold and exits were simple 1,5 and 10-day timed exits. Not a complete “system” but simple enough to place all the burden on the RSI for the heavy lifting. I did intend to look at shorting overbought as well but simply ran out of time. The test are run for a 10-year period starting on 01/01/1996 through 12/31/2007.

The y-axis of the performance graphs are formatted with my go-to evaluation criteria, EDR (expectancy per dollar risk) which is calculated by Average Trade/Average Loss. The x-axis shows the RSI value that was used as the threshold in a <= operation. I will follow-up the graphs with the raw trade data.



IBD portfolio


NASDAQ100 components


S&P500 components


So I think the results speak for themselves. It looks like an RSI <= 3 is the sweet spot so if we allow ourselves the luxury of perfect hindsight for a moment and use that as our threshold, expectancy per dollar risked on our Nasdaq portfolio, for example, was 242% higher than all trades 1-day out, 140% higher 5-days out, and still 112% higher 10-days out. Remarkable results. Combined with more refined entry, exit, risk management and position sizing rules, I’m quite certain you could increase your win percentage and expectancy much further. Not only that, as these results illustrate, the method is robust enough to apply to larget baskets of stocks which will generate plenty of oppertunities. I am a believer, atleast for now until every computer plugged into the internet starts trading it. Keeps you sharp though, when something stops working, it only means something else is starting to.

11 comments:

Jeff said...

Excellent.

I'll link up to this report as soon as iBC is re-opened. (We are closed in observance of the death of Jack the Convict.)

Jeff said...

I'm wondering if a filter that identifies range bound stocks that have high volatility across a large range was used in conjunction with the RSI(2) filter if the results wouldn't be interesting.

bhh said...

Perhaps some implementation of AvgTrueRange for volatility. Range bound is sort of tough to program though (like trendiness). Maybe HighestHigh and LowestLow = HighestHigh and LowestLow 65 bars ago or something similar so you are filtering stock that have failed to set a new high or low in the last quarter?

bhh said...

Thinking more about it, you could require the HighestHigh and LowestLow to be a certain percentage apart from one another and then require AvgTrueRange to be within some multiple of that high/low spread. The idea being you want a stock that can cover the spread the quickest for effecient use of capital.

Jeff said...

That sounds like a good way to approach it.

To your second comment, I would have to think about how a time component would or wouldn't work. I'm wondering if more time in a range means the stock will continue in the range or if the opposite is true. Regardless, its fun to consider the possibilities.

I'm looking at a possible long entry into TMX tomorrow for the RSI(2) strategy. It is looking ripe.

bhh said...

Yea, the TMX chart brings up another good point that would be intersting to look at also. Price still above the 50dma but within a certain percentage of it for support. Gives a good protective stop point as well and makes it pschologically easier to catch the falling knife. One could really have a field day with this I'm afraid.

Jeff said...

I *think* I read a study that found that the MA weren't that crucial for the RSI strategy and that in fact it worked better when price < 200ma. I think it was one fo the studies I linked to recently.

The bulk of what I've read has used the 200ma as the measure of trend. Regardless, for TMX, with the 50 and 200 day being so close, it probably doesn't matter.

Dan said...

I don't completely understand RSI, how would I run a scan on this in telechart? When I sort the IBD 200 by RSI for today it looks like the lowest is at 8, state street.

thanks,
Dan

bhh said...

I don't use telechart so I can't say for certain but STT is currently at 8.03. Levels below that are not all that common so with the rally the last few days, it doesn't suprise me if that is the only one in the IBD200.

BTW, this is NOT a tradable system with the rules as I defined them in my backtest. These tests are purely exploratory in nature.

Dan said...

heh. Yup I understand. Was more curious on the results and the stocks fitting the scans :)

David Varadi said...

what about the interesting possibilities of a combo strategy whereby you buy stocks of the IBD index, NDX, SPY etc, when the RSI2 is low (below 20 or 10), but the stock/index isabove say the 50/200d MA, then you use the stop loss of 8%, and 25% trailing loss method----i would imagine that this would drastically increase your winning percentage and total profitability--and would be a lot more tolerable for the average person than just breakout trades