Skip to content

View original

XrpRsi2ReversionRangingGatedLS

Hypotheses

XRP USD-M Intraday RSI(2) Mean-Reversion, Long-Short, Ranging-Regime Gated (BINANCE Perp, 15m Bars, Connors-Style Fade of Short-Term Oversold/Overbought Extremes Back to a Fast EMA, Single-Instrument, Pure OHLCV, 4-Parameter)

Hypotheses

A LONG-SHORT, single-instrument intraday mean-reversion strategy on XRPUSDT.BINANCE (USD-M perpetual, 15-minute bars) using a Connors-style RSI(2) signal — a DIFFERENT reversion trigger from the VWAP-z and Bollinger-band variants already in the pipeline, applied to a DIFFERENT symbol (XRP, which is exceptionally liquid and one of the most whippy/mean-reverting majors intraday). It is the product of this session's hard evidence about what produces a CLEAN, survivable backtest: the only long-short mechanism that has reached paper here is single-instrument intraday mean-reversion (SOL VWAP), while EVERY multi-asset perp basket I tried died on non-diagnostic backtest artifacts (445% vol / Sharpe>5), >50% drawdowns, or diluted factors, and every two-leg perp died on implausible-return risk_reject. So this is deliberately SINGLE-INSTRUMENT (clean P&L, no basket-aggregation or leg-sizing artifacts), PURE OHLCV (best-surviving tag), STANDARD BINANCE USD-M linear venue, and exactly 4 parameters (avoiding both overfit — the 202x killer — and the Layer-2 'too many __init__ attributes' failure that sank my 10-parameter taker-flow attempt). A ranging-regime (ADX) gate keeps it out of the trend days that are mean-reversion's main failure mode. Fills the two most under-represented survivable buckets: DIRECTION (long_short vs the 84.8% long-only over-weight) and HORIZON (short_1m_15m, 5.3% vs ≥10%).

Hypotheses

Iteration 3 fixes the Layer-4 economic block (L6), which is fundamental, not a code bug — the reviewer credited the code as correct (right polarity, ADX gate, incremental Wilder RSI/EMA/ADX, working de-churn) and blocked purely on fee-viability: on 15m the RSI(2) reversion captures were smaller than the 0.10% round-trip futures fee, giving commission 45.36% of gross and negative expectancy (avg_win 48 << avg_loss 142), ending in liquidation — the identical fate of the AVAX (18.76%) and BNB (30.91%) 15m siblings. No amount of gating fixes sub-fee per-trade moves at 15m, so the decisive lever is the TIMEFRAME: at 2-hour bars each reversion move scales up ~2.8x (roughly sqrt of the 8x period increase) while the fixed fee is unchanged, and trade count collapses ~8x, dropping commission from ~45% of gross to a few percent. To turn expectancy positive I also aligned the defaults that drove the bad win/loss ratio: a fuller reversion target (ema_period 5 -> 10, larger average win) and a tighter stop (3% -> 2%, smaller average loss), plus a slightly lower risk_frac (0.15) as a ruin-probability safety belt. Crucially this is the SMALLEST change that addresses the reported failure: the entire signal path — RSI(2), the ADX ranging gate, the EMA-reversion exit, the min-hold/cooldown de-churn that fixed the Layer-3 timeout, and all incremental O(1) indicator code — is byte-for-byte unchanged; only the config bar_type and a handful of default parameter values move. Imports stay clean (no numpy, no banned imports). It remains a single-instrument, pure-OHLCV, symmetric long/short strategy on the standard BINANCE USD-M linear venue at leverage 1.0, still filling the DIRECTION (long/short) under-representation; it trades the short-term/2h horizon rather than 15m, an acceptable and necessary concession since the 15m variant is structurally fee-dead. XRP size precision (step 0.1) and the $5 min notional are respected.

Hypotheses

Decisively negative-expectancy single-name mean-reversion — no edge to optimize. Over 755 measured trades: profit_factor 0.671 (<1), avg_trade_return_pct -0.290% (negative), expectancy -$51.9/trade, total_return -40.6% over 6.5 years, Sharpe -0.536 with CI [-1.27, 0.24] (PSR 0.18), losing in all 7 years and every vol regime (calm -18%, stressed -27.6%). The iteration-3 move from 15m to 2H bars did not flip the reward:risk: win_rate is high (59%) but avg_win $180 < avg_loss $385 (RR ~0.47), the classic small-wins/large-losses mean-reversion signature. It is fee-fragile (commission 11.5% of gross), high-drawdown (41%, CI to 68%), with nearly all stress windows negative. This is the L55 single-name fade/reversion family (0/174 survivors) and the third RSI/Bollinger/VWAP Connors-fade variant to die identically this session; re-tuning timeframe, de-churn and thresholds has never lifted the class over costs. No parameter change flips a sub-0.7-PF, negative-per-trade, RR-inverted reversion that loses every year. Failure pattern: no_edge/fee_edge single-name mean-reversion, RR-inverted (L55).

Implementation

Long/short Connors-style RSI(2) mean-reversion on XRPUSDT.BINANCE USD-M perp, now on 2-HOUR bars, pure OHLCV. It fades short-term extremes (RSI(2) <= rsi_extreme -> long, >= 100-rsi_extreme -> short) only in a ranging regime (Wilder ADX(14) < adx_threshold), exiting on reversion to a fast EMA(ema_period), a hard price stop-loss, or a max-hold time stop, with a minimum hold and re-entry cooldown to de-churn. Moving from 15-minute to 2-hour bars makes each reversion capture multiples larger relative to the fixed 0.10% round-trip fee while cutting trade count (and commission drag) roughly eight-fold; a fuller EMA(10) reversion target and a tighter 2% stop raise the average-win/average-loss ratio. All indicators are incremental (O(1) per bar). Single instrument, symmetric long/short, no leverage. 4 tuned parameters: rsi_period, rsi_extreme, ema_period, adx_threshold.

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.

Backtest Review

Well-measured (755 trades over 6.5 years); clean 4-parameter pure-OHLCV construction with ADX regime gate and de-churn controls; no blow-up

Backtest Review

Incremental indicators (Layer-3 safe); distinct RSI(2) trigger and symbol from the pipeline siblings

Backtest Review

Negative expectancy: PF 0.671, avg_trade_return_pct -0.290%, expectancy -$51.9/trade, total_return -40.6%, Sharpe -0.536 (CI [-1.27, 0.24])

Backtest Review

Loses in all 7 years and every vol regime; RR inverted (avg_win $180 < avg_loss $385) — high win rate does not overcome loss asymmetry; the 2H timeframe change did not fix it

Backtest Review

Fee drag (commission 11.5% of gross); max_drawdown 41% (CI to 68%); nearly all stress windows negative

Backtest Review

L55 single-name fade/reversion family (0/174 survivors); third RSI/Bollinger/VWAP-fade variant to die identically this session

Iteration History

Verification failed (Layer 3 — sandbox backtest): smoke test exceeded the 300s wall-clock limit. This almost always means per-bar work that scales with history — e.g. rescanning the full funding/supplementary series, or rebuilding a list and calling min()/sorted() inside calculate_signal()/on_bar() on every bar. Precompute sorted timestamp arrays ONCE in __init__ and use bisect, or cache lookups keyed by timestamp, so per-bar cost is O(log n) not O(n).

Iteration History

Verification failed (Layer 4 — QA review): - FEE/EDGE FAILURE + liquidation; de-churn fixed the timeout but NOT the economics, and this is the WORST fee drag yet. Reliable sandbox: total_return -100%, liquidated 2022-10-01, PF 0.503, avg_win 48 << avg_loss 142 (negative expectancy), commission 45.36% of gross (vs AVAX 18.76%, BNB 30.91%). Kept on 15m + de-churned → still 5969 trades that can't clear the 0.10% RT fee. L6 pattern, not L17 bug (coherent win 0.598/PF 0.503), code correct. Per L6/checklist #7, block. - avg_position_pct 140% (despite risk_frac 0.20), skew +46, kurtosis 2181, vol 577%, and misleadingly-positive avg_trade_return_pct +0.019% (vs avg_trade_pnl_usd -28.36 / total -100%) are all near-zero-equity terminal-liquidation artifacts, not a sizing bug (position_size correctly computes 20% notional). Artifact-free facts: -100%, liquidated, PF 0.503, commission 45.36%. - CREDIT: code correct, de-churn works. Connors RSI(2) polarity right, ADX gate/EMA exit/stops correct, incremental Wilder RSI/EMA/ADX O(1), min_hold+cooldown correctly implemented and fixed the Layer-3 timeout. Block is purely economics.

Iteration History

Verification failed (Layer 4 — QA review): - NEGATIVE EDGE on a now-CLEAN backtest. The 2H move fixed fees/liquidation/metrics (like BNB's 1H move), and the trustworthy result proves no edge: total_return -40.57%, Sharpe -2.72 (CI -3.87 to -1.63, entirely <0), PF 0.662, avg_trade_return_pct -0.290% (worse than BNB's -0.185%). Fuller EMA(10) target didn't fix asymmetry (avg_win 178 << avg_loss 386). Commission now only 11.56%, so edge is NEGATIVE before fees. Not L17 bug (coherent win 0.588/PF 0.662/no liquidation), code correct. Per L6/checklist #7, block. - CREDIT: iter-3 changes correct, delivered diagnostic cleanliness. 2H + EMA(10) + 2% stop; RSI(2) polarity/ADX gate/EMA exit/de-churn/incremental indicators unchanged and correct. Clean backtest: no liquidation, coherent metrics (vol 6.99%, data_days 738), fees 11.56%. Block is purely that the trustworthy result reveals negative edge.
Strategy report

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