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.

Clone Algorithm
266
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 55a70fe46b05fa0c634b8d14
There was a runtime error.

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.

Clone Algorithm
266
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 55a7228ba8caa20c62310d4c
There was a runtime error.

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?