I read about this indicator in an article titled "Roulette Wheels and Individual Stocks," which appeared in the December 2012 issue of Active Trader. The article was written by Richard J. Bauer, Jr. In the article, Bauer used an innovative approach to create a new type of market timing indicator based on the relative strength of an individual security versus a broad market index. The indicator shows promise as a market timing oscillator.

The Roulette Wheel (RW) Indicator

Unlike most oscillators derived from a single price series, the RW indicator is a percentile ranking based on all possible paths of holding one of two securities over a given number of periods. Bauer used five periods in his article and I will do the same. I will use this framework to evaluate the continuous future contract for the Russell 2000 index (TF). For comparison purposes, I will use the continuous futures contract for the S&P 500 index (ES) as a proxy for our broad market index.

In each period, the investor could either hold the security being evaluated (TF) or the broad market index used for comparison purposes (ES). One such possible path would be TF-ES-TF-ES-TF. There are 32 unique return paths over a 5-day period (2^5). The return from holding TF for the entire 5-day period would be derived from the sequence TF-TF-TF-TF-TF.

To determine the RW percentile value, calculate the total number of paths that underperformed the 5-day return for TF, then divide by the number of paths minus one. If the TF-TF-TF-TF-TF strategy beat all of the other return paths, the RW value would be 1.0 (31/31). If the 5-day TF return failed to beat any of the other return paths, the RW value would be 0.0 (0/31). When calculating the cumulative returns for each path, the author added the period returns, which did not capture the effects of compounding. Instead, I added the natural logs of the return series to incorporate compounding for all return paths.

RW in Practice

Bauer provided the historical indicator data for the article in a color-coded table. He termed the indicator the roulette wheel (RW) measure, based on the resemblance of the cells in the table to the numbered pockets on a roulette wheel. While his indicator is interesting, Bauer's tabular format makes it very difficult to understand the relationship between the indicator values and the price of the security.

To gain insight into the behavior of the RW indicator, I used AmiBroker to code the indicator algorithm and display the results graphically, immediately below the price chart of the individual security. This helped me understand how best to use the indicator in practice.

Figure 1 below contains three panes. The top panel is a weekly candlestick chart of TF. The monthly central pivot and two monthly pivot support (red) and resistance lines (green) are also included in this pane. The blue line in the second panel represents the weekly RW levels. The purple line is a 3-period moving average of the weekly RW line. The pink dashed line is a 13-period moving average of the RW line. Finally, the green and red horizontal lines represent extreme thresholds, which will be used to identify possible reversal or consolidation areas.

The blue line in the bottom pane is my custom COT indicator, which I have referenced in a number of past articles. I use this for confirmation in many of my strategies, but the indicator is only useful when the COT indicator reaches extreme levels and there is independent confirmation of a trend reversal. Again, the green and red lines represent extreme thresholds.

The bright red vertical rectangle on 9/21/2012 represents a textbook reversal signal. Since this article is about the RW indicator, let's begin with the second chart pane. On 9/21/2012 the RW indicator crossed below the 3-week moving average and both the RW indicator and the 3-period moving average were above the extreme threshold (0.95). Providing further support for the reversal trade, the 13-week RW moving average was also elevated (0.73) after an extended rally. Note, the extreme thresholds only apply to RW and the 3-period RW moving average. It would be very rare for the 13-period RW moving average to exceed 0.95.

No indicator should be used in isolation and the RW oscillator is no exception. Moving to the top panel, notice that the candlestick on 9/21/2012 is bumping up against the second or highest monthly resistance level (MR2). This is a very powerful resistance level, which adds a second level of confirmation for the reversal trade.

Finally, the COT indicator in the bottom panel was below the extreme threshold on 9/21/2012. The red histogram illustrates that the commercials were selling into the rally, which eventually made it impossible for the buyers to sustain the rally. The result was a very high probability reversal, confirmed by three separate indicators: RW, monthly pivot resistance, and COT.

Figure 1: Russell 2000 Futures (TF) - RW Oscillator

On the chart, I also highlighted an example of a marginal RW reversal signal on 7/21/2012 (dark red) that was not confirmed by the other indicators. Again, let's start with RW in the second pane. As was the case before, RW had just crossed below the 3-period moving average, but both RW and the 3-period moving average were below the extreme threshold, resulting in a weak signal. In addition, notice that the 13-period moving average (pink) was still climbing and had not even researched the neutral or 0.50 threshold. The RW crossover occurred in the early stage of the rally, which would not normally suggest a high-probability reversal.

In the top chart pane, the TF price was still well below MR1 and MR2 on 7/21/2012, which suggested no immediate resistance. The COT indicator in the bottom pane was approximately neutral, adding no support for the reversal trade.

Even though the RW oscillator shows promise, when other indicators fail to provide confirmation, reversal signals are less reliable and often lead to brief periods of consolidation - which is exactly what happened in this case. TF drifted slightly lower for the next two weeks, and then continued its ascent over the following two months.

AMIBroker Code

After publishing this article, a reader asked that I include the AMIBroker code for this indicator. I did not initially include the code because the image was difficult to read due to the nested loops. Unfortunately, copying and pasting the actual code corrupts the code, so the code image is currently the only viable option. I apologize if the code below is difficult to read. As always, the sample code is provided for educational purposes only.

Figure 2: RWRank5 AMIBroker Code

After publishing this article, another reader asked that I include the AMIBroker code to generate the monthly pivot support and resistance lines in the top panel in Figure 1 above. The sample code is now available in Figure 3 below. These pivot support and resistance levels have been used for many years by floor traders. They can be used in any time frame. The monthly pivot lines are particularly valuable for identifying meaningful areas of support and resistance.

Figure 3: Monthly PIVOT Levels AMIBroker Code

Conclusion

The RW algorithm requires a nested loop structure that is computationally intensive. The time required to complete the algorithm increases exponentially with the number of periods. In addition, it is not a trivial matter to handle a variable number of periods, which makes it more difficult to use in practice. The sample code above uses a fixed number of periods.

Nevertheless, the RW oscillator is a promising reversal indicator with a very unique approach. Short-term moving average crossovers can be used to enter trades, but only at extreme levels. Longer-term moving average levels should also be used to confirm the optimal environment for short-term reversal signals. RW signals should always be confirmed with other independent technical and/or fundamental tools and stops should always be used.

In addition to executing directional trades in the underlying security, it would also be worthwhile to consider high-probability OTM credit spreads for bullish reversals and diagonal or calendar spreads for bearish reversals.

Feedback

Your comments, feedback, and questions are always welcome and appreciated. Please use the comment section at the bottom of this page or send me an email.

Do you have any questions about the material? What topics would you like to see in the future?

Referrals

If you found the information on www.TraderEdge.Net helpful, please pass along the link to your friends and colleagues or share the link with your social or professional networks.

The "Share / Save" button below contains links to all major social and professional networks. If you do not see your network listed, use the down-arrow to access the entire list of networking sites.

Thank you for your support.

Brian Johnson

Copyright 2012 - Trading Insights, LLC - All Rights Reserved.

About Brian Johnson

I have been an investment professional for over 30 years. I worked as a fixed income portfolio manager, personally managing over $13 billion in assets for institutional clients. I was also the President of a financial consulting and software development firm, developing artificial intelligence based forecasting and risk management systems for institutional investment managers.
I am now a full-time proprietary trader in options, futures, stocks, and ETFs using both algorithmic and discretionary trading strategies.
In addition to my professional investment experience, I designed and taught courses in financial derivatives for both MBA and undergraduate business programs on a part-time basis for a number of years.

5 Responses to A Relative Strength Market Timing Oscillator

I did not post the code initially, because the code image was too difficult to read – due to the width of the lines resulting from the nested loop structure. Unfortunately, WordPress corrupts AMIBroker code when copying and pasting the code into posts and comments. As a result, a code image is currently the only viable option for including AMIBroker code in posts.

Per your request, I edited the original article and included a screenshot of the code from AMIBroker. It will be difficult to read, but you might find it helpful.

Thanks. As you requested, I provided the AMIBroker code to generate the monthly pivot support and resistance levels in the sample chart. I edited the original article and added an image of the AMIBroker code. This is the only method that I have found that does not corrupt AMIBroker code in WordPress.

Meta

Disclosure

Limitation of Liability

Under no circumstances, including but not limited to negligence, shall Brian Johnson and/or Trading Insights, LLC be liable to you for direct , indirect, incidental, consequential, special, punitive or exemplary damages. Please read the Disclaimer & Terms page in its entirety.