Skip to content

View original

BtcHyperliquidDualTimeframeMomentumConfluenceLS4H

Hypotheses

Hyperliquid BTC Perp Dual-Timeframe Momentum Confluence, Long-Short (BTCUSD.HYPERLIQUID, 4H Primary + 1D Confirm, Flat on Disagreement, ATR Trailing Stop + Slow-TF Regime Break, 3-Parameter) — Venue-Transfer Rehearsal for the First Hyperliquid Live Candidate

Hypotheses

A LONG-SHORT, single-instrument, pure-OHLCV momentum-confluence trend follower on BTCUSD.HYPERLIQUID (Hyperliquid perpetual, MARGIN account, leverage 1.0 = same as the source, far below the 20x venue cap). Mechanism is an EXACT transfer of BtcDualTimeframeMomentumConfluenceLS (Binance USD-M, Sharpe 1.99, 458 trades, PF 2.40, DD 3.94%, +$4,774 over 36 paper trades in 29 days): a FAST leg (sign of the trailing fast_lookback-bar return on 4H bars) and a SLOW leg (sign of the trailing slow_lookback-bar return on DAILY bars, via on_extra_bar) must AGREE to hold a position; on disagreement the book is FLAT. Exits unchanged: ATR trailing stop from the running extreme, or the daily leg flipping against the held side. Sizing capital-relative via get_account_equity(). PURPOSE: this is not a new alpha claim but an execution-readiness rehearsal — before capital is routed to Hyperliquid, the one mechanism the factory trusts must be validated on Hyperliquid's own price series, fee schedule and hourly funding clock, then rehearsed on TESTNET. I am aware HYPERLIQUID is 0/131 all-time and that clones of this survivor have died elsewhere; the bar is therefore pre-registered BELOW the source's. DATA SPAN (checked in the catalog, not assumed): BTCUSD.HYPERLIQUID-4-HOUR has accrued past the 5000-candle API cap since 2024-01-22 → ~2.6 years / ~5,700 bars, enough for 3 walk-forward windows plus a ~6-month holdout; the daily confirm leg goes back to 2020-08-20. 4H is the fastest Hyperliquid interval with usable multi-year history — no sub-hourly variant is proposed. PARAMETERS (source optimum kept verbatim per the brief): fast_lookback=18, slow_lookback=15, trail_atr_mult=3.033, risk_pct=0.0101, max_notional_frac=0.497, leverage=1.0, ATR_PERIOD=14; Hyperliquid-only overrides size_precision=5 and min_notional=$10. Three tunables exposed. FEE ARITHMETIC: 0.045% taker/side = ~0.09% round-trip on market orders both ways. Source realised 1.367%/trade; assuming HALF survives the transfer and the choppier 2024-2026 window gives ~0.65%/trade ≈ 7x round-trip and 4x the 0.15% Hyperliquid floor — I pre-register 0.45% (5x round-trip). Cadence ~55-60 round trips/year (≈1/week), nowhere near the fee-drag graveyard. FUNDING: Hyperliquid accrues HOURLY and the engine does NOT credit funding, so a ~5-day hold carries ±0.05-0.15% of unmodelled funding — a flagged measurement gap, and the main reason the testnet rehearsal is the point. PORTFOLIO FIT: HYPERLIQUID 6.9% vs a ≥20% quota target — the furthest-under-target venue with real multi-year data; direction long-short (14.9% of corpus vs 85.1% long-only).

Hypotheses

Exact venue transfer of BtcDualTimeframeMomentumConfluenceLS (Binance USD-M survivor) as the hypothesis specifies: signal, exit and sizing code are reproduced verbatim from the source strategy file, with only the venue-specific constants changed (size_precision 5, min_notional $10) and the source optimum carried over as defaults (fast_lookback=18, slow_lookback=15, trail_atr_mult=3.033, risk_pct=0.0101, max_notional_frac=0.497, ATR_PERIOD=14 locked, leverage 1.0). Venue is HYPERLIQUID futures (MARGIN) because the book goes SHORT — spot cannot express half of this mechanism. The daily confirm leg is a SLOWER-timeframe extra leg on the same instrument, so the base template's cross-leg alignment barrier never gates the 4H signal (only same-timeframe legs sync); both BTCUSD.HYPERLIQUID-4-HOUR and -1-DAY bar dirs were confirmed present in the catalog before submission. Per-bar work is O(lookback) with fixed windows (ATR over 15 bars, two indexed lookups) so the 300s sandbox budget is not at risk. Entry frequency: the confluence gate is a 2-condition sign agreement that holds most of the time in a trending regime and flips a few times a month — the source produced 458 trades, so a zero-trade sandbox is not a live risk. Every parameter clamp in __init__ is declared identically in _param_bounds so the optimizer never tests a value the code silently rewrites. Leverage stays at 1.0 and is read from self.config.leverage in the notional cap, matching the source. One honest caveat, as the hypothesis itself states: Hyperliquid funding accrues hourly and the engine does not credit it, so a multi-day hold carries roughly ±0.05–0.15% of unmodelled funding — this backtest measures price-and-fee transfer only, which is why the testnet rehearsal is the actual deliverable.

Hypotheses

negative_expectancy on a reliable sample. The deciding number is gross, not costs: total price PnL is +$1,497 over 172 trades (~0.02% of notional each) against $3,777 commission and $4,487 funding actually paid → net -$6,767, PF 0.90, Sharpe -0.137. Optimization cannot lift a mechanism with ~zero gross capture over a 0.09% round trip plus an hourly funding clock on 3.6-day holds. The failure is specific: the long leg still works (+0.409%/trade) but the 92 shorts lose -0.744%/trade, so the source's long-short symmetry does not transfer to HL's 2024-2026 window.

Implementation

Long-short, single-instrument, pure-OHLCV dual-timeframe momentum confluence on BTCUSD.HYPERLIQUID perpetual. A FAST leg (sign of the trailing 18-bar return on 4H bars) and a SLOW leg (sign of the trailing 15-bar return on DAILY bars, delivered via on_extra_bar) must AGREE to hold a position: both up -> LONG, both down -> SHORT, disagreement -> FLAT. Exits are an ATR trailing stop (3.033 x entry-time ATR from the position's running high/low extreme) or the daily leg flipping against the held side. Sizing is capital-relative: risk 1.01% of equity across the trailing-stop distance, gross notional capped at 49.7% of equity, leverage 1.0, size quantised to HL's 5-decimal size precision with a $10 minimum notional. calculate_signal returns the continuous 4H momentum return every bar; the discrete confluence gate lives in should_enter.

Verification Results

Move the _side/_extreme/_entry_atr anchoring out of should_enter() into the position-exists branch of calculate_signal (which already handles the _side == 0 case), or into an on_position_opened hook.

Verification Results

should_enter() mutates position state (self._side, self._extreme, self._entry_atr) before the order is known to be submitted. If position_size() returns 0, or the base template drops the entry on the min-notional check, the strategy is left with a non-zero _side and a stale _extreme/_entry_atr while actually flat. It is self-healing (the next bar's calculate_signal sees pos is None and resets all three, and should_exit() is only reached when a position exists), so no wrong trading decision follows - but a predicate with side effects is fragile if the base template's entry path ever changes. Prefer anchoring the trailing state in on_position_opened / the first post-entry calculate_signal.

Verification Results

Drop BTCUSD.HYPERLIQUID from extra_instruments; extra_bar_types alone delivers the daily leg to on_extra_bar().

Verification Results

config.extra_instruments lists BTCUSD.HYPERLIQUID, which is also the primary instrument_id. The base template then subscribes the same instrument twice for non-bar data (none requested here, so no effect), buffers the daily bars into _extra_bars[BTCUSD.HYPERLIQUID] (never read by this strategy - it keeps its own _daily_closes), and calls close_all_positions/cancel_all_orders on the primary instrument twice in on_stop (idempotent). Harmless today because only extra_bar_types matters for the daily leg and the 1-DAY timeframe differs from the 4-HOUR primary so _sync_extra_iids stays empty (the alignment barrier correctly does not gate the 4H signal, as the rationale claims). Still, the duplicate entry is noise.

Verification Results

Optional: have min_bars_required() also account for the daily warm-up (e.g. max(fast_lookback+1, ATR_PERIOD+1, (slow_lookback+1)*6) + 2) so the entry diagnostics attribute the dead preamble to warm-up rather than to the entry gate.

Verification Results

The daily confirm leg needs slow_lookback + 1 = 16 daily closes before _slow_dir leaves 0, i.e. ~96 primary 4H bars, while min_bars_required() only gates on the 4H leg (21 bars). Between bar 21 and ~bar 96 the strategy is silently unable to enter (confluence can never be satisfied with _slow_dir == 0). Correct and non-look-ahead, but it costs ~16 days of every walk-forward window and would show up as a dead preamble rather than an explicit warm-up gate.

Verification Results

Sandbox economics contradict the pre-registered claim, and they do so at the SOURCE'S OWN OPTIMUM (fast=18, slow=15, trail=3.033 carried over verbatim), so the usual 'unoptimized draw' excuse is weaker here than normal: avg_trade_return_pct is -0.088% against a pre-registered +0.45% (5x round-trip), PF 0.966, Sharpe -0.137, total_return -2.27% over 172 trades / 799 days. Commissions are 5.78% of gross and impact $1,122, so cost is not the whole story - gross capture per trade is only marginally positive. Regime attribution is the opposite of what a trend-follower should show: stressed tercile -10.96% (sharpe -1.34), calm -0.26%, with all the profit in the middle tercile (+7.28%) - i.e. the confluence gate is not capturing the volatile trends it is designed for on HL's price series. Two further things the analyst should weigh at backtest review: (1) FUNDING IS NOT MODELLED on Hyperliquid (funding_events_available: 0) while the book holds ~3.6 days on an hourly funding clock, so the measured PnL carries an unbooked +-0.05-0.15%/trade - the hypothesis flags this honestly but it means the HL number is a price-and-fee result only; (2) the 4H series starts 2024-01-22 (~2.6y, ~5,700 bars) and produces only ~55-75 round trips/year, so a 3-window walk-forward plus a 6-month holdout will be splitting roughly 200 lifetime trades - expect wide Sharpe CIs (sandbox CI already spans -1.57 to +1.28). The code is a faithful transfer; if the venue transfer is going to be judged, judge it on the full-history run with these caveats attached.

Backtest Review

Faithful verbatim transfer of the survivor mechanism: 172 trades over 799 days, 4,787 bars, no entry-diagnostic drops, metrics_reliable=true — a clean measurement of the venue-transfer question.

Backtest Review

Funding IS credited on this run (26,347 funding events, per-trade funding field populated), so the hypothesis's flagged measurement gap is actually closed.

Backtest Review

Trades match the hypothesis (80 long / 92 short, ~3.6d holds, ATR/regime exits) — not a coding defect.

Backtest Review

Negative expectancy on an adequate sample: PF 0.90, Sharpe -0.137, -2.27% total, expectancy -$39.34/trade, avg_trade_return_pct -0.088% vs a 0.15% floor and a +0.45% pre-registration.

Backtest Review

Verified on the detail file: gross PRICE PnL is only +$1,497 over 172 trades (~0.02% of notional/trade) before $3,777 commission and $4,487 funding paid — price capture is ~zero, so this is not a fee-calibration problem.

Backtest Review

Short leg is the break: mean price capture LONG +0.409%/trade vs SHORT -0.744%/trade over 92 shorts.

Backtest Review

Loses in 2024 and 2025, positive only in 2026's 23 trades; 760 days underwater, 11 consecutive losses.

Backtest Review

Regime attribution inverts the trend premise (stressed -10.97%, Sharpe -1.34; all profit in the middle vol tercile), confirming QA's concern.

Backtest Review

Sharpe CI -1.50 to +1.23, PSR 0.42 — a 3-window walk-forward plus holdout would split ~170 lifetime trades.

Outcome Summary

BtcHyperliquidDualTimeframeMomentumC-078dad301a

Outcome Summary

This run was an execution-readiness rehearsal rather than a new alpha claim — an exact transfer of the factory's #1 Binance survivor onto Hyperliquid's own price series, fees and hourly funding clock, with a pre-registered bar deliberately set below the source's. The transfer executed cleanly (172 trades, no entry-diagnostic drops, metrics_reliable, and funding actually credited, closing the hypothesis's flagged measurement gap), but the economics did not follow: -2.27% total return, Sharpe -0.137, PF 0.90 and -0.088% per trade, losing in 2024 and 2025 and spending 760 days underwater. The decisive detail was that gross price PnL was roughly zero (+$1,497 over 172 trades) before $3,777 commission and $4,487 funding, with the short leg (-0.744%/trade) erasing a still-working long leg (+0.409%/trade). The analyst abandoned it at backtest review on iteration 1, before spending the 3-phase optimization; the analyst and risk-officer post-optimization stages were never reached.

Outcome Summary

A mechanism's edge is venue- and window-specific: transferring a proven long-short rule unchanged can lose the symmetry that made it work, so check each leg's gross price capture separately before assuming costs are the obstacle.

Outcome Summary

The backtest-review gate returned abandon before any optimization ran, citing negative expectancy (-$39.34/trade) on a reliable 172-trade sample where the long leg still captured +0.409%/trade but the 92 shorts lost -0.744%/trade. With near-zero gross price capture, optimization could not plausibly overcome a 0.09% round trip plus Hyperliquid's hourly funding on ~3.6-day holds.

Outcome Summary

A verbatim venue transfer of the factory's best Binance USD-M survivor: a long-short dual-timeframe momentum-confluence trend follower on BTCUSD.HYPERLIQUID requiring a 4H fast leg and a daily slow leg to agree, flat on disagreement, exiting on an ATR trailing stop or a daily regime flip.

Outcome Summary

Over 799 days and 4,787 4H bars it took 172 trades (80 long / 92 short) for -2.27% total return, Sharpe -0.137, profit factor 0.90, win rate 36.0%, max drawdown 10.97% and avg_trade_return_pct of -0.088% versus the 0.15% viability floor and a pre-registered +0.45%. Gross price PnL was only +$1,497 against $3,777 of commission and $4,487 of funding actually paid; regime attribution inverted the trend premise (stressed tercile -10.97%, Sharpe -1.34).
Strategy report

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