SPY: Usage of adaptive sector rotation model to improve returns

For a long time I’ve been intrigued by the idea of looking at specific sectors of the economy when predicting next day SPY move. Looking at sectors makes a lot of sense to me.  Sectors carry specific information of how the economy is doing and what kind of positions large investors are favoring. Defensive sectors such as utilities (XLU)  or healthcare (XLV)  show strength in weak markets. Whereas consumer discretionary (XLY) do better in up markets. That’s at least the conventional wisdom.  So if it’s that easy why not simply code that into the setup: go long when XLY is doing well and short when XLU is showing strength?

See this picture from John Murphy / stockcharts.com: that’s been my inspiration for this work. I do believe in the fundamental ideas captured in this chart. However, the main problem is that I’m not an economist and I don’t do fundamental analysis. So I need a model that’s going to capture the idea of this picture.

This is my third attempt to include sector information in my SPY trading. In the past I looked at a couple of different ways (link). The main issue with my past approaches:  sector relevancy changes during the economic cycle. So depending where we are in the cycle a different sector might lead the market one way or the other.


Let me set the baseline first: I’m going to use this to improve my mean reversion trading. My mean reversion Indicator of choice is DVO from David Varadi at CSS Analytics (an excellent indicator!). So let’s look at next day returns while DVO is below 0.5

The data used for this test is from Yahoo and adjusted for cash dividends. The trade are close to close. The statistic is showing next day returns only.


This time I want to do it smarter:   smarter means adaptive and flexible.  I don’t want to build any kind of bias into the algo. The idea is to have a list of nine different time series (sector ETFs) and let the algo pick the one that has the highest predictive value at a given time.  The ETF’s are ranked based on their historical performance forecasting volatility adjusted next day SPY returns.  The result of the calculation is adjusted with the short-term momentum of the historical performance. So a SPY trade will only be taken when the leading sector and the SPY match.

There is a ~10% improvement in avg.(%) next day returns with an increased Sharpe Ratio. The effect has been consistent over the years. I also did the reverse test, picking the worst sector. In this case the performance dropped as expected.

The leading sectors from mid November to mid December has been XLP / consumer staples. Followed by XLY / consumer discretionary to mid January and now it’s XLK / technology.


Finally the bricks fit together, avoided any kind of bias while taking an adaptive approach for selecting the relevant sector ETF.  After having done this piece of research I’m going to look how to include this into my SPY based mean reversion system. At this point I’m not sure if it will be part of the entry setup or money management only. That will probably make another post.

About these ads


  1. Hi Frank,
    Could you please clarify what you mean with:
    “The result of the calculation is adjusted with the short-term momentum of the historical performance.”

  2. tony holland says:

    great work.

  3. Hi Frank,

    Did you consider putting your bet on the leading sector ETF rather than the SPY? Maybe the high momentum of the leading sector increases the predictability of its next day returns.

    As for the two results you posted, they seem to be very close. Would you say the difference in performance is statistically significant? It seems to me that it may be contributed to random effects.

    I’m a fan of your work. Keep posting!


    • Hello Berker,

      Thanks for sharing your thoughts. I tend to believe that this isn’t the result of pure “luck” / incidents. Sharpe Ratio improved and the number of positive Month improved as well = consistency. If I add another ETF: QQQQ, the model get’s even better. However, I’m not fully done with my research. It will be interesting to see if this piece of research can actually improve my existing trading system.

      No, didn’t consider trading the sector ETF as I want to trade SPY only (at least for mean reversion).


  4. i am a new to amibroker…this looks like an interesting theory can you please post some ami code for this
    calculation. did you plan on adding some filter criterio to avoid downtrending market.

    • Hello Bill,

      I don’t plan to post the code this time.

      This is just a study to show the validity of the concept. This alone isn’t a trading system.

      My trading system has market filters.


  5. Hi Frank,

    Great site! I’m sorry if this has been asked before, but what software are you using to generate the performance reports?


  6. Hi Frank,
    This looks very good. Are you taking both long and short trades or long only? Also what is the % exposure to the market?



  7. Hi Terry,

    this is long only… don’t have the exposure at hand currently…

    All the best,


  8. What program do you use to back test and evaluat performance?

  9. Hi Frank – great post. I see that the DVO is one of your favorite indicators. How similar is DVO to DVI? Both are intermediate oscillators and it seems David has produced a lot of indicators over a short time so its easy to become confused. If both indicators are different what information does the DVO provide that the DVI does not in the context of say this particular strategy. Appreciate the feedback.

    • Hello PortfolioLabs,

      thanks for the feedback. DVO is a short-term indicators much like RSI(2), but considering highs/lows and self-adapting to some degree. DVI is an intermediate-term indicators showing overbought/oversold zones.


  10. David Hall says:

    Hi Frank,

    I just found your website now, some really interesting trading ideas! I am new to coding however, do you recommend any books to get started?


    • Hello David,

      AmiBroker isn’t all to difficult to learn. However, without any background in software development it might be take a little longer.

      Unfortunately I can’t recommend any specific books as it’s been quite some time since I learned it.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 306 other followers

%d bloggers like this: