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:
- SMA(200)
- Rate of Change (ROC)
- Smoothed Adaptive Momentum
- 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:
- SMA: Bull market when price is above the SMA
- ROC: Bull market when indicator value is above zero
- Smoothed Adaptive Momentum: Bull market when indicator value is above zero
- 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 | SMA | rsRank | ROC | |
---|---|---|---|---|
Net Profit | $43,264 | $56,070 | $76,353 | $114,732 |
Profit Factor | 1.78 | 3.26 | 4.56 | 12.52 |
Total Traders | 125 | 72 | 48 | 25 |
%Winners | 42% | 34% | 44% | 48% |
Avg.Trade Net Profit | $346 | $779 | $1,591 | $4589 |
Consecutive Losers | 6 | 9 | 6 | 5 |
Annual Rate of Return | 3.25% | 3.92% | 4.83% | 6.21% |
Total Return | 87% | 112% | 153% | 229% |
Buy&Hold Total Return | 260% | 260% | 260% | 260% |
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
rsRank | JE Adaptive | ROC | SMA | |
---|---|---|---|---|
Net Profit | $13,147 | $14,064 | $16,562 | $19,960 |
Profit Factor | 1.75 | 1.38 | 3.90 | 2.4 |
Total Traders | 33 | 80 | 17 | 43 |
%Winners | 45% | 45% | 53% | 42% |
Avg.Trade Net Profit | $398 | $176 | $974 | $464 |
Consecutive Losers | 4 | 6 | 2 | 5 |
Annual Rate of Return | 1.84% | 1.96% | 2.26% | 2.65% |
Total Return | 26% | 28% | 33% | 40% |
Buy&Hold Total Return | 18% | 18% | 18% | 18% |
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.
Conclusions
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
Downloads
[TradeStation ELD][9] – All the code used for this study is available in a single TradeStation download file. [TradeStation WorkSpace][10] Strategy Code As TextFile[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”
The post Testing Market Regime Indicators appeared first on System Trader Success.