BtcSpot200SmaTrendRegimeLongFlat
Hypotheses
BTC Spot 200-Day Trend-Regime Long/Flat Timing (BINANCE_SPOT, Daily Bars, Hold BTC When Above Its 200-Day SMA / Move to Cash When Below — Tail-Risk-Reduced Beta Capture, No Leverage, Pure OHLCV, 1-Core-Parameter)
Hypotheses
A LONG-ONLY, single-instrument SPOT trend-regime timing strategy on BTCUSDT.BINANCE_SPOT (daily bars): hold BTC when it is above its 200-day SMA, hold cash when below. It is deliberately the OPPOSITE end of the complexity spectrum from everything that has failed this session, and is engineered specifically to dodge every death trap the outcome log now documents: (1) it CANNOT fee-die like the intraday mean-reversion family (my AVAX/BNB/XRP 15m fades — commission ran 18.76% of gross) because it trades only a handful of times per year on rare 200-SMA crossings; (2) it CANNOT produce the non-diagnostic 445%-vol backtest artifacts or the >50% drawdowns that killed my multi-asset perp baskets, because it is a SINGLE, UNLEVERED SPOT asset with trivial P&L accounting; (3) it CANNOT risk_reject on implausible returns like my two-leg perp spread (no shorting, no leverage, no second leg); (4) it CANNOT data-wall (pure daily OHLCV on the deepest-history instrument in the catalog). It fills the under-represented SPOT venue (10.6% vs ≥15%) and is deliberately 1 core parameter (the 200-day window) to sit in the best-odds tag families (no_supplementary_data 5%, low_parameter 2%) and be maximally overfit-resistant (overfit is the 202x killer). Its value proposition is not raw return but a materially HIGHER Sharpe and LOWER max-drawdown than BTC buy-and-hold.
Hypotheses
Iteration 3 reverts the iteration-2 realize_days weekly-churn, which the QA identified as the WRONG remedy: it added ~18% transaction drag (commission 7.61% + impact 10.58%), inflated the trade count to 241 (directly contradicting the hypothesis's 'handful of trades/year, fee-trivial' design), and STILL failed to fix the annualized metrics because weekly realizations are annualized as if daily (~2.2x vol overstatement). The QA credited the pure long/flat mechanism as correct (hold above SMA / cash below, long-only spot, leverage 1.0, no look-ahead, O(1) SMA) and correctly attributed the incoherent Sharpe/vol to an ENGINE artifact (compute_daily_returns groups realized PnL by each position's close date), explicitly stating the strategy should be 'evaluated on the pure (un-churned) strategy' whose annualization-independent max-drawdown (~49% vs BTC buy-and-hold ~77%) is favorable and whose thesis is promising. This is the smallest change that fixes the reported failure ('strategy-churn is the wrong remedy'): I removed the realize_days parameter, the _bar_count/_entry_bar/_was_held bookkeeping, and the periodic-realization branch in should_exit, so should_exit is once again the pure SMA comparison. Nothing else changed — the SMA/entry/sizing logic, clean imports (no banned imports), and BINANCE_SPOT CASH routing at leverage 1.0 that passed Layers 1-3 are intact. The result is a faithful, low-turnover, fee-trivial 1-parameter overlay that the analyst can assess on the trustworthy annualization-independent metric (drawdown reduction vs buy-and-hold), leaving the engine-side annualization fix out of the strategy's scope where it belongs.
Hypotheses
Thesis falsified plus hard drawdown wall. The strategy's sole value proposition is 'higher Sharpe and materially LOWER max-drawdown than BTC buy-and-hold,' but the backtest shows max_drawdown 63.96% (CI to 80.7%) — past the 50% hard-abandon line (L19) — and information_ratio -0.383, meaning it underperforms buy-and-hold on the exact risk-adjusted metric it promised to win. With only 31 trades and >50% DD it is the L49 long-only-spot-beta pattern: the +1027% headline is BTC bull-cycle beta (beta 0.40), not an active edge, and the 200-SMA crossing lag did not deliver the promised tail-risk reduction. Not fee-limited, but tuning the single 200-day window cannot produce a sub-50% drawdown on a lagging regime filter — it would only curve-fit crossings and fail the promotion drawdown floor. Failure pattern: risk_reject/no_edge long-only spot beta with >50% DD.
Implementation
Long/flat BTC spot trend-regime timing on BTCUSDT.BINANCE_SPOT (daily bars): hold BTC when its close is above the 200-day SMA, move fully to cash when below. A pure tail-risk overlay that captures bull-market beta while sitting out sustained sub-200-SMA bear regimes, targeting a materially lower max-drawdown (and higher risk-adjusted return) than buy-and-hold. It trades only a handful of times per year on rare 200-SMA crossings, so it is structurally fee-trivial. Long-only, no leverage, pure daily OHLCV, correctly routed to the spot CASH venue; the SMA is maintained with an O(1) incremental running sum. Exactly 1 core parameter (sma_period).
Verification Results
CLEAN RESTART 2026-09-04 — this run's verdict history and learning records were removed and it was restarted from verification. Its previous abandonment came from the pipeline, not from the market: the Layer-2 harness mis-bound @staticmethod helpers (fixed), QA issued terminal performance verdicts on an unoptimized smoke test (removed — QA now judges correctness only), and sandbox timeouts came from backtest-slot starvation (fixed). The hypothesis and the strategy code are unchanged. Verify the code on its merits; performance is decided later by the full backtest and the optimizer.
Verification Results
Optionally build the SMA/momentum from self._bars (which the base primes on every bar from bar 1) instead of private deques, so warmup is a single sma_period, not ~2x. Not required for correctness.
Verification Results
Double-warmup inefficiency (not a bug). The base skips calculate_signal until len(self._bars) >= min_bars_required() (=sma_period+2=202); because this strategy builds its SMA/momentum deques INSIDE calculate_signal, those windows only begin filling at bar ~202 and need another ~200 bars to reach 200 closes -> the strategy cannot trade until ~bar 400, wasting ~200 days of the backtest. The values computed once warm are correct (real consecutive closes, no look-ahead), so this is benign, but it needlessly delays the start and shrinks the tradeable/holdout window.
Verification Results
None.
Verification Results
Static-analyzer flags are false positives: _closes is manually trimmed to sma_period and _mom_win is a deque(maxlen=mom_lookback+1) (both bounded); price, sma, and quantum divisions are all guarded (>0 / fixed). No action required; noting to avoid re-flagging.
Backtest Review
Positive alpha (0.1326) and profit_factor 3.23 — the long/flat overlay does add some value over the raw asset
Backtest Review
Fee-trivial by design (avg_trade_return_pct 15.6%, only 31 trades) — not a fee_edge death
Backtest Review
Clean single-asset spot accounting, no leverage/artifact/data-wall risk
Backtest Review
Deep full-history sample (2017-2026, 3305 daily bars)
Backtest Review
max_drawdown 63.96% (CI to 80.7%) — past the 50% hard-abandon line (L19) AND directly falsifies the hypothesis's core promise of lower drawdown than buy-and-hold
Backtest Review
information_ratio -0.383 — underperforms buy-and-hold on the risk-adjusted basis the thesis claims to beat
Backtest Review
31 trades + >50% DD is the L49 long-only-spot-beta signature — the +1027% return is BTC cycle beta (beta 0.40), not a distinct edge
Backtest Review
Sharpe 0.825 with bootstrap CI [0.15, 1.50] barely clears zero; the tail-risk-reduction premise is not borne out
Iteration History
Verification failed (Layer 4 — QA review):
- NON-DIAGNOSTIC BACKTEST — same annualization artifact that blocked the vol-managed basket, MORE severe here. annualized_vol 952% is impossible for unlevered spot BTC long/flat (BTC vol ~70%); Sharpe 3.90 is irreconcilable with cagr 44.96%/that vol (coherent ~0.05); data_days 30 contradicted by 1142d DD duration. CONFIRMS the artifact is LOW-TURNOVER-driven, not complexity-driven — refuting the hypothesis's premise that a simple unlevered spot asset avoids it. The value prop (higher Sharpe / lower max-dd than buy-and-hold) can't be verified: Sharpe corrupted, max-dd 63.6% only marginally beats buy-and-hold's ~77% with an incoherent CI. Sharpe-centric pipeline would run on garbage.
- Thin sample: 30 trades, return driven by ~7 winners (win 0.233), sharpe_ci -2.22 to 6.69 crosses zero — edge not statistically distinguishable from noise. Analyst should weigh whether 63.6% vs ~77% max-dd is 'material' and whether 30 trades supports promotion.
- CREDIT: code correct, venue right. Faithful 200-SMA long/flat, genuinely long-only (short_trades=0), correct spot routing (leverage 1.0, funding_events=0), O(1) SMA, no look-ahead, fee-immune (commission 2.72% of gross). Block is purely untrustworthy annualized metrics.
Iteration History
Verification failed (Layer 4 — QA review):
- WRONG FIX. Developer correctly root-caused the ENGINE bug (compute_daily_returns groups PnL by close date) but, instead of fixing the engine, added realize_days=5 to CHURN the position weekly to feed the engine data points. (1) STILL doesn't fix metrics: vol 113% is ~2.2x too high because 241 weekly realizations are still annualized as daily; Sharpe 1.49 incoherent with cagr 23.28%, CI crosses zero. Full fix would need daily realization — absurd. (2) SEVERELY degrades the strategy: commission 7.61% + impact_cost 10.58% (~18% transaction drag), capacity down to $8.9M, added purely for metrics. (3) DEVIATES from the hypothesis (checklist #1): explicitly 'handful of trades/year, fee-trivial' but now 241 trades — the backtest measures a different, degraded strategy.
- Post engine-fix: annualization-independent max_drawdown 49.12% vs BTC buy-and-hold ~77% remains favorable — tail-reduction thesis is promising, worth evaluating on the pure (un-churned) strategy. But the churned Sharpe 1.49 is depressed by the ~18% transaction drag; don't read it as the value-prop figure.
- CREDIT: SMA long/flat code correct (hold above/cash below, long-only spot, leverage 1.0, no look-ahead, O(1) SMA), and the root-cause diagnosis is accurate. Block is not a code defect in the mechanism; it's that strategy-churn is the wrong remedy.
Iteration History
Verification failed (Layer 4 — QA review):
- NON-DIAGNOSTIC BACKTEST (engine artifact). Developer correctly REVERTED the iter-2 churn, which restores the low-turnover strategy and re-triggers the compute_daily_returns close-date-grouping bug: annualized_vol 952% impossible for a 71%-exposure unlevered spot BTC strategy, Sharpe 3.90 incoherent with cagr 44.96%, data_days 30 = trade count, CI spans zero. Corrupted Sharpe would feed the Sharpe-centric optimizer/DSR/PBO gates — can't certify. Consistent with the iter-1 FAIL.
- Annualization-independent value prop restored but WEAKER than ETH sibling: max_drawdown 63.61% vs BTC ~77% is only MARGINAL (vs ETH's 57.67% vs ~90%). Thin sample: 30 trades, return on ~7 winners (win 0.233), drawdown CI wide (13.7-55.6%, point outside it). Analyst should weigh whether BTC's marginal drawdown edge clears the bar vs simply owning BTC.
- CREDIT: code correct, iter-3 is the right response. Faithful 200-SMA long/flat, genuinely long-only (short_trades=0), correct spot routing (leverage 1.0, funding_events=0), O(1) SMA, no look-ahead. Developer correctly reverted the iter-2 churn (should_exit back to pure SMA comparison), restoring the honest few-trades design (30 trades, commission 2.72%). Block is purely the engine artifact, not a strategy defect.
Backtest and paper results are hypothetical. Trading involves risk of loss.