System Trader Success
Share It!

Capture The Big Moves!

Wouldn’t it be great to have an indicator to help tell you when we are in a major bull or bear market? Imagine if you had a clear signal to exit the market on January 19, 2008 before the major market crash. Then the same indicator told you when to get back into the market on August 15, 2009. Such an indicator would have also gotten you out of the market during the dot-com crash on November 11, 2000. Well, this indicator I’m going to talk about does just that.

Below you will also find the EasyLanguage code for this indicator. This major trend indicator was inspired by an article entitled “Combining RSI With RSI” by Peter Konner, and it appears in the January 2011 issue of Technical Analysis of Stocks and Commodities.

How It Works

We are going to start with a well-known indicator: the Relative Strength Indicator (RSI). The goal is to identify major bull market and bear market regimes. In his article, Peter does this by simply using an RSI indicator on a weekly chart and identifying two unique thresholds. Peter noticed that during bull markets the RSI rarely goes below the value 40. On the other hand, during a bear market the RSI rarely rises above the value of 60. Thus, you can determine the beginning and ending of bull/bear markets when the RSI crosses these thresholds. For example, in the bear market during the financial crisis of 2008 the weekly RSI indicator did not rise above 60 until August of 2009.  This signaled the start of a new bull trend. The next bear trend will be signaled when the weekly RSI falls below 40. This is clear in the images just below. With these simple rules you are able to determine bull and bear markets with a surprising amount of accuracy given the S&P futures market.

The two images below show the SPY ETF on a weekly chart. Below the price is a second pane with a 12-period RSI. Why a 12-period RSI? I simply chose that number because it represents a quarter of a year of trading, if you figure four weeks in a month. There was nothing optimized about this number, it just seemed to be a logical starting point. Other lookback values will produce very similar results.

In the image below (click to enlarge) you will see the RSI signal stays above the 40 level during the strong bull market of the 1990’s.

RSI In Bull Market Does Not Go Below 40 Often - Relative Strength Indicator

RSI In Bull Market Does Not Go Below 40 Often.

In the image below (click to enlarge) you will see the RSI signal stays below the 60 level during the strong bear market in the financial crisis of 2007-2009.

RSI In Bear Market Does Not Often Rise Above 60

RSI In A Bear Market The Does Not Often Rise Above 60

As you can see the RSI appears to do a fairly decent job of dividing the market into bull and bear regimes. You will also notice the RSI indicator paints red when it goes below 40 and only returns to a light blue when it rises above 60. It is these critical thresholds which highlight a significant turning point in the market that may be occurring.

Modifying RSI

I personally found the RSI signal a little choppy. I decided to make two modifications to help smooth the raw RSI signal. First, the input into the RSI indicator was modified by taking the average of the high, low, and close. The RSI value is also smoothed with a 3-period exponential moving average. The resulting EasyLanguage code looks like this:

RSI_Mod = RSI( (c+h+l)/3, RSI_Period );
Signal = Xaverage( RSI_Mod, 3 );

These two modifications will smooth out our RSI signal line. Next, I want to test the RSI lookback period. To do this I create a simple strategy using EasyLanguage. I open a long position when the RSI crosses above the 60 value and sell short when it crosses below the 40 value. The strategy is always in the market either going long or short. Just as a side note, the system I’m developing is not necessarily a trading system. Instead it’s an indicator to help determine the market regime: bull or bear. While I use the word “strategy”, it’s not a trading system.

Testing Lookback Periods

I’m curious to see how well this strategy holds up over various lookback periods. Ideally, the a strategy should be robust enough to produce solid results over a range of lookback periods. To test this aspect of the strategy I’m going to use TradeStation’s optimization feature to optimize the lookback period over the values 2-24.

The first chart is the lookback period (x-axis) vs the net profit (y-axis).

Click to see this performance report

Lookback Period vs Net Profit

 

The above chart shows rising profit as the lookback period increased from 5 to 17. Then it begins to fall off. Let’s look at this from a different angle: profit factor. The next chart is the lookback period (x-axis) vs the profit factor (y-axis).

Click here to see performance report - Relative Strength Indicator

Lookback Period vs Profit Factor

 

We see a similar picture but there is more of a stable region between 16-24. I would think that between these values we could find a good lookback period.  When I originally looked at this concept back in 2011, I picked 16 as a value. I don’t recall why I did that, but it’s certainly not an outline, and I’ve decided to continue to use this value for this article. If starting over from scratch, I may pick a value of 20, which is midway between 16 and 24. Feel free to experiment on your own. The main point here is this:  all the values produce positive results and a wide range of values at the upper end of our scale generate very good results (high profit factor and high profit). This leads me to believe that this indicator is robust in signaling major market changes.

Testing Environment

I decided to test the strategy on the S&P cash index going back to 1960. The following assumptions were made:

  • Starting account size of  $100,000.
  • Dates tested are from 1960 through September 2015.
  • The number of shares traded will be based on volatility estimation and risking no more than $5,000 per trade.
  • Volatility is estimated with a three times 20-week 40 ATR calculation. This is done to normalize the amount of risk per trade.
  • The P&L is not accumulated to the starting equity.
  • There are no deductions for commissions and slippage.
  • No stops were used.

Results

Applying this to the S&P cash index we get the following overall results.

Results

Notice the short side loses money. I would guess this tells us over the life of the market, there is a strong up-side bias. I would also guess that since 2000 the short side probably produces a profit, but I did not test that idea. Below is the equity curve of the strategy.

2016-07-18 Weekly RSI EQ Curve

 

Here is what the strategy looks like when applied to the price chart over the past few years. You will also notice I painted the price bars based upon the RSI signal. Light blue price bars mean we are in a bull market and red price bars mean we are in a bear market. You can clearly see how the RSI indicator defines the financial bear market and reenters at the start of the new bull market in 2009.

WSI_Weekly_New_Bull_2009- Relative Strength Indicator

Using this indicator we come up with the following turning points for major bull and bear markets for the US indices. The blowup of the dot-com bubble happened in 2000 and we got out in November 11, 2000. The indicator then tells us to go long on June 7, 2003. We then ride this all the way up to the financial crisis getting out of the market on January 19, 2008. Then on August 15, 2009 we go long. A failed signal occurred in mid 2011. Overall, not too bad!

How Can This Indicator Help You?

Looking at these dates we see that they are fairly accurate in capturing the major bull and bear regimes of the US stock indices. How can this be used in your trading? Perhaps you can use this as a basis for a long-term swing strategy. Maybe this is an indicator to let you know when to go long or  liquidate your positions within your 401(k) and other retirement accounts. Or perhaps if you are a discretionary trader you can use this to focus on taking trades in the primary direction of the the indicator. Maybe when the RSI indicator signals a bull market you may want to view this as another confirmation or green-light to pursue whatever investment strategy you prefer. Anyway, I thought it was an interesting and novel way looking at the RSI indicator.

Of course we only have 32 signals over the past 53 years. This is hardly a representative sample if we are talking about statistics. However, given the robust nature of the lookback period and the rising equity curve since 1960 this indicator may be worth keeping an eye on.

Where Are We Now?

This indicator signaled a Bull Market at the starting on the week of July 18th, 2016. The previous Bear signal was on August 29, 2015. This bear signal locked in some nice gains but ultimately turned out to be a false signal. Below is a chart with the most recent history of this indicator.

Long-Term Trend

2016-07-18 Weekly RSI

Download

TradeStation 9.1 ELD (strategy,indicators,paintbar)
TradeStation 9.1 WorkSpace
Strategy Code as Text File

About the Author Jeff Swanson

Jeff is the founder of System Trader Success - an inBox magazine dedicated to sharing great ideas and concepts from the world of automated trading systems. Read More Google

follow me on:

Leave a Comment:

19 comments
Add Your Reply