Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Sector Rotation ETF Strategy

I want to backtest sector rotation ETF Strategy as described here http://myetfhedgefund.com/strategies/sector-switch

UNIVERSE:
IDU (U.S. Utilities)
IYC (U.S. Consumer Services)
IYE (U.S. Energy Sector)
IYF (U.S. Financials)
IYH (U.S. Healthcare Sector)
IYJ (U.S. Industrial Sector)
IYK (U.S. Consumer Goods)
IYM (U.S. Basic Materials Sector)
IYW (U.S. Technology)
IYZ (U.S. Telecommunications)
TLT

ALGO:
- At the end of each month, RANK the 10 ETFs based on their 6-month returns.
- At the close of the 1st trading day of each month, BUY the Top 2 ETFs, except if they closed the previous month below their 6-month moving average. In such case, buy TLT (Long-Term Treasury Bonds) instead.

I donot know how to test sector rotation strategy. Do you have any idea?

8 responses

That looks pretty simple, a good project for starting out. Are you asking for someone to write that for you? I could do it when I get home tonight, unless someone beats me to it.

I am new to quantoption. It would be nice if you would be able to write that. I donot know where to start.

I don't mind writing it, but bear in mind you are unlikely to learn anything from my doing it!

Hi KORAY, thank you for sharing the link. Attached will help you kick start this strategy. Clone the algorithm and go through the code line by line and let us know if the logic is implemented appropriately. This will get you familiarized with Quantopian. Finally, backtest the algorithm in minute-resolution, and confirm the backtest performance is comparable to that presented in the referenced blog. Happy backtesting.
update1: removed unused code.
update2: updated logic of code.

I have modified the strategy to better match the performance from the referenced blog.
Leverage is now set to 2, slippage and commission are disabled. Note the horrible max draw down.

thanks a lot that is great.

Is someone able to run this with the newer algorithms if not time consuming? It has information which I wish to study for my first strategy to back test and modify...

What updates are needed to bring this algo up to speed with 2018 Q upgrades?