SpyDualTimeframeTrendConfluenceLS
Hypotheses
SPY Dual-Timeframe Trend Confluence — Long-Short, Single-Instrument: Take a Directional Position ONLY When WEEKLY and DAILY Trend Agree, Flat on Disagreement, ATR-Trailed Winners (SPY.USEQ, Daily+Weekly Bars, 3-Parameter)
Hypotheses
A LONG-SHORT, SINGLE-INSTRUMENT directional TREND-momentum strategy on SPY.USEQ (S&P 500 ETF), deliberately built on the ONE structure this factory has actually validated to a ~2.0 Sharpe — the dual-timeframe momentum confluence template (fast + slow trend must AGREE, flat on disagreement, trailing-stop winners) — and ported to a genuinely different asset class and cost regime. The equity book's two prior mean-reversion/relative-value attempts (KO/PEP cointegration, XLF z-score fade) both died FLAT at zero Sharpe: those textbook edges are fully arbitraged even commission-free. The lesson from that pair of deaths, and from the factory's single success being directional momentum, is decisive — pursue a DIRECTIONAL trend edge, not a reversion/neutral one. Multi-week equity-index trend (time-series momentum) is one of the most robustly documented directional premia (Moskowitz-Ooi-Pedersen TSMOM; Faber GTAA; the managed-futures literature), and it is CLEANER on a broad index than on any single crypto alt because index-level trends are driven by slow macro/flow regimes rather than fast reflexive leverage. This differs from every equity strategy already in the pipeline: it is NOT calendar/event (turn-of-month, pre-FOMC), NOT a sector pair (XLK/XLU beta-regime), NOT volatility-scaled sizing (QQQ vol-regime) — it is a pure price-trend confluence on the broad index. It uses SPY specifically (the deepest history, since 1993, and the most institutionally-trended index) on Daily primary + Weekly confirm bars, giving 30+ years across multiple bull/bear cycles for a robust walk-forward and holdout. It is always-engaged except when the two timeframes disagree (so no structural zero-trade gap), long-short (filling the under-represented long_short bucket), and only 3 free parameters to resist overfitting. FEE ARITHMETIC: a captured multi-week trend leg on SPY runs ~3-10%; even with a ~40% win rate and ATR-trailed exits the average trade clears well above 0.5%, versus a ~0.04% commission-free round-trip = >10x the effective cost floor and far above the 0.15% viability bar. Turnover is low (~10-30 trades/year), so fee drag is negligible — the opposite of the sub-fee reversion mechanisms that dominate the graveyard.
Hypotheses
Implements the hypothesis's dual-timeframe confluence structure (fast+slow must agree, flat on disagreement, ATR-trailed winners) verbatim on SPY, with ONE necessary deviation: the USEQ catalog carries only 1-DAY/1-HOUR/1-MINUTE bar types (Yahoo intervals) -- there is NO 1-WEEK USEQ bar. Subscribing a weekly extra leg would have returned zero bars and abandoned the run as data_unavailable (L4), so the weekly confirm is aggregated in-strategy from daily closes on a CALENDAR week index derived from bar.ts_init (Monday-anchored days-since-epoch // 7), never from a bar counter -- the weekly grid is identical across restarts, backtests and paper replay. This also removes the multi-leg alignment barrier entirely (single instrument, single feed). Signal is continuous every bar (the ATR-normalised EMA spread, not a gated constant) with the weekly agreement applied as the entry gate. Venue is USEQ rather than a crypto venue because the strategy is long-short on a US equity ETF; leverage stays 1.0 (notional capped at 60% of equity) so no unused-leverage claim is made. Fee arithmetic: multi-week SPY trend legs of 3-10% at ~10-30 trades/year clear the commission-free ~0.04% round trip and the 0.05% USEQ per-trade floor by a wide margin. Trade frequency in the 365-day Layer-3 sandbox: warmup is ~50 daily bars (fast/slow EMA convergence and 9 weekly closes), leaving ~200 tradable sessions in which sign agreement between a 10/30 EMA spread and an 8-week return fires repeatedly -- there is no rare compound gate (L25). One reservation, stated as required: with only sign-agreement entries and no volatility/regime filter, whipsaw clusters in choppy tape (e.g. 2015, 2018Q4) will produce a run of small ATR-trailed losses; the trail multiplier is the intended control and is left free for the optimizer rather than adding a fourth parameter.
Hypotheses
ohlcv_trend_confluence_negative_expectancy: SPY dual-timeframe trend confluence is a net loser over a well-measured 442-trade / 33-year sample — total_return -9.61%, profit_factor 0.934 (<1.0), avg_trade_return_pct -0.092% (negative, below the USEQ floor), expectancy -$25.89/trade, Sharpe 0.052 with CI straddling zero. This is the OHLCV dual-timeframe momentum-confluence template (0/213 survival, L9/L41/L62); the equity-index TSMOM premium does not survive the discrete entry/exit rules here, and per L8/L9 negative total_return with PF<1.0 is disqualifying. Only 3 tunable parameters cannot turn a negative-expectancy mechanism positive — the ~225-trial optimization would curve-fit noise and die at holdout, not reach the promotion floor. Not worth the 2-hour run.
Implementation
Long-short, single-instrument dual-timeframe trend confluence on SPY.USEQ daily bars (history from 1993). A FAST daily trend read -- the ATR-normalised spread between a 10-day and a ~30-day EMA -- must AGREE in sign with a SLOW weekly read (the multi-week return measured against the close of the calendar week that ended `weekly_lookback` completed weeks ago) before any position is taken: agree-up = long, agree-down = short, disagreement = flat. Winners are trailed out with an ATR stop (close when price gives back trail_atr_mult x the entry ATR from the best close since entry); positions are also cut when the weekly trend flips against them or the daily spread flips. Sizing is risk-first in WHOLE SHARES: shares are set so the trailing-stop distance risks ~1.2% of equity, hard-capped at 60% of equity notional at leverage 1.0. Three free parameters (ema_ratio, weekly_lookback, trail_atr_mult), all clamps declared in _param_bounds.
Verification Results
Optionally defer setting self._side/self._extreme/self._entry_atr until the entry is actually submitted, or reset to 0/None when returning None.
Verification Results
should_enter() sets self._side / self._extreme / self._entry_atr BEFORE the base template's size>0 and min_notional checks (base_template lines 392-408). If an entry is dropped for zero-size or sub-min-notional, self._side is left non-zero while the strategy is still flat, and calculate_signal() will keep updating self._extreme. BENIGN: while flat the base template only calls should_enter() (never should_exit()), and a real entry always resets self._side/self._extreme/self._entry_atr, so no wrong exit or mis-trail can occur. At SPY prices the risk-first size is tens of shares (far above the $5 floor), so the drop path is not expected to fire. Cleanliness only.
Verification Results
No code change required; let walk-forward/holdout judge on full history.
Verification Results
Sandbox headline metrics (Sharpe 0.31, CI [-1.55, 2.32], 7 trades) are weak/wide. These are PERFORMANCE concerns for the analyst/backtest-review stage, not correctness defects: per-trade economics are healthy (avg_trade_return_pct 0.54%, PF 1.78), clearing the USEQ ~0.05% floor and 0.15% viability bar by ~10x. The full 30+yr walk-forward resolves the sample-size question.
Backtest Review
Long history (8452 daily bars, 1993-2026) and 442 trades give a statistically well-measured result
Backtest Review
Low fee drag on USEQ and clean O(1) implementation — the code is not the problem
Backtest Review
Market-neutral-ish (beta 0.009), so no hidden index beta inflating results
Backtest Review
Negative total_return (-9.61%) with profit_factor 0.934 (<1.0) — a net loser over 33 years (L8/L9 disqualifying)
Backtest Review
avg_trade_return_pct is NEGATIVE (-0.092%), below even the zero-commission USEQ floor — no edge to capture
Backtest Review
Sharpe 0.052 with CI [-0.255, 0.393] straddling zero; information_ratio -0.51 vs buy-hold
Backtest Review
Expectancy -$25.89/trade, win_rate 0.269; both long and short legs are net losers across most years
Backtest Review
Dual-timeframe trend/momentum confluence is the OHLCV directional class with 0/213 survival (L9/L41/L62); porting to SPY does not create the missing edge
Backtest Review
30% max drawdown (CI high 77%) for a strategy that loses money
Outcome Summary
SpyDualTimeframeTrendConfluenceLS deliberately reused the factory's one validated directional recipe — fast and slow trends must agree, flat on disagreement, ATR-trailed winners — and ported it to SPY on daily bars plus a derived weekly confirm, betting that the well-documented equity-index TSMOM premium would carry it. The 33-year backtest was clean and well-measured (8,452 bars, 442 trades, near-zero beta) but decisively negative: -9.61% total return, profit factor 0.934, essentially zero Sharpe, and a negative per-trade expectancy below even the commission-free USEQ floor. The analyst abandoned it at the backtest-review gate, noting the dual-timeframe momentum-confluence class has 0/213 survival and that 3 tunable parameters would only curve-fit noise and die at holdout. It never reached optimization or any later stage.
Outcome Summary
Porting a validated momentum-confluence recipe to a new asset (SPY) does not manufacture an edge — the dual-timeframe OHLCV trend template remains a negative-expectancy class even over a clean, well-measured 33-year sample.
Outcome Summary
The analyst issued an 'abandon' verdict at the pre-optimization backtest-review gate because negative total return with profit factor below 1.0 is disqualifying (L8/L9); the OHLCV dual-timeframe momentum-confluence template has 0/213 survival, so the equity-index TSMOM premium did not survive the discrete entry/exit rules and 3-parameter optimization could not turn a negative-expectancy mechanism positive.
Outcome Summary
A long/short, single-instrument dual-timeframe trend-confluence strategy on SPY.USEQ that takes a directional position only when a fast daily EMA-spread trend and a derived weekly momentum trend agree, stays flat on disagreement, and trails winners out with an ATR stop, using three free parameters (ema_ratio, weekly_lookback, trail_atr_mult).
Outcome Summary
Over 33 years (1993-2026, 8,452 daily bars) and 442 trades it lost money: total return -9.61%, profit factor 0.934, Sharpe 0.052 (CI [-0.255, 0.393]), win rate 26.9%, negative expectancy of -$25.89/trade and avg_trade_return_pct of -0.092%, with information ratio -0.51 vs buy-and-hold and a 30% max drawdown.
Backtest and paper results are hypothetical. Trading involves risk of loss.