BnbRangeFadeOpenInterestFlatnessGatedLS
Hypotheses
Range-Fade Gated by Open-Interest Flatness, Single-Venue Long-Short (Single-Instrument BNBUSDT.BINANCE USD-M — Buy the Lower Band / Sell the Upper Band ONLY When Open Interest Is FLAT = a Balanced, Leverage-Neutral RANGING Market That Mean-Reverts; Stand Aside When OI Is EXPANDING = New Leverage Building a Trend; Mid-Band Exit + ATR Stop, 3-Parameter)
Hypotheses
A LONG-SHORT, SINGLE-INSTRUMENT, SINGLE-VENUE RANGE mean-reversion strategy on BNBUSDT.BINANCE USD-M perpetual. This is a deliberately different STRATEGY TYPE from my in-flight ideas (all of which are momentum/continuation or extreme-fade reversals) and it uses OPEN INTEREST in a genuinely new ROLE: not as a directional-momentum confirm (OI expansion), but as a RANGING-REGIME CLASSIFIER via OI FLATNESS. Rationale for the regime gate: naive band mean-reversion (Bollinger/Keltner fade) fails in crypto because it gets run over in trends — but trends in perps are built by fresh leverage ENTERING (rising OI), whereas balanced, mean-reverting ranges occur when open interest is FLAT (no net new leverage, participants two-sided and rotating). So the strategy only fades the range when OI is flat (the market is genuinely balanced and reverts), and stands completely aside when OI is expanding (leverage is building a directional move — do NOT fade it). The OI-flatness gate is orthogonal to price and is the element that makes this not a dead pure-OHLCV mean-reversion (satisfies L42) — it is a regime filter, not another price indicator. Reliability note: this stays on BINANCE USD-M where OI is well-populated in the sandbox (unlike COIN-M, whose OI feed loops in verification), uses core OHLCV + the USD-M OI series only, and is kept to THREE real parameters after a prior strategy died at Layer-2 from parameter bloat. Single-venue, single-instrument — no cross-venue leg problem (L44), no options feed (L43), no taker/premium feeds (which have shown Layer-2 fragility). BNBUSDT chosen as a liquid major perp that spends long stretches range-bound (frequent fade setups) with wide-enough bands that reversion targets clear the 0.10% USD-M round trip, and it is a fresh instrument vs BTC/ETH/SOL/DOGE/AVAX/LINK already in flight. ENTRY (4h bars + same-venue OI): compute a `band_len`-period moving average and ±`band_k`×stdev bands, and oi_change = OI_now/OI[`band_len`]-1; require |oi_change| < a flatness threshold (derived from band_len, not a 4th free param — e.g. within ±3%) to classify a RANGING regime; then ENTER LONG on a close at/below the lower band, ENTER SHORT on a close at/above the upper band; skip all signals when OI is expanding (trend regime) or when OI is stale/missing. Risk 2% equity/trade, ATR(14) hard stop beyond the band extreme, max exposure 25%, leverage 2x. EXIT on first of: price reverts to the mid-band (primary target); opposite band reached (stop-and-reverse candidate); ATR stop beyond the entry band (range broke — likely a regime change to trend); 18-bar (~3 day) time stop. Instruments: ["BNBUSDT.BINANCE"]. venue_type: futures. data_requirements: ["ohlcv", "open_interest"].
Hypotheses
ITERATION 2 — single-line fix for the reported `leverage_set_but_unused` gate, nothing else touched. The previous submission DID consume leverage in position_size, but it read it as `getattr(self.config, "leverage", 1.0)`; the static check looks for a direct `self.config.leverage` reference and did not recognise the getattr form, so it flagged the leverage as inert. The fix is to read it directly: `lev = max(1.0, float(self.config.leverage))`, plus a comment spelling out that this is what makes the 2x real (the gross-notional cap becomes 0.25 * 2 = 0.50 of equity, exactly twice the 1x notional, so the backtest is genuinely not identical to 1x). This is the same one-line change that cleared this gate on the LINK strategy. Nothing else changed: imports are untouched (no banned modules), the class structure, the continuous band-z signal, the OI-flatness regime classifier, every entry/exit condition, all thresholds, and the risk-side sizing term are byte-identical to previous_code — so the earlier layers that already passed stay passing. Behaviourally the sizing is unchanged from what was intended all along (getattr on a config that always defines `leverage` returned 2.0 anyway); this only makes the leverage consumption visible to the verifier. The rest of the design is as previously accepted: OI used as a ranging-regime classifier rather than a directional confirm (the orthogonal, non-price element per L42), the flatness cut derived as a rolling self-quantile rather than a fourth free parameter and therefore scale-invariant per L5, OI merged from the `metrics` Binance Vision mirror (244,790 5-minute rows for BNBUSDT from 2021-12 to 2026-05) and the recent-months `open_interest` fapi mirror so the full 365-day sandbox window is populated per L35, a one-time numpy series build with O(log n) at-or-before lookups (no lookahead, no per-bar cost that scales with history), FLAT on missing/stale OI with no price-only fallback, and double-capped sizing per L15.
Hypotheses
Decisive net loser with no edge and a catastrophic drawdown. profit_factor 0.70 (<1.0), total_return -51.6% over ~5 years, Sharpe -0.211 (CI [-0.89, 0.44], probabilistic_sharpe 0.26), information_ratio -0.91, and avg_trade_return_pct -0.289% (NEGATIVE) with expectancy -$170/trade across 303 trades. max_drawdown is 54.2% (CI high 85.8%) — a hard-floor violation (L19) that directly contradicts the 'balanced ranging regime that mean-reverts' thesis. It loses in 5 of 6 years (2022 -14.5%, 2024 -27.0%, 2025 -22.2%) with avg_loss ($1048) exceeding avg_win ($894). The hypothesis — that gating band mean-reversion to flat-OI ranging regimes avoids the trend run-overs that kill naive fades — is falsified: the OI-flatness-gated fade still gets run over. This is the range/mean-reversion fade family, repeatedly dead here (multiple funding/OI/VWAP-gated reversion and fade candidates abandoned this session for the same negative-edge reason — the regime/confirmation gate never rescues crypto mean-reversion). A negative avg_trade_return_pct (not merely sub-floor) means the signal is wrong-signed, so reducing frequency or retuning thresholds cannot help — there is no parameter region to tune toward, and reframing the same losing mechanism onto another instrument would lose again. Per L8 (never advance when total_return ≤ 0 or PF < 1.0) and L19 (DD > 50% hard abandon), abandon at BACKTEST_REVIEW rather than spend 2 hours optimizing.
Implementation
Long/short range mean-reversion on BNBUSDT.BINANCE USD-M perpetual (4-HOUR bars, 2x leverage) whose trades are gated by an OPEN-INTEREST FLATNESS regime classifier. Every bar it computes a `band_len`-period moving average and standard deviation and returns the negated band standard-score -(close - ma)/sd as the continuous signal, so the sign is the trade direction (price stretched above the mean -> negative -> sell the upper band; stretched below -> positive -> buy the lower band) and |signal| >= band_k is exactly 'closed at or beyond the band'. In parallel it computes oi_change = OI_now / OI[band_len bars ago] - 1 and classifies the market as RANGING when |oi_change| sits at or below the rolling median of its own recent |oi_change| history. Entry requires both: the OI regime is flat AND price has closed beyond the band. When OI is expanding or contracting sharply (leverage building a directional move) or the OI feed is stale/missing, the strategy takes no trade at all. Exits, first to fire: (1) an ATR stop placed beyond the entry band by stop_atr_mult x ATR(14), frozen at entry and tested intrabar — the range broke, which is the regime turning to trend; (2) the mid-band target, the moving average touched intrabar; (3) the opposite band touched intrabar; (4) an 18-bar (~3 day) time stop. Sizing risks 2% of equity at that stop distance, hard-capped at 25% x leverage (= 50% at 2x) of equity notional.
Verification Results
Verification failed (leverage_set_but_unused): config sets leverage=2.0 but the strategy never references leverage in sizing. Size positions on it — notional = equity * fraction * leverage / price (read self.config.leverage) — or set leverage=1.0. As written the leverage is inert and the backtest is identical to 1x.
Verification Results
Route to backtest-review for full multi-year evaluation (range + trend regimes) where the 0.15% floor applies; 38 trades is too small to declare it dead.
Verification Results
Sandbox net-negative (total_return -8.8%, Sharpe -0.72, PF 0.60, win_rate 0.447, avg_trade_return_pct -0.294% over 38 trades), per-trade below the 0.15% floor. NOT a structural fee-viability failure: moderate turnover (24, avg hold ~1 day) with fee-clearing moves (avg_win ~1.5%, avg_loss ~2%). The net loss is a low-win-rate directional edge miss over a small window — the short side underperformed (0.33 vs 0.55 long), i.e. upper-band fades got run over on up-moves despite the OI gate. A mean-reversion edge question, not fee churn.
Verification Results
Optimizer/analyst may find a stricter percentile (e.g. 0.3) isolates true ranges and improves win rate; sensitivity check worthwhile, not required.
Verification Results
Calibration note (not a defect): flat_pctile=0.5 (median of |oi_change|) classifies HALF of all bars as 'flat', a loose definition of a balanced range. The 3-searched-parameter claim still holds (flat_pctile is fixed, not searched), and using |oi_change| for both expansion and contraction is a defensible reading of 'flat', though the hypothesis emphasized standing aside on expansion.
Backtest Review
Clean, data-safe construction: single venue/instrument, OI-flatness used as an orthogonal regime classifier; deliberately 3 tunables; adequate trade count (303)
Backtest Review
profit_factor 0.70 (< 1.0) — the strategy loses money; total_return -51.6%
Backtest Review
avg_trade_return_pct NEGATIVE (-0.289%) with expectancy -$170/trade — the signal is wrong-signed, no fee/frequency change can fix it
Backtest Review
max_drawdown 54.2% (CI high 85.8%) — hard-floor violation (L19), contradicting the 'balanced ranging regime' thesis
Backtest Review
Sharpe -0.211 (CI [-0.89, 0.44]); information_ratio -0.91; probabilistic_sharpe 0.26 — no skill
Backtest Review
Negative in 5 of 6 years (2022 -14.5%, 2024 -27.0%, 2025 -22.2%); avg_loss > avg_win
Backtest Review
Range/mean-reversion fade family (repeatedly dead here); the OI-flatness regime gate did not rescue it
Outcome Summary
This strategy tried a fresh angle on the chronically-failing mean-reversion problem: fade Bollinger bands only when open interest is flat, on the theory that trends are built by fresh leverage entering (rising OI) while genuine mean-reverting ranges occur when OI is flat and participants are two-sided — using OI in a novel regime-classifier role rather than as a momentum confirm. The construction was clean and disciplined (single venue, three parameters, a scale-invariant self-quantile flatness cut, flat when OI is stale). But the backtest falsified the premise outright: profit factor 0.70, a -51.6% return, a 54.2% drawdown that breached the hard-abandon floor and flatly contradicted the balanced-range thesis, and losses in 5 of 6 years with a wrong-signed per-trade edge. The analyst abandoned it at backtest review as another member of the repeatedly-dead range/mean-reversion fade family — the OI-flatness gate did not prevent the fade from being run over, exactly as the session's other regime-gated reversion candidates had failed — with no edge anywhere to optimize toward.
Outcome Summary
Using open-interest flatness as a ranging-regime classifier does not rescue band mean-reversion — like the funding/VWAP/OI-gated reversion siblings abandoned the same session, the regime/confirmation gate never saves crypto mean-reversion, which still gets run over in trends, producing a wrong-signed per-trade edge and a >50% drawdown with no parameter region to tune toward.
Outcome Summary
It was abandoned at the BACKTEST_REVIEW gate under both the total-return ≤ 0 / profit-factor < 1.0 rule and the >50% drawdown hard-abandon rule: the OI-flatness regime gate was falsified — the gated band fade still got run over — with a 54.2% drawdown directly contradicting the balanced-ranging thesis. Because the per-trade return is negative (wrong-signed), no threshold or frequency change could help, so it never reached optimization or analysis.
Outcome Summary
A long-short, single-instrument, single-venue range mean-reversion strategy on the BNBUSDT.BINANCE USD-M perp that fades Bollinger-style bands (buy the lower / sell the upper) but only when open interest is flat — using OI flatness as a ranging-regime classifier (balanced, leverage-neutral tape that mean-reverts) and standing aside when OI is expanding (fresh leverage building a trend), exiting on a mid-band reversion target, opposite band, ATR stop, or time stop.
Outcome Summary
It was a decisive net loser with a catastrophic drawdown: profit factor 0.70, total return -51.6% over ~5 years, avg_trade_return_pct -0.289% (negative, expectancy -$170/trade), Sharpe -0.211 (CI [-0.89, 0.44]), information ratio -0.91, and max drawdown 54.2% (CI to 85.8%) across 303 trades. It lost in 5 of 6 years (2024 -27.0%, 2025 -22.2%) with avg loss ($1,048) exceeding avg win ($894).
Backtest and paper results are hypothetical. Trading involves risk of loss.