Strategies
Four-Sector Leadership Rotation
Outcome: Abandoned
FourSectorLeadershipRotation
Outcome Summary
FourSectorLeadershipRotation tested a long-only, month-end rotation into whichever of four sector ETFs (XLK, XLF, XLE, XLU) had the strongest positive 252-session return. Over 3 iterations it never got past verification: the Layer 3 sandbox smoke test kept going over the 300s limit on a window of about 20,000 bars. The run was abandoned with reason 'verification_loop: sandbox_timeout'. No backtest, optimization or analyst review ever ran, so the long-only sector-momentum idea is still untested.
Hypothesis
Adapt QuantConnect's Sector Momentum method to XLK, XLF, XLE and XLU on daily USEQ bars. At each month-end close, rank their trailing 252-session price returns and hold only the leader when its return is positive. Earlier long/short sector tests found little edge, chiefly because of the short leg; this long-only variant remains untested.
The source specifies a tradable ranking and rotation rule. Holding one of four sectors tests its long-only leadership claim with less implementation work than the prior 11-sector attempt, which timed out without a measured result. The measured long/short sector variants had weak or negative expectancy, so this proposal excludes their short leg. Its similarity to prior sector work warrants moderate priority.
verification_loop: 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).
Implementation
Long-only monthly rotation across XLK/XLF/XLE/XLU on daily USEQ bars. At each month-end session close, rank trailing 252-session returns and hold only the leader (capital_fraction 0.5 of equity, whole shares) if its return > 0%, otherwise stay flat. A 10% close-based stop on the held sector blocks re-entry until the next month-end.
Iteration 3 fixes only the Layer-1.5 config check. Every fixed value in the optimization plan is now declared in parameters with its exact type: leverage 1.0, rebalance 'monthly', hold_top_n 1, stop_loss_pct 10.0, capital_fraction 0.5, lookback_sessions 252, leader_min_return_pct 0.0. The plan is attached as _optimization_plan, and position sizing reads the leverage parameter. The signal and rotation logic are unchanged. Caveat: with about one rebalance a month and a leader that often stays the same, the trade count will likely fall short of the 80-trade pre-registered minimum.
Verification Results
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).
Iteration History
Verification failed (Layer 1.5 — hypothesis/config consistency) [class=hypothesis_mismatch]: - optimization_plan fixes leverage at 1.0
Outcome Summary
Per-bar work in calculate_signal() needs to stay cheap, about O(1) or O(log n) per bar. Here that work included scanning four instrument buffers, sorting the ranking, looking up positions and running month-end calendar checks on every bar. Do month-end-only logic just once per month and precompute or cache the rest, so the sandbox smoke test finishes before the strategy logic is ever judged.
It was abandoned in a verification loop after 3 iterations. The Layer 3 sandbox backtest went over the 300s wall-clock limit on a window of about 20,000 bars (2,400 days of XLK.USEQ-1-DAY-LAST-EXTERNAL), so backtest review, optimization, analyst review and risk review never ran.
A long-only adaptation of QuantConnect's Sector Momentum method: at each month-end close, rank XLK, XLF, XLE and XLU by trailing 252-session price return on daily USEQ bars and hold only the leader when its return is positive. Earlier long/short sector tests had found little edge, mainly because of the short leg.
There are no performance numbers. The strategy never produced a backtest report, so there is no return, Sharpe or trade count.
Analysis
Sector Momentum
Backtest and paper results are hypothetical. Trading involves risk of loss.