DEV Community

quantstrat
quantstrat

Posted on Edited on Originally published at quantstr.at

Sector momentum rotation: replicating section 4.1 of 151 Trading Strategies in Python and R

This is a standalone summary of an article first published on quantstr.at. The Python and R code, with every equation walked through line by line, is in the original.

TL;DR

  • Strategy: each month rank the nine original SPDR sector ETFs by their past 12-month return, hold the top three in equal parts for a month, repeat. From Section 4.1 of Kakushadze and Serur (2018), 151 Trading Strategies.
  • Result, January 2000 to October 2026, net of 10 bps trading costs: top 3 returned 8.69% a year, equal weight on all nine sectors 8.92%, the S&P 500 8.17%.
  • What changed was the risk, not the return: the worst fall from a peak was -39.2% for the top-3 portfolio against -49.2% for equal weight and -50.8% for SPY.
  • The edge is not robust: it beat equal weighting in 10 of 27 calendar years, and only 2 of 16 parameter settings beat the equal-weight portfolio's Sharpe ratio (0.66).

The idea

Momentum is one of the best-documented patterns in investing: assets that have recently performed strongly tend to keep doing so for a few more months. Sector rotation applies this to the US stock market. The market is split into sectors (technology, energy, health care and so on), each tradable through a sector ETF. We use the nine original SPDR funds: XLB materials, XLE energy, XLF financials, XLI industrials, XLK technology, XLP consumer staples, XLU utilities, XLV health care and XLY consumer discretionary.

The question: does rotating into last year's leaders beat simply holding all nine sectors in equal parts, which owns the same shares without any rotation?

Methodology

The paper gives a formula and typical ranges, not a fully specified backtest and not results. So this is one explicit implementation, not a reproduction of published returns. Our choices:

Element Paper, Section 4.1 This study
Signal Cumulative return over T months Same, T = 12
Holding period Typically 1 to 3 months 1 month
Selection For example the top decile Top 1 of 9 and top 3 of 9, long only
Weights Not specified Equal
Costs Not specified 10 bps per unit traded, charged on drift-adjusted turnover
Execution Right after time t Idealised: the month-end close that produced the signal

Data: Yahoo Finance daily adjusted closes (dividends and splits) for the nine ETFs and SPY, converted to month-end prices. The first 12 months are needed for the first signal, so every result starts in January 2000 and covers 322 months. Strategies, benchmarks and sensitivity tests all use exactly these months, and the equal-weight benchmark runs through the same cost model as the strategy.

The maths

Momentum of ETF i at the end of month t (the paper's Eq. 361), with T = 12:

Ri(t)=Pi(t)Pi(t−T)−1 R_i(t) = \frac{P_i(t)}{P_i(t-T)} - 1

Select the N ETFs with the highest R and weight them equally (our A1 and A2):

wi(t)={1/Nif rank⁡i(t)≤N 0otherwise w_i(t) = \begin{cases} 1/N & \text{if } \operatorname{rank}_i(t) \le N \ 0 & \text{otherwise} \end{cases}

The portfolio trades at the close of month t, earns month t+1, and pays costs on the distance between last month's drifted weights and the new targets (A3 and A4):

rp(t+1)=∑iwi(t) ri(t+1)−c∑i∣wi(t)−di(t)∣,di(t)=wi(t−1) (1+ri(t))∑jwj(t−1) (1+rj(t)) r_p(t+1) = \sum_i w_i(t)\, r_i(t+1) - c \sum_i \left| w_i(t) - d_i(t) \right|, \qquad d_i(t) = \frac{w_i(t-1)\,(1+r_i(t))}{\sum_j w_j(t-1)\,(1+r_j(t))}

Here c = 0.10%. The t+1 is the important part: a signal never uses the period it is paid on, so there is no look-ahead. The drift term matters too: weights move during the month because ETFs rise and fall by different amounts, so even holding the same funds means trading back to equal weights. Counting only changes in the target would understate costs.

Results

January 2000 to October 2026 Top 3 of 9 Top 1 of 9 Equal-weight 9 SPY
CAGR 8.69% 7.17% 8.92% 8.17%
Annual volatility 14.75% 20.65% 14.71% 15.11%
Sharpe ratio (risk-free = 0) 0.64 0.44 0.66 0.60
Maximum drawdown -39.2% -49.2% -49.2% -50.8%
Average monthly turnover 46% 64% 3% 0%

Strategies and the equal-weight portfolio are net of the same cost model; SPY is buy-and-hold. Before costs the top-3 portfolio earned 9.29% a year, so its 46% monthly turnover costs about 0.6 points a year.

Growth of 100 dollars for the four portfolios, 2000 to 2026, log scale

Drawdowns from the previous peak for the four portfolios

What we found

  • Top 3 matched the market's return with a shallower worst loss. The drawdown difference comes mainly from 2008-09, when rotating out of financials limited the damage.
  • Concentration did not pay. The top-1 portfolio returned 7.17% with 20.65% volatility (against 14.75% for top 3) and 64% monthly turnover, and fell as far as the market.
  • Costs are not small. Turnover of 46% a month is the price of the rotation; equal weighting trades about 3%.

Is it robust?

We re-ran 16 combinations of look-back (3, 6, 9 and 12 months) and number of funds held (1 to 4) on the same months. CAGR ranged from 4.1% to 9.2%, and only 2 settings beat the equal-weight portfolio's Sharpe ratio. This is an exploration of sensitivity, not 16 independent confirmations, and a 3-month look-back lies outside the paper's 6 to 12 month range.

Heatmap of Sharpe ratio and CAGR for each look-back and number of funds

Limitations

Nine ETFs is a small universe and cannot express a true decile. Execution is idealised (trades at the same close that produced the signal). Costs are a flat 10 bps; taxes, wider spreads and market impact are ignored. The strategy is long only, without the paper's optional short leg. Yahoo can revise adjusted prices, so rerunning later may give slightly different numbers. Past results are not a forecast.

Conclusion

Implemented as the paper describes it, sector momentum rotation on nine SPDR funds did not beat holding all nine. The diversified top-three version matched the return with a shallower worst loss; the concentrated version did worse. Across 16 settings the evidence for an edge is weak. A fair reading is that the rule trades a little return for some protection in a sell-off, and only when diversified.

Code and full article

The Python and R implementations (written independently and agreeing on all 322 monthly returns), the line-by-line walk-through of each equation and the verification are in the full article at quantstr.at: https://quantstr.at/quant-strategies/sector-momentum-rotation/?utm_source=devto&utm_medium=syndication

If you want the next strategies from the 151 Trading Strategies series, follow @quantstrat here.

Reference: Kakushadze, Z. and Serur, J. A. (2018). 151 Trading Strategies. SSRN: https://ssrn.com/abstract=3247865, Chapter 4, Section 4.1, Eq. (361).

Educational content, not investment advice. Backtested results are not a forecast of future returns.

Top comments (2)

Collapse
 
quantstrat profile image
quantstrat •

Here's the Python code: quantstr.at/quant-strategies/secto...

Collapse
 
quantstrat profile image
quantstrat •