Skip to content
All strategies

Strategies

US Sector-ETF 12-1 Month Momentum, Top-3 Monthly Rotation, Long-Only with Cash Fallback (SPDR sector ETFs on USEQ, DAILY bars)

Outcome: Abandoned

SectorEtfMomentumTop3MonthlyRotation

Outcome Summary

This hypothesis adapted QuantConnect's 'Momentum Effect in Stocks' strategy to the 11 Select Sector SPDR ETFs: rank sectors monthly by 12-1 momentum, hold the top 3 at equal weight, and move a slot to cash when that sector's momentum is negative. The developer produced SectorEtfMomentumTop3MonthlyRotation, which uses its own cross-leg bar-alignment barrier and a point-in-time eligibility rule. The coding stage timed out three times across 2 iterations, and the run was abandoned with reason 'coding_stuck_3_timeouts'. No backtest, optimization or analyst verdict was produced.

Hypothesis

The source (QuantConnect Strategy Library 'Momentum Effect in Stocks', after Quantpedia / Jegadeesh-Titman) ranks the 50 largest US stocks by 12-month price change and holds the leaders equally weighted, rebalancing monthly. We keep the mechanism (12-month cross-sectional momentum, equal weight, monthly rebalance, long-only) and change the universe to one the factory can run and that is not a hand-picked list. A 50-stock top-market-cap universe runs into lessons L173 (top-N baskets of 20-60 names time out after 3……Show moreShow less

The source (QuantConnect Strategy Library 'Momentum Effect in Stocks', after Quantpedia / Jegadeesh-Titman) ranks the 50 largest US stocks by 12-month price change and holds the leaders equally weighted, rebalancing monthly. We keep the mechanism (12-month cross-sectional momentum, equal weight, monthly rebalance, long-only) and change the universe to one the factory can run and that is not a hand-picked list. A 50-stock top-market-cap universe runs into lessons L173 (top-N baskets of 20-60 names time out after 3 iterations) and L151 (a list of today's mega caps carries survivorship bias; we have no point-in-time market-cap data). Instead the universe is the complete set of Select Sector SPDR ETFs: XLB, XLE, XLF, XLI, XLK, XLP, XLU, XLV and XLY, all listed since Dec 1998, plus XLRE (from Oct 2015) and XLC (from Jun 2018). The list is fixed by the GICS sector classification, not by knowing which names did well. It is point-in-time: an ETF is eligible only once it has 252 daily bars of history. That caps the book at 11 names, and there is 27 years of daily history. Momentum is the 12-1 return, close(t-21)/close(t-252) - 1, skipping the latest month to avoid 1-month reversal; the source's raw 12-month change is pre-registered as variant B. On the first trading session of each month, rank the eligible sectors and hold the top 3 at equal weight (1/3 of equity each, 1x, no margin). A sector's slot goes to cash if its own 12-1 return is below 0 (absolute momentum). That is the flat state: expected ~15-20% of months partly or fully in cash, and ~10% fully flat (2001-02, 2008, 2022 H1). Portfolio-bucket rationale: USEQ is 2.5% of the corpus, sector ETFs are archetype #1 in the equity brief, and nothing in the pipeline is a US sector-ETF rotation. SPY is deliberately not used as a signal or hedge leg (no signal-on-A/trade-B, no neutral book). Source credit: QuantConnect Tutorials, 04 Strategy Library / 21 Momentum Effect in Stocks, sections 'Momentum Calculation' and 'Monthly Rebalance'.

Implements the hypothesis as stated. The universe is fixed by GICS sectors: XLK is the primary leg and the other 10 ETFs are extra legs, including XLRE and XLC, which listed later and become eligible only once they have enough history. Momentum is 12-1 (variant B is skip_sessions=0), the top 3 are held at equal weight, and a slot goes to cash when its sector's own momentum is not positive. The monthly schedule comes from each bar's timestamp, so it is identical across restarts, backtests and paper. The strategy replaces the base alignment barrier with its own, so legs that have not listed yet do not block every bar. It uses no extra-leg bar stamped later than the decision time. Per-bar cost is O(11). Gross exposure is at most 0.98x equity, under the USEQ 2x cap, with leverage 1. Each holding is a single open-to-flat trade with no trims, so the ledger reconciles. There are about 12 rebalances a year with 1-1.5 name changes each, which is roughly 15-25 round trips a year. Holds are long, so the expected per-trade return should be well above the ~0.05% USEQ cost floor.

coding_stuck_3_timeouts

Implementation

Long-only monthly rotation across the 11 Select Sector SPDR ETFs on USEQ daily bars. On the first session of each month it ranks the eligible sectors by 12-1 momentum, close(t-21)/close(t-252)-1. A sector is eligible once it has 253 closes. It holds the top 3 at 1/3 of 98% of equity each. A slot whose sector momentum is <= 0 stays in cash. Sectors that leave the top 3 are closed, new entrants are bought, and holdings that stay in the top 3 are left untouched.

Iteration History

sandbox_timeout: Verification failed (Layer 3 — sandbox backtest): smoke test exceeded the 300s wall-clock limit on a ~20000-bar window (2400 days of XLK.USEQ-1-DAY-LAST-EXTERNAL). This almost always means per-bar work that scales with history — e.g. rescanning the full funding/supplementary series, or rebuilding a list and calling min()/sorted() inside calculate_signal()/on_bar() on every bar. Precompute sorted timestamp arrays ONCE in __init__ and use bisect, or cache lookups keyed by timestamp, so per-bar cost is O(log n) not O(n).

Outcome Summary

The multi-leg design (11 ETF legs, a custom alignment barrier, point-in-time eligibility, deque-based history) may have been too complex to code within the time limit; a simpler first version with fewer legs or less custom synchronization might get past coding.

The run was abandoned at the coding stage with reason 'coding_stuck_3_timeouts' after 2 iterations, so verification, backtest, optimization, analyst review and risk review were never reached.

Each month, hold the top 3 of the 11 Select Sector SPDR ETFs on USEQ, ranked by 12-1 month momentum, at equal weight and long-only, with a slot moved to cash when that sector's own momentum is negative.

No performance data exists: the backtest report is empty and no optimization report was produced, so there are no return, Sharpe or trade-count figures.

Analysis

Momentum Effect in Stocks

Backtest and paper results are hypothetical. Trading involves risk of loss.