July 3

27 comments

Capture The Big Moves! (Updated 2023)

By Jeff Swanson

July 3, 2023

automated trading, EasyLanguage, filter, indicator, Migrated, Trend Following, Video

Wouldn’t it be great to have an indicator that will help tell you when you 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 appeared in the January 2011 issue of Technical Analysis of Stocks and Commodities.

How It Works

We will 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 of 40.

On the other hand, during a bear market, the RSI rarely rises above the value of 60. Thus, when the RSI crosses these thresholds, you can determine the beginning and end of bull/bear markets.

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.

With these simple rules, you can determine bull and bear markets for the S&P cash index market.

  • Bull Markets RSI Often Above 60
  • Bear Markets RSI Often Below 40

The two images below display a weekly chart. Below the price is a second pane with a 12-period RSI. Why a 12-period RSI? I 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 1990s.

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.

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.

Testing Lookback Periods

I’m curious to see how well this strategy holds up over various lookback periods. A strategy should be robust enough to produce solid results over different lookback periods. To test this aspect of the strategy, I will 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).

Lookback Period vs Net Profit

The above chart shows rising profit as the lookback period increased from 2 to 10. Then the growth slows down. You can make a case for a stable region between 9 and 24; the midpoint is about 16. Feel free to experiment on your own and pick a different value. 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 excellent results. This makes me believe that this indicator is robust in signaling significant 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 August 2020.
  • 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.

CaptureBigMovesPerformance_2022_06_13

Capture Big Moves Performance 2022-06-13

Notice the short side loses money. I would guess this tells us over the life of the market, there is a strong upside bias. Below is the equity curve.

Capture Big Moves EQ Graph 2022-06-13

Capture Big Moves EQ Graph 2022-06-13

Using this indicator, we come up with the following turning points for significant bull and bear markets for the US indices. The blowup of the dot-com bubble happened in 2000, and we got out on October 14, 2000. The indicator then told us to go long on May 10, 2003. We then ride this all the way up to the financial crisis getting out of the market on January 12, 2008. Then on June 15, 2009, we went long. Overall, not too bad!

Does It Work Today?

Here is what the strategy looks like when applied to the price chart over the past few years. I also painted the price bars based on the RSI signal. Light blue price bars mean we are in a bull market, and red price bars represent a bear market.

Capture The Big Moves Recent Current Signal 2023-06-29

Capture The Big Moves Recent Current Signal 2023-06-29

The price action of 2019 and 2020 (Covid-19 Event) saw a sharp selloff, resulting in this indicator reacting slowly from a Bull-to-Bear transition. So, this strategy lost money on the long side and short side. Classic whipsaw behavior.

Will these sudden sell-offs and sharp rebounds continue into the future? I really don't know. But let's look at the most recent sell signal in 2022.

Sell Signal March 5, 2022

This signal resulted in booking a profit from the long trade. At the time of this writing in June of 2022, this looks like a reasonable exit point if the market continues to fall over the coming months. But we don't know what will happen at this point.

Buy Signal June 16, 2023

This signal resultsed in a loss on the short side. The downturn in the market which triggered and sell signal that started on March 5, 2022 turned out to be rather shallow.

Capture The Big Moves Recent Signals 2023-06-29

Capture The Big Moves Recent Signals 2023-06-29

How can this be used in your trading?

Perhaps you can use this as a basis for a long-term swing strategy. For example, maybe this is an indicator to let you know when to go long or liquidate your long positions within your 401(k) and other retirement accounts.

Keep in mind that short trades are not profitable. In my opinion, you're better off stepping aside during these short times. That is, close long positions and move to cash without attempting to short. Nothing wrong with being on the sidelines.

The strength of such a system is not in how much money you can make compared to buying and holding. The strength is avoiding drawdowns and providing a mechanism to start buying back into the market, so you don't miss the next bull market.

Or perhaps if you are a discretionary trader, you can use this to focus on taking trades in the primary direction of 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. I thought it was an exciting and novel way to look at the RSI indicator.

Of course, we only have 59 signals since 1960. 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?


Bull Market Signal Since June 16, 2023


Recent market behavior as we go into the Summer of 2023 is signaling Bull Market. The signal was triggered on the week of June 16, 2023What do you think? Is a new bull marketing forming? Will it last?


Jeff Swanson

About the author

Jeff has built and traded automated trading systems for the futures markets since 2008. He is the creator of the online courses System Development Master Class and Alpha Compass. Jeff is also the founder of EasyLanguage Mastery - a website and mission to empower the EasyLanguage trader with the proper knowledge and tools to become a profitable trader.

  • Nice Job, you have a typo..

    “In the image below you will see the RSI signal stays above the 60 level during the strong bear market of the financial crisis of 2007-2009”

    The word “above” should be “below” ??

    Thanks,

    Red

  • Interesting article ! I tested this indicator on my weekly spy-chart. and i just wanted to mention that the signals look exactly like those generated by the TSI (true strength index, Close, 25,13). i.e. the weekly TSI also seems to be a great tool for discrimination between bear and bull markets, but obviously not as a stand-alone trading tool since it is a lagging indicator. i think it might work well with daily rsi(2)-signals in a pullback or mean-reversion system.

    greetings from germany !

  • Thank you, Jeff. A follow-up question, if you don’t mind. Is there a way to estimate either the CAGR or the annualized return of this strategy?

    Again, many thanks for all your great ideas.

    Alex

  • I guess that I meant a more apples to apples figure (i.e., compared to other strategies), that is, based on the assumption that 100% of one’s capital were invested using its signals.

  • A variant of this strategy(system) called RSI rollercoaster, can also be profitable.. What are your views on that system?

      • I’m not overly familiar with RSI roller-coaster but briefly looking at it there are some similarities but they are completely different in scope and intent. The Weekly RSI is not a trading strategy exactly. It’s a longer term Bullish/Bearish trend indicator. It looks like the roller-coaster is more of a mean reverting trading system with stops and profit targets. Weekly RSI does not have stops or targets. Weekly RSI is more of an indicator, not a trading system. Of course you could turn it into a long-term trading system, if you wish. In the end, Weekly RSI displays major market moves which can last years. It’s a trend indicator which could be used as the basis for a long term trend following strategy. RSI Roller-coaster highlights medium term counter trend movies which might last weeks. It’s a counter trend strategy. So, there are significant differences between them.

  • Thanks Jeff, just came across this website and loving it. Is it possible to run the backtest being 100% fully invested during Bull Mode and in 100% during Bear mode. Would love to see returns compared to S&P. This may be a great system for 401k.
    Thanks again.

  • Ok,

    I’ve been messing around with this formula and also using the RSI(2) on the daily. What I have determined and found is there is a flaw in backtesting using a a “fixed” number of contracts. The good news, the end result should be much better. I tested using 1000 shares buy and hold on MSFT going back to 1984. I made $57,000. Seemed wrong for a stock that went up so much. What I found, since the starting price was $0.1, I only started with $100 worth of shares for $100,000 account.

  • This is a very interesting idea. And I really appreciate Jeff and what he does on his site! His research and development methodology is excellent!

    However, if you use $INDU with this strategy going back 119 years, you’ll see there are very long periods of time that this is not useful AT ALL. The 1966 to 1982 period is particularly awful! The fundamental flaw in so many strategies is the age old, and incredibly outmoded, “lookback” period.

    All my work is based on some new fundamentals:

    * No Tradestation function calls. They are cost is prohibitive.
    * It’s about THE LEVELS. There is no idea more important than this. Buy near support in uptrends and cycles. Sell near resistance in downtrends and cycles. Unless you use the “traditional” tools to discern support and resistance accurately, your strategies are destined to fail under different circumstances. A strategy that eventually fails or goes flat as the circumstances change is a flawed strategy (i.e. 1966 to 1982 in the above example). You may not have lost much money during that period, but would you be able to SIT through it the whole time? Of course not.
    * Minimal, if any, “lookback” periods. I use cumulative and “break” processing. Moving average “lengths” are accumulated, and reset at appropriate times. As price “breaks”, levels are trailed up or down with a possible reset of the MAs (and I use VERY few MAs, as they are LAGGARDS! – IT’S ABOUT THE LEVELS!!!! ).

    System Trading is like magic. The old hands will only show you enough to get you started, and it’s all OLD. You’ve GOT to break new ground, because they aren’t going to show you stuff the works CURRENTLY! Why would they share that? It’s proprietary! And you better believe they are willing to SELL it to you! 🙂

    Andy Shaffer

    • Thanks for the great comments, Andy. A couple of points. While the strategy may not work well from 1966 to 1982, that is not much concern for me since I can only trade today. So I’m much more concerned about “lately”. While it’s true the longer the history, the more confidence I have, today is what matters. Next, I would not call the strategy presented a trading model. It’s more of an indicator to help gauge the overall market direction. Anyway, thanks again for the comments about your trading style and levels.

    • That’s a good idea. I’ll put that down as an idea for a future idea for another article. Until then remember, the code is available to download and test as you please. 🙂

  • Thank you for sharing this idea. I had been tinkering around with this weekly RSI strategy to use it when to go long with the daily RS(2) strategy. I realized it works pretty well when to be long the market and when to stay out of trying to get into long positions.

    I was curious though if your back-testing software allows you to optimize the buy/sell threshold levels of 40 and 60?
    Thank you again!

  • Jeff,

    Always appreciate your articles. Been recently reading Billy Williams’ book, “Trading Chaos”, 1995. Point of book, can’t use linear models to interrupt non-linear systems. The use of fractals are a better approach.

    Quote from book, pg. 134:

    “The early 1980s produced the $3,000 black box systems, RSI, stochastics, sentiment indexes, and so on. Then Trade Station and other program developers made back testing and curve fitting a fun project for new traders. Mechanical systems were the rage — popular but not profitable.”

    “Parametric statistics are not appropriate to examine nonlinear behavior.”

    Whether or not one accepts Mr. Williams ideas is another matter but, it does provide food for thought.

    Red

  • {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

    Learn To Code & Build Strategies
    Using EasyLanguage. 

    >