Sector trading using the 200-day moving average

A user commented on ETF Sector Rotation post about a simple idea for trading the sector ETFs, which I can’t believe I have never tried. I like keeping things simple just like my Brazilian Jiu-Jitsu game.

Rules

If the Select Sector SPDR ETF (XLY, XLP, XLF, XLE, XLV, XLI, XLB, XLK, XLU) is above its 200-day moving average for the last 5 days, then buy 10% of that ETF. If it is below the 200-day moving average for the last 5 days, then sell it and allocate to IEF, iShares 7-10 Year Treasury Bond. Simple, I like it!

If all ETFs are above their MA200s, then you will be invested 10% in IEF. If two are below their MA200s, then you would be invested 30% in IEF.

This differs slightly from the original rules where he said to use the 40-week moving average, but I prefer the 200 and using 5 days above/below which makes it close to that. This is close to my current favorite method of trading the MA200, which uses 10 days and I will show.

A note about why I am not using XLRE. Since 1999 these sector ETFs only consisted of nine ETFs. In late 2015, they did a revamp and added XLRE. To test farther back, I tested without it.

Baseline

Test dates will be from 4/1/2009 to 6/30/2017 (bull market only) and 1/1/2007 to 6/30/2017 (bear and bull markets).

For strategies like this, they will probably underperform during bull markets, 2009 to 2017. But they make it up during bear markets. I will use two baseline strategies. The first is buy and hold of the SPY. The second is my new favorite way of trading the MA200. Buy the SPY when it is above the 200-day MA for 10 or more days. Sell the SPY when it is below the 200-day MA for 10 or more days. This new method has a lot less trades and whipsaws when compared to trading the 200-day MA cross.

Bull Market Results

Buy and Hold greatly outperformed everything as expected. If you trade these type of strategies, you must remember that during this time you will likely underperform. But comparing this sector strategy to my SPY strategy baseline it compares well. With CARs about the same but with a lower drawdown.

 

Bull & Bear Market Results

Now we can see why one would trade these types of strategies. Even though the CAR is only slightly better, the drawdowns are much smaller. But can you hold during bull markets and the underperformance then? I have a similar strategy I trade and I must remind myself during these last few years of underperformance that this is why I trade the strategy. For the bear market survival and my sanity.

Spreadsheet

Fill the form below to get the spreadsheet to see the results of using different moving average lengths, the number of days above/below and lots more stats.

One surprise from all this is that using the 200 day moving average gave the best results.

Final Thoughts

This simple idea gave some good results. The question to ask yourself is all the extra work involved in trading the Sector MA200 with 10 Day strategy that much better than the SPY MA200 with 10 Day baseline? The trade difference is 6 vs 61 over the 10.5 years. Probably not for me.

Another test to try out would be instead of allocating 10% to each ETF, doing 11%. This should give a bump in CAR. I would try and to incorporate XLRE also into the test. What about a different ETF instead of IEF. Good potential here.

 

See Part 2 here where I test reader’s ideas, Sector trading using the 200-day moving average – Part 2.

Another post in the series: ETF Sector Trading: The effect of daily, weekly and monthly timeframes.

Backtesting platform used: AmiBroker. Data provider: Norgate Data (referral link)

Good quant trading,

Fill in for free spreadsheet:

spreadsheeticon

 
Visited 18 times, 1 visit(s) today

Click Here to Leave a Comment Below

Hans van der Helm - August 2, 2017 Reply

Dear Cesar,

Great post!

Is it possible to share the Amibroker-code of this strategy?

Kind regards,

Hans van der Helm

    Cesar Alvarez - August 3, 2017 Reply

    Sorry but I don’t generally share code.

dw - August 2, 2017 Reply

Hi Cesar,

are you willing to share the afl code file, so i can use that as a template for further idea’s

Kind regards,
Dennis Wets
The Netherlands

    Cesar Alvarez - August 3, 2017 Reply

    Sorry but I don’t generally share code.

Durga - August 7, 2017 Reply

Hi Cesar –
As usual insightful post from you. Thanks. Few comments –

(a) While both systems (i.e., MA200 10Day, Sector MA200 10Day) have similar returns, I wonder what is the correlation of their returns. From the above table, it seems less. That could be useful?

(b) Curious what the returns would be for “MA200 10Day” if you were to invest in IEF instead of Cash on sell signal for SPY.

Finally, I recently started using Amibroker for my trading. I am a professional developer albeit in Python & Java land. I don’t need code but I wonder if you can tell me how you are able to do pair switch between Sector ETFs & IEF. My guess is you might be using Amibroker rotation approach but not sure how you could increase the IEF allocation in the switch part.

Regards,
Durga

    Cesar Alvarez - August 8, 2017 Reply

    (a) The correlation between what? MA200 10Day vs Sector MA200 10Day?
    (b) I will likely be doing another post on this with reader’s suggestions. I will add this to the list of what to test.

    Do you have any other ideas you would like to see me test?

    I did all the coding in the low-level CBT in AmiBroker. This gives me full control of everything.

    Cesar

Kuba - October 23, 2017 Reply

Hi Ceasar,

this is great and insightful post. May I ask you… could you please calculate correlation between mentioned sector MA200 strategy and holding SPY? I am just curious how tight is that system correlated.

I appreciate your help!

    Cesar Alvarez - October 23, 2017 Reply

    The correlation is about .70 with SP-500 index so it should be about the same with the SPY.

Leave a Reply: