Testing Market Regime Indicators

Often when designing a system it’s important to keep the big picture in mind. What is the overall market doing? The most simple way to accomplish this is to break the market into two regimes: bullish and bearish. We are all aware that price action is a mirror of human psychology of market participants, therefore price action can often be very different between these two regimes. Sudden market plunges that we see within strong bear markets, such as in 2008, behave much differently when contrasted to the continual grinding, upward market we saw after 2009. People behave differently under fear (how low can it go) and pain (look at all the money I lost) vs. doubt (this market can’t go higher) and greed (I’ll just make a bit more before I exit). Since people behave differently under these two market regimes it makes sense that we should design trading systems that take advantage of the different market characteristics for each regime. We want to build a system that dynamically adjusts its trading parameters based upon which market mode we’re experiencing. To do this we can use any number of indicators.

The Indicators

The most simple way to divide the market is to use a 200-period simple moving average (SMA). When price is above it we are in a bull market regime. When price is below it we are in a bear market regime. Introducing this simple concept along can improve the performance of many trading systems. I’ve personally used this technique many times. Yet there are other techniques to divide a market and some of these might produce better results than our old reliable 200-day SMA. In this article I want to take a look at a few different methods.

The indicators we are going to test are:

  1. SMA(200)
  2. Rate of Change (ROC)
  3. Smoothed Adaptive Momentum
  4. Relative Strength Ranking (rsRank)

The Smoothed Adaptive Momentum and Relative Strength Ranking are two indicators you may not be aware of. First, the Smoothed Adaptive Momentum was created by John Ehlers. It’s a complex indicator and there’s more than I want to get into during this article. Google it if you wish and you can also find the EasyLanguage code here. As for the RS Rank, you can find a little more about it here. I will say this about the rsRank for now, traditionally it’s used as a ranking tool to compare a group of stocks or ETFs to determine which specific instrument is performing best. As its name implies, it ranks each instrument based on how well the instrument has been performing. You can then compare this score to the other stocks or ETFs in your basket of trading instruments. Thus, you can simply pick the instrument with the highest rsRank score when creating a momentum-based trading system. In this article I’m using it for a completely different purpose and I was curious on how well it would hold up.

Smoothing The Indicators

All of these indicators are also smoothed to help reduce whipsaw. Of course the SMA is a smoothed price indicator so no modification was made to this indicator. Likewise the Smoothed Adaptive Momentum indicator by John Ehlers also contains a smoothing element already applied to the indicator. However, to smoothen the ROC and rsRank indicator I used the same technique found within the Ehlers indicator. It looks like this for the rsRank indicator:

rsRankSmoothed = ( rsRankValue + rsRankValue[1]<em>2 + rsRankValue[2]</em>2 + rsRankValue[3] )/6;

The same smoothing technique is applied to ROC as well.

Look-Back Period

We are going to use a 200-day period for all our examples. The 200 days represent about ten months of trading if you figure out that there are about 20 trading days per month. It’s also a common longer term period applied to moving averages as well. This is not a magic number by any means. It’s a large enough number that we should not see the regime switch too often between bear and bull. The idea is to capture the long term market mode, not every market gyration. Of course I encourage you to perform your own testing as well.

The Strategy Logic

The strategy code to test the effectiveness of these different indicators is rather simple. We are only going long during a bull market regime and closing our position when that bull market regime switches to a bear market regime. In essence we are creating a very simple trend following system. For each indicator the transition is based upon:

  1. SMA: Bull market when price is above the SMA
  2. ROC: Bull market when indicator value is above zero
  3. Smoothed Adaptive Momentum: Bull market when indicator value is above zero
  4. RS Ranking: Bull market when indicator value is above zero

Here is an example of the rsRank indicator used as a regime filter:

4 Long position opened when rsRank crosses above zero. Positions sold when rsRank crosses below zero.

Trading Environment

I coded the above rules in EasyLanguage and tested it on the SPY ETF market going back to 1993. All the tests within this article are going to use the following assumptions:

  •  Starting account size of  $50,000.
  •  Dates tested are from 1983 through June 14, 2013.
  •  The number of shares traded will be based on volatility estimation and risking no more than $2,000 per trade.
  •  Volatility is estimated with a three times 10-day 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.
  •  A hard stop of $2,000 is placed for all trades.

SPY Results Since 1993

The following results are organized left-to-right by total return. We can see the ROC indicator has produced the best total return over the life of the study. It also produced the fewest trades and the highest number of winning trades. In a more distant second place is the rsRank indicator.

Regime Testing Indicators on SPY Since 1993

JE Adaptive




Net Profit





Profit Factor





Total Traders










Avg.Trade Net Profit





Consecutive Losers





Annual Rate of Return





Total Return





Buy&Hold Total Return





Notice the last row is the buy-and-hold results. None of the “systems” come close to B&H but please keep in mind these are not trading systems. We are testing indicators to see how they compare against one another in the task of picking out bull market regimes.

SPY Results Since 2000

When looking at the equity graph of the systems it becomes apparent that much of the gain occurred during the tech boom of the late 1990’s. Since that crash, the market has behaved much differently. So I also tested the same set of indicators on the years after 2000. Those results are below:

Regime Testing Indicators on SPY Since 2000


JE Adaptive



Net Profit





Profit Factor





Total Traders










Avg.Trade Net Profit





Consecutive Losers





Annual Rate of Return





Total Return





Buy&Hold Total Return





Once again the results are organized left-to-right by total return. Our ROC rank has fallen to second place while SMA has moved  into our number one position generating the highest return, but at what cost? We can see ROC continues to excel in terms of profit factor, the number of winning trades and reducing the number of trades. It holds up well on a number of factors that I like.


Based on these limited tests ROC shows superior results when determining a bull market from a bear market. In summary, put this to use in your own efforts at building a trading system. Use an indicator to determine the market mode and trade accordingly. The point here is to have your automated trading system automatically adapt to a changing market. For example, when the market is bullish you may want to look for longs only while ignoring shorting opportunities. Or if the market is within a bearish mode the criteria for entering a long position might be stricter than when in a bull market. Too often people simply trade the same setup or method during different market conditions. By breaking the market up into two regimes, you are making your trading system dynamic and adaptive to the changing market.

There are ways to segment a market further. Check out these articles as well.

Two Dimensional Market Filter A Better Regime Filter To Boost Returns


[TradeStation ELD][9] – All the code used for this study is available in a single TradeStation download file. [TradeStation WorkSpace][10] Strategy Code As Text

File[9]: http://www.systemtradersuccess.com/downloads/free/MARKET REGIME_TESTING_STRATEGY.ELD “TradeStation ELD”
[10]: http://www.systemtradersuccess.com/downloads/free/Market Regime_Testing_2000.tsw “TradeStation WorkSpace”

About the Author Jeff Swanson

Jeff is the founder of System Trader Success - a website and mission to empowering the retail trader with the proper knowledge and tools to become a profitable trader the world of quantitative/automated trading.

follow me on:
  • Mike S. says:

    Thanks for the great article. Can you go into more detail about how you use the RS Ranking Method as a trend indicator? I think I understand how it works as a means of comparing different markets, but not in terms of determining whether a market is in a bull trend or bear trend.

    Thanks again!

  • Yes, I’ll work on something to help clarify. Glad you found the article helpful.

  • […] classify Bull and Bear Regimes I used the RSRank Indicator described by Jeff Swanson in this post at System Trader […]

  • […] classify Bull and Bear Regimes I used the RSRank Indicator described by Jeff Swanson in this post at System Trader […]

  • Mark says:

    Why are the Sharpe ratios so low?

  • Francisco says:

    Jeff, I cannot load the ELD onto Tradestation. ¿Is there anything wrong? ¿Maybe is an old version?

    • Looks like there was a problem with the download file. I just uploaded it again. Please try the new file and let me know if you still have problems.

  • AnTZ_TK says:

    Hi Jeff,

    have you ever considered the importance of sample size? You draw conclusion based on samples as small as 17 (for ROC).

    Imagine what a difference just one more sample may have on your results! Now imagine it’s an outlier (i.e., 2 standard deviations away from the mean)!!!

    • Of course sample size is important, but the topic for this article was not sample size. It was ideas on creating and testing a simple regime filter to divide the market into a bullish and bearish mode. The ROC has a sample size of 25. The “since-2000” graph is a zoomed in view of the last 12.5 years. In short, I’m explaining a concept in this article and I encourage everyone to do their own testing. Thanks for the comment.

      • AnTZ_TK says:

        Hi Jeff,

        I understand and appreciate what you were trying to demonstrate.

        What I wanted to point out to you was that it might be better to do it in a “scientifically sound” way. Otherwise beginners may believe it’s OK to work with such small samples and knowledgeable people may think you don’t know better and ignore you.

        Cheers! 🙂

  • […] Testing Market Regime Indicators […]

  • vimal says:

    Hi Jeff. Good article. i am loading the indicators and eld but am getting a message that the ROC , je and rs smoothed indicators have been deleted. why would this be? also have you tested the ultimate oscillator? it seems to do a reasonable job overall in terms of determining the trend.

  • […] your trading systems to the changing market conditions. In a previous article entitled, “Trend Testing Indicators“, I tested several indicators that could be used to divide the market into two modes: bullish […]

  • Peter B says:

    Thanks Jeff, for another interesting article. Would you please explain why you use a non-uniform weighting in your smoothing. I assumed you would have used a simple average. Were you intending to build in some lag to weight the previous values more – to act as hysteresis?

    • You’re welcome Peter. The formula used is from John Ehlers and is a finite impulse response (FIR) low-pass filter. That’s a lot of words to smooth data. Lots of his material is from signal processing. You can read a bit more here.

  • […] in the conventional sense as using something such as the SMA200, ROC200 > 0, or RS Rank (see this post from […]

  • Jesse says:

    Hi Jeff,

    Do you know where I can find a simple strategy based on momentum (Price ROC). similar to the ROC calculated above that says go long/short when the momentum is greater than X over X amount of calculated periods?

    • Hey Jesse. Sorry, I’m not familiar with an available strategy that fits your description.

  • >