BtcHyperliquidFlatRegimeRangeMeanReversionLS
Hypotheses
BTC Hyperliquid Regime-Gated Range Mean-Reversion, Long-Short (Single-Instrument BTCUSD.HYPERLIQUID Perp, 4H Bars — Fade Statistically-Extreme Deviations From a FLAT Moving Average ONLY in Confirmed Non-Trending Regimes, Exit-to-Mean Favorable-RR, Pure OHLCV, 3-Parameter)
Hypotheses
A LONG-SHORT, single-instrument, pure-OHLCV mean-reversion strategy on BTCUSD.HYPERLIQUID 4H bars that fades statistically-extreme deviations from a moving average, but ONLY while a regime gate confirms the market is RANGING (flat MA slope) — and stands completely flat whenever the MA is trending. It is a deliberately different FAMILY from everything I have proposed or that has collided this session: not trend/breakout/pullback (which enter WITH extension and keep overfitting or dying), not tight relative-value pairs (fee_edge), not multi-leg options or supplementary-event ideas (which die in the developer stage on swaps/timeouts). It stays inside the only construction the developer reliably ships — single-instrument, pure-OHLCV, standard incremental indicators, no supplementary feed. Crucially it is engineered against the two documented reasons generic Bollinger/RSI mean-reversion is an anti-pattern: (1) it fails because it fades inside trends — fixed here by the FLAT-MA regime gate that forbids any entry unless directionality is low; (2) it fails on inverted reward:risk (tiny mean-reversion wins, large trend-break losses) — fixed here by an exit-to-MEAN target that is LARGER than the beyond-the-band stop (favorable RR ≥1.5). It fills the two biggest structural gaps after options — HYPERLIQUID venue (6.5% vs a ≥20% quota, shifting off Binance's 71%) and LONG-SHORT direction (13.5% vs an 86%-long-only book) — plus the under-target short/mid horizon. 4H bars on Hyperliquid give ~2.3 years of history (ample, and well inside the ~5000-candle cap) and enough range-extreme events for statistically meaningful sampling. Only 3 parameters, and the regime gate uses a fixed, non-tuned slope threshold to limit overfitting exposure.
Hypotheses
Implements the hypothesis exactly and encodes both of its engineered defences as code, not intent. (1) 'Fade only in confirmed non-trending regimes': entry is hard-gated on the moving average itself being flat — the MA's drift over slope_lookback=12 bars (2 days) must be <= flat_slope_atr=1.0 ATR, an ATR-normalised (scale-free, regime-adaptive) test with a FIXED threshold that is not exposed as a tunable, and a regime flip while losing force-closes the position so the strategy can never sit inside a trend it faded. (2) 'Favourable RR >= 1.5': the target is the MEAN (|z| <= exit_z = 0.25), a distance of (entry_z - exit_z) ~ 1.75 sigma, versus a stop of stop_z_eff sigma beyond the band, and stop_z_eff is clamped to (entry_z - exit_z)/rr_min so no optimizer setting can invert the reward:risk — this is the structural answer to the inverted-RR graveyard rather than a hoped-for one. Fee viability: entries require sigma >= 0.3% of price, so the minimum target move is ~0.52% against Hyperliquid's ~0.09% round-trip taker cost (5.8x cover), and the 4H timeframe keeps turnover modest. Venue is HYPERLIQUID perp because the strategy is genuinely long-short (a CASH spot account cannot short) — filling the venue and direction gaps the hypothesis targets; leverage stays 1.0 (a MARGIN account at 1x still holds shorts) and no sizing path reads leverage, so nothing is inert. Per past learnings on blow-ups I risk only 1% of equity per trade over the actual stop distance AND cap gross notional at 0.5x equity independently of the equity path, so losses cannot compound into position size. Per the zero-trade learnings the gate stack is deliberately shallow (one regime test plus one z threshold, no ANDed RSI/ADX/VWAP confluence), the warmup is only 44 bars (~7 days at 4H) so it is a small fraction of any sandbox window, and the signal is a continuous z-score recomputed every bar (never gated to a constant), with per-bar diagnostics logged at stop so any zero-trade outcome reports the exact blocking reason. Data verified present: BTCUSD.HYPERLIQUID-4-HOUR-LAST-EXTERNAL exists in the catalog.
Hypotheses
Decisive negative edge, not an optimization candidate. Across 194 trades over 2.5 years the strategy is a net loser (profit_factor 0.75, expectancy -$114.6/trade, total_return -22.2%, Sharpe -0.386) with a NEGATIVE avg_trade_return_pct (-0.079%) and losses in every year (2024 -19.7%, 2025 -3.5%, 2026 +0.4%). The two structural fixes the hypothesis was built on — the flat-MA regime gate and the RR>=1.5 exit-to-mean — did not produce an edge: a 0.335 win rate with avg_win only ~1.5x avg_loss cannot be profitable, i.e. the mean-reversion anti-pattern reproduced despite the guards. Optimization fits parameters to data; it cannot flip a negative-expectancy signal that loses across a decisive sample and every regime into a positive one. Abandon rather than spend 2 hours optimizing.
Implementation
Long-short, single-instrument, pure-OHLCV mean-reversion on BTCUSD.HYPERLIQUID 4H bars. Every bar it computes a continuous reversion score -(close - SMA(ma_length)) / rolling-sigma. It BUYS when the score exceeds +entry_z (price stretched entry_z sigma below the mean) and SELLS when it falls below -entry_z, but ONLY while a fixed, non-tuned regime gate confirms the mean is FLAT: |SMA(t) - SMA(t-12)| <= 1.0 x ATR(14). Exits are, in priority order: reversion to the mean (|z| <= exit_z), an adverse excursion of stop_z_eff sigma beyond the entry band, a regime break while under water, or a 30-bar time stop. The stop is clamped to stop_z_eff = min(stop_z, (entry_z - exit_z)/1.5) so the structure's reward:risk is always >= 1.5. Sizing risks 1% of equity over the stop distance with gross notional capped at 0.5x equity. Three tunables: ma_length, entry_z, stop_z.
Verification Results
Analyst call at backtest review: the sample is measurable and fee-clearing, so it is worth a look, but PF 1.19 / Sharpe CI crossing zero means the edge must strengthen materially under the fuller backtest window (2.3y of 4H history) and survive walk-forward before it is trustworthy. Do not read the +577% headline return as edge -- see the drawdown note.
Verification Results
WEAK / STATISTICALLY-UNPROVEN EDGE -- for the analyst's BACKTEST_REVIEW decision, not a code fault. Over a measurable 69-trade / 364-day sample the Sharpe is 0.278 with a CI of [-1.37, 1.86] that straddles zero, profit_factor is a marginal 1.19, and win_rate is 0.39. The favorable-RR construction did work (avg_win $1324 ~= 1.85x avg_loss $714, so the inverted-RR failure mode is genuinely avoided), and the per-trade edge clears fees (avg_trade_return_pct 0.327% vs ~0.09% HL round-trip), so this is neither a fee-edge nor an inverted-RR death. But the edge is thin and not yet distinguishable from zero at this sample. Note also L7: pure-OHLCV mean-reversion (z-score/Bollinger fade) is a historically zero-survivor family; the flat-MA regime gate is a real structural differentiator from the naked anti-pattern, but the analyst should weigh the weak Sharpe against that base rate when choosing optimize / iterate / abandon.
Verification Results
Confirm whether max_drawdown/total_return are normalized to initial capital vs peak equity on this venue; if initial-capital-normalized on a compounding curve, restate against peak equity so the risk figure is interpretable. The strategy's own risk controls (1% risk, 0.5x cap) are correctly implemented.
Verification Results
IMPLAUSIBLE RISK-METRIC UNITS -- verify before trusting. max_drawdown is reported as 6.63 (663%, CI [4.18, 18.67]) and total_return as 5.77 (577%) despite leverage 1.0, risk_frac 1%, and an independent 0.5x-equity notional cap that is clearly binding (avg_position_pct 48.9%), with liquidated=false. A literal 663% drawdown is impossible without liquidation, so this is almost certainly a metric measured against INITIAL capital on a compounding equity curve (the same >100% max_drawdown pattern appears on other HYPERLIQUID sandbox runs this session, e.g. 321% and 183%), not a real 6.6x loss. The sizing code itself is sound (notional = min(equity*risk_frac/stop_dist, equity*0.5), capped, no compounding blow-up path). Flagging so the analyst confirms the drawdown/return units rather than treating 663% as a genuine risk figure or +577% as genuine edge.
Verification Results
Optional: reconcile the docstring wording with the entry-price-relative pnl stop, or measure both target and stop in the same units (both z-based or both price-based) for exactness. No change required for correctness.
Verification Results
MINOR spec-vs-implementation nuance (not a defect). The docstring describes the stop as 'stop_z sigma FURTHER beyond the entry band', but the implementation measures the stop as an adverse pnl_pct move of stop_z_eff x sigma% from the ENTRY PRICE (should_exit: pnl_pct <= -ctx['stop_pct'], stop_pct = stop_z_eff * sigma_pct floored at min_stop_pct). Additionally the TARGET is evaluated on the live per-bar z (|z| <= exit_z) while the STOP is a fixed percent captured at entry, so as sigma drifts intra-trade the two legs are measured on slightly different yardsticks. Neither breaks the RR>=1.5 intent (stop_z_eff is clamped to (entry_z-exit_z)/rr_min and the realized avg_win/avg_loss confirms favorable RR), but the 'beyond the band' wording overstates how far the stop sits from entry.
Backtest Review
Trades implement the hypothesis: 194 trades, genuinely two-sided (97 long / 97 short), on the intended BTCUSD.HYPERLIQUID 4H venue with no data trap
Backtest Review
Decisive sample size (194 trades over 2.5 years) — the negative result is trustworthy, not small-sample noise
Backtest Review
Negative edge across a decisive sample: profit_factor 0.75 (< 1.0), expectancy -$114.6/trade, total_return -22.2%, Sharpe -0.386
Backtest Review
avg_trade_return_pct -0.079% is NEGATIVE — below the fee floor before costs even matter; the signal has no gross edge
Backtest Review
Loses in every year traded (2024 -19.7%, 2025 -3.5%, 2026 +0.4%) — no profitable regime, so it is not a regime-timing miss
Backtest Review
The hypothesis's structural fixes failed in practice: win_rate 0.335 with avg_win ($1029) only ~1.5x avg_loss ($691) is far too low a hit rate to profit — the mean-reversion anti-pattern reproduced despite the flat-MA gate and RR>=1.5 exit
Backtest Review
avg_position_pct 49% shows the 0.5x max_notional cap binds on nearly every trade, so risk-based sizing isn't actually governing exposure
Outcome Summary
This strategy set out to make mean-reversion work by fading MA deviations on BTC Hyperliquid 4H bars only in flat (non-trending) regimes and forcing a reward:risk of at least 1.5, explicitly engineered against the two documented reasons generic Bollinger/RSI reversion fails. It reached the backtest stage with a genuinely two-sided, decisive sample of 194 trades over 2.5 years, but the result was a clear net loss (profit_factor 0.75, Sharpe -0.386, -22.2% total return, negative per-trade return) that lost money in every year. The analyst abandoned it at the pre-optimization backtest-review gate, concluding the structural fixes had not created an edge and optimization could not rescue a negative-expectancy signal. It was therefore abandoned after one iteration without reaching optimization, analysis, or risk review — though notably with a trustworthy negative result rather than an unmeasurable one.
Outcome Summary
Structural guards against the mean-reversion anti-pattern (a regime gate plus favorable reward:risk) do not by themselves create an edge — a 0.335 win rate with avg_win only ~1.5x avg_loss cannot be profitable, and a negative gross avg_trade_return_pct means there is nothing for optimization to salvage.
Outcome Summary
It was abandoned at the backtest-review gate on the first iteration: the analyst ruled it a decisive negative edge, not an optimization candidate, because the two structural fixes (flat-MA gate and RR≥1.5 exit) failed to produce a profitable signal and optimization cannot flip a negative-expectancy result that loses across a large sample and every regime.
Outcome Summary
It faded statistically-extreme deviations from a moving average on BTCUSD.HYPERLIQUID 4H bars as a long-short, pure-OHLCV mean-reversion strategy — but only in confirmed non-trending regimes (flat-MA slope gate) and with a favorable reward:risk exit-to-mean (RR ≥ 1.5) to escape the two classic Bollinger/RSI failure modes.
Outcome Summary
Unlike prior iterations, it cleared verification and backtested cleanly with a decisive sample: 194 trades (97 long / 97 short) over 919 data days, but with a negative edge — profit_factor 0.75, Sharpe -0.386, total_return -22.2%, expectancy -$114.6/trade, win_rate 0.335, and a negative avg_trade_return_pct of -0.079%, losing in every year traded.
Backtest and paper results are hypothetical. Trading involves risk of loss.