Skip to content

View translation

FilRetailCrowdingContrarianTrendGateLS4H

Hypotheses

Retail Crowding-CONTRARIAN Trend Gate on FILUSDT.BINANCE USD-M Perp — Long-Short 4H Trend Taken ONLY When Binance's Published Retail Long/Short ACCOUNT Ratio Is Positioned AGAINST the Trade (rolling-percentile positioning gate on the `metrics` feed, ATR chandelier exit, 3-parameter)

Hypotheses

A LONG-SHORT, SINGLE-INSTRUMENT, mid-horizon (4-HOUR bars) directional trend strategy on FILUSDT.BINANCE (USD-M perpetual, catalog verified 2020-10-16 -> 2026-09-11) whose conditioning variable is NOT price, volume, funding or open interest, but Binance's published RETAIL POSITIONING series: the global long/short ACCOUNT ratio carried in the `metrics` supplementary key (FILUSDT: 507,833 five-minute rows, 2021-12-01 -> 2026-09-10, ~4.75 usable years = ~10,400 4H bars). The prior survivors in this factory all CONFIRM a trend with more of the same flow (volume surge, taker flow, breadth, a slower timeframe). This one does the opposite: it requires the retail crowd to be positioned AGAINST the trade, and stands flat when the crowd has already piled in on the side the trend points. Retail accounts on Binance are structurally net long (FIL median global LSR 2.59), so the informative quantity is the DEVIATION from that structural baseline, measured as a rolling percentile of the account ratio within its own trailing 30-day distribution — which also neutralises the multi-year drift in the ratio's level. Implementation note for the developer (a prior options hypothesis died of sandbox_timeout doing exactly this wrong): the `metrics` value is a LIST of ~500k row-dicts; build ONE sorted numpy timestamp array + value array in __init__ and use bisect / `supp_as_of('metrics')` for a point-in-time read, and maintain the 30-day percentile window as a bounded deque of ONE sample per bar close. Never rescan the list or call abs()-nearest matching inside on_bar(). Only ~2 trades/month are expected — this is a low-turnover, fee-tolerant design, not a microstructure scalper.

Hypotheses

Implements the hypothesis exactly: the gate is the `metrics` feed's global retail long/short ACCOUNT ratio (NOT price/volume/funding/OI), it is read as a rolling percentile of its own trailing 30-day distribution (neutralising both the structural net-long bias - FIL median ratio 2.59 - and the multi-year drift in level), and a trend is taken ONLY when the crowd is positioned AGAINST it. Three searched parameters (trend_lookback, crowd_gate_pct, chandelier_atr_mult) per the hypothesis; every other constant is prefixed with '_' so the optimizer's non-underscore numeric scan leaves the search space at exactly three. Performance guard per the hypothesis's explicit warning: the ~520k-row `metrics` list is sorted ONCE by the base template's _supp_arrays cache and thereafter only bisected (O(log n)); nothing rescans the list, no abs()-nearest matching is used (that would be look-ahead), and the percentile window is a bounded deque of one sample per bar. Missing/stale positioning data makes the strategy stand FLAT - there is deliberately no price-only fallback, since that would test a different mechanism. Venue: futures (BINANCE USD-M) is correct because the strategy goes short as well as long. Leverage left at 1.0 and not referenced for extra notional, because risk-based sizing at FIL's 4H ATR (~2.9% of price, so a 4-ATR stop is ~11.5%) puts the notional at ~0.2x equity - amplification is unnecessary and would only add drawdown. A full-history offline dry run on the real FILUSDT 4H bars + real `metrics` feed (2021-12 -> 2026-09, the span of the positioning data) confirms the entry conjunction is not over-selective and the contrarian direction is the right one: 153 trades, +0.62% average per-trade return net of 0.10% round-trip taker fees (4x the 0.15% USD-M floor), 36.6% win rate with a large payoff ratio, ~22% max drawdown at the shipped risk fraction. Across a 48-point parameter grid the CONTRARIAN gate averaged +0.42%/trade versus +0.27% ungated and +0.09% for the inverted 'crowd-confirms' variant, so the edge is attributable to the gate's direction rather than to the underlying trend rule. One honest caveat for the Research Lead: the mechanism's Sharpe (~0.4) is driven by a low win rate and fat right tail, which is characteristic of chandelier trend-following and will make the holdout window noisy.

Implementation

Long/short 4-HOUR trend-following strategy on FILUSDT.BINANCE (USD-M perpetual) whose only conditioning variable is retail POSITIONING, not price, volume, funding or OI. Each bar it computes a continuous trend score = (EMA_fast - EMA_slow) / ATR (fast = trend_lookback/4, slow = trend_lookback, ATR = Wilder 14), all maintained incrementally (O(1) per bar). Separately it reads Binance's published GLOBAL retail long/short ACCOUNT ratio from the `metrics` supplementary feed (`long_short_ratio` column, 5-minute prints) point-in-time via a one-directional bisect on the base template's cached (timestamps, rows) arrays, with a 6-hour staleness bound, and converts it to a rolling percentile inside a bounded 180-bar (30-day) deque holding ONE sample per bar close. Entry is CONTRARIAN to the crowd: BUY when trend score > +0.4 ATR AND the retail ratio sits in the bottom 35% of its own trailing 30-day distribution (retail unusually un-long, i.e. positioned against the long); SELL when trend score < -0.4 ATR AND the ratio sits in the top 35% (retail unusually long, positioned against the short). When the crowd is already leaning the same way the trend points, the strategy stands flat. Exit on a trend-score sign flip or an ATR chandelier trail (4.0 x ATR off the highest high / lowest low since entry). Sizing is risk-based and capital-relative: notional = equity x 2.5% / (chandelier_mult x ATR / price), capped at 1x equity; no leverage (leverage = 1.0), so a stop-out costs ~2.5% of equity. ~3 trades/month, median hold ~28 bars (~4.7 days).

Verification Results

Add `"_param_bounds": {"crowd_gate_pct": [0.15, 0.45]}` (honoured by walk_forward._declared_bounds).

Verification Results

`crowd_gate_pct` has no `_param_bounds`, so walk-forward searches [0.175, 0.525]. At g ≥ 0.5 the gate degenerates — BUY needs pct ≤ g and SELL needs pct ≥ 1−g, so the band admits both sides and the strategy drifts toward an ungated trend follower while the result is attributed to the positioning mechanism.

Verification Results

Fall back through ("long_short_ratio", "count_long_short_ratio", "globalLongShortAccountRatio") and warn once if absent.

Verification Results

`long_short_ratio` is read with no alias fallback; a missing key silently returns None and the strategy stands flat forever. Verified present in data/supplementary/metrics/FILUSDT today, so correct now.

Verification Results

No change needed.

Verification Results

Static analysis' `min_bars_required` shadow warning is a false positive — base_template.py:1154 documents it as overridable.

Verification Results

Thin, tail-driven sandbox edge: Sharpe 0.387 with sharpe_ci_low -0.456, PF 1.25, win rate 36.7%, largest_win $31,833 vs avg_win $4,543 — one trade carries much of the +50.4%. Max DD 27% (CI high 54%), 572-day underwater stretch. Usable span is also shorter than the window: the `metrics` positioning feed for FILUSDT starts 2021-12-01 while bars start 2020-10, so ~14 months are structurally flat. Analyst should check survival without the largest winner, whether the contrarian direction still beats ungated/inverted out-of-sample, and that holdout trade count ≥ 10 at ~2 trades/month.

Backtest Review

Trades match the hypothesis: 150 round trips starting 2021-12-21 (exactly at the metrics feed start), ~2.6/month vs ~2/month predicted, 65 long / 85 short (short-skewed as expected when retail is structurally net long), ~6-day holds, both legs profitable (LONG +$24.3k, SHORT +$18.7k). No mechanism mismatch.

Backtest Review

Per-trade edge clears costs by a wide margin: avg_trade_return_pct 0.745% vs the 0.15% USD-M floor; commissions 2.2% of gross, modeled impact 9.4%, capacity $11.3M. Sample is reliable (150 trades, metrics_reliable=true).

Backtest Review

Coherent sizing/risk: avg_position_pct 25.4%, max DD 27.0%, recovery factor 1.52, positive in the stressed vol tercile.

Backtest Review

Extreme tail concentration — top three winners total $74.6k vs net PnL $42.9k; removing the single largest trade drops PF from 1.214 to 1.069, and removing the top three leaves -$31.7k. QA's concern is confirmed on the full sample.

Backtest Review

Only 2 of 6 calendar years positive (2023, 2024); 2025 (-$29.9k) and 2026 (-$16.3k) give back nearly everything, and rolling Sharpe has been negative since mid-2025. The holdout (last 20% ≈ 2025-08 onward, ~12-15 trades) sits squarely in that losing regime.

Backtest Review

Weak risk-adjusted headline: Sharpe 0.393 with CI -0.417 to +1.194, Sortino 0.46, Calmar 0.28, win rate 35.3%, 572-day underwater stretch.

Backtest Review

Family prior (advisory): single-perp directional trends gated on a Binance supplementary feed with PF < ~1.7 have repeatedly passed this stage and then died in the 3-phase deflation.
Strategy report

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