Consulting | Custom Trading Systems
Built-In Indicators | Custom Indicators

August 2012 Stocks and Commodities Traders Tips

Applying The Sector Rotation Model :

AIQ Version:

Original article by Giorgos Siligardos, PhD
AIQ Code by Richard Denning

Since the sector ETFs have limited price history, I searched for similar sector representations that would have more history. I found that there are S&P 500 Sector indexes that start 9/11/1989 and so have almost 23 years of history. In Table 1, I show the symbols for the sector representations for the three data services, DialData from Track Data, Yahoo from and PremiumData from Norgate. The first column of the table shows the ETF symbol. The second column shows the AIQALL (a group/sector list structure) sector symbols. One could code the sector rotation indicator using the program computed sectors as shown but the results will vary from user to user because the sector values depend on the stocks that are in the user’s database. Since I couldn’t find symbols for some of the sectors at DialData and Yahoo, I decided to use the sector indexes from Norgate (shown in bold in Table 1). AIQ can use data from any source by using the Data Transfer Utility to import the data from ascii text files. In the code file I provide, there is an input that allows you to switch between the ETF data symbols and the indexes (useIDX=0 for ETFs and useIDX=1 for indexes. Please note that I changed the Norgate symbols upon import to remove the “$” as I wasn’t sure this symbol would be allowed as a ticker symbol. So the symbol from Norgate “$SPXA” is changed to “SPXA”, etc. I have also provided extra code for the other sectors that are not used by the author in case you want to try using different sector combinations in the Bull-Bear indicator

Since the author does not provide a mechanical trading system that uses the indicator, I devised one that uses two moving averages of the Bull-Bear indicator, one set at 50 bars and the other set at 200 bars. Entries to go long occur when the fast average crosses over the slower average. I exit on cross downs or whenever the SPX 50 bar average is lower than it was 10 bars ago. Since this is mainly a market timing devise, I then tried trading the NASDAQ 100 list of stocks using the Portfolio Manager for the period 1/1/1992 to 6/12/2012. The following capitalization settings were used:

  • Maximum of 10 open positions
  • Size each position at 10% of mark-to-market total capital
  • Take no more than 10 new positions per day
  • Compute the mark-to-market capital each day
  • Choose signals based on a relative strength indicator for ranking in descending order for longs (long only system)
The resulting equity curve is shown in Figure 1 which is compared to the NASDAQ 100 index (NDX). With these settings, the internal rate of return averaged 7.9% with a maximum drawdown of 22.4% on 11/20/1995.

Figure 1 – Equity curve for my test system that uses the Bull-Bear Indicator for market timing for the period 1/1/1992 to 6/12/2012. NASDAQ 100 stocks were traded on each buy signal.

EDS Code:
Sector Rotation.EDS
(right click and choose Save As)


Traders Studio Version :

Original article by Giorgos Siligardos, PhD
Traders Studio Code by Richard Denning

The TradersStudio code for Giorgos E. Siligardos’s article , “Applying The Sector Rotation Model”, is provided at the web sites noted below. The following code files are provided in the download from the websites:

  • Indicator Plot: “BULL_BEAR_IND” for displaying the Bull Bear Oscillator (BBO) indicator on a price chart
  • Function: “BULL_BEAR_OSC” for computing the BBO values
  • System: “MKT_TM_SR” for back-testing a system I created that uses the BBO for market timing

Although the author designed this system to trade ETFs, I wanted to test it on other markets since there is such limited data for ETFs and the author’s tests would all be considered “in-sample” tests. I found that the S&P 500 Sector indexes have data back to 9/11/1989 which allows us almost 23 years of data to use. Also there are ten sectors of which four tend to outperform during bear markets and six that tend to outperform during bull markets as follows:






S&P 500 Health Care Sector



S&P 500 Consumer Staples Sector



S&P 500 Utilities Sector



S&P 500 Energy Sector



S&P 500 Consumer Discretionary Sector



S&P 500 Financials Sector



S&P 500 Industrials Sector



S&P 500 Telecommunication Services Sector



S&P 500 Materials Sector



S&P 500 Information Technology Sector


The symbols are from Premium Data by Norgate. The system code and the indicator code have 196 types which represent up to four bull and four bear sector rates of change that are fed into the BULL_BEAR_OSC function to get the values for that combination. With all these coded, it is possible to do an optimization on the sector combinations that work best for timing the market by changing the “Type” parameter. Using the simple market timing system which buys the SPX index when the BBO average is higher than it was one bar ago and sells the SPX index when it is lower than it was one bar ago, and optimizing, I found that one of the better combinations was type 175 which uses Consumer Discretionary alone for the bullish sector and a three sector combination of Health Care, Consumer Staples and Utilities for the bearish sectors. Figure 1, shows equity curve and Figure 2 shows the underwater equity curve using parameters:




Figure 3 shows how the data must be set up in TradersStudio to work properly with the code file.

Figure 1 – Equity curve for optimized combination trading 100 shares of the SPX from 1990 to 2012
Figure 2 – Underwater equity curve for optimized combination trading 100 shares of the SPX from 1990 to 2012
Figure 3 – Data series set up for TradersStudio with S&P 500 sector indexes

Traders Studio Code:
(right click and choose Save As)














Disclaimer | Privacy Policy | Contact Us | Spam Blocker | ©2009 Traders Edge Systems