Skip to content

View translation

XrpMarketStructureTrendChangeSwingLS4H

Hypotheses

XRP Market-Structure Trend-Change Swing — Long-Short, Pure Price-Structure (XRPUSDT.BINANCE USD-M, 4H Swing Pivots — Enter WHEN Price Breaks the Last Significant Swing High/Low and Confirms a New Higher-High/Higher-Low (or Lower-Low/Lower-High) Sequence, Structure-Based Stop at the Invalidating Swing, Trail the New Trend; 3-Parameter)

Hypotheses

A LONG-SHORT, single-instrument directional strategy on XRPUSDT.BINANCE USD-M that trades genuine MARKET-STRUCTURE trend changes detected from PRICE STRUCTURE (swing pivots) — not moving-average/oscillator momentum (that's the BTC survivor and the class-prior-abandoned trend family) and not pullback-timing (my pending BNB idea). It is explicitly NOT a mean-reversion fade (L53), NOT a volatility-squeeze breakout (L54 — the trigger is a structural swing-break confirming a NEW trend sequence, not a compression expansion), NOT a basis/carry/cross-venue trade (that whole two-leg family keeps dying fee_edge — the ETH spot-perp basis just died sub-fee again), NOT options/COIN-M/cross-sectional. The mechanism: markets transition between trends via identifiable structure — an established downtrend prints lower-highs/lower-lows; the trend CHANGES when price takes out the most recent significant lower-high AND then holds a higher-low, establishing a higher-high/higher-low sequence. Entering AT that confirmed structure flip, with a stop just under the newly-formed higher-low, gives a tight, logical invalidation while the target is the ENTIRE new trend leg — reward:risk ~3:1+ and an average winner of multiple percent, which is the ONLY thing that clears the ~0.10% Binance USD-M round trip with margin. XRP is chosen deliberately: deep multi-year Binance USD-M liquidity, episodic large directional regimes (its moves are violent and sustained, ideal for structure-flip capture), and it is NOT one of the instruments in the recent trend-family failures (BTC survivor, ETH/SOL/AVAX/BNB). Fills the under-represented long-short bucket (13.3% vs the ≥45% implied by the ≤55% long-only cap) with a simple 3-parameter design.

Hypotheses

This iteration fixes the single reported failure — `leverage_set_but_unused` — and touches nothing else, so every layer that already passed stays passed. Two things were wrong in the previous submission. First, mechanically: the leverage reference was written as `getattr(self.config, "leverage", 1.0)`, which contains none of the tokens the consistency check scans for (`config.leverage`, `self.leverage`, `.leverage`), so the check could not see it. Second, and more importantly, the check's substantive point was correct — the declared 2.0 was genuinely inert. Sizing here is risk-first: quantity is set by the structural stop distance (`equity x risk_pct / dist`), and on 4H XRP a swing stop is typically ~2-3% of price, which puts gross notional at roughly 0.5-0.75x equity; the leverage only widened a cap (`equity x 0.6 x leverage`) that at 2.0 would sit at 1.2x equity and therefore almost never bind. The backtest really would have been byte-identical to 1x. Rather than manufacture a use for margin this strategy does not need — inflating risk_pct by the leverage would double per-trade risk to 3% of equity for no edge reason, exactly the compounding-sizing pattern that has blown up drawdowns elsewhere in this portfolio — I took the second option the feedback offers and set `leverage = 1.0`. The code now also reads it explicitly as `self.leverage = float(self.config.leverage or 1.0)` in `__init__` and uses `self.leverage` in the notional cap, so the multiplier the engine's margin model receives and the multiplier the sizing math applies are the same value rather than an implicit default, and the gate has an unambiguous reference to find. Signal logic, pivot detection, entry conditions, the ratcheting structural stop, imports and `_param_bounds` are unchanged from the code that cleared Layers 1-3.

Hypotheses

Outlier-driven, non-generalizing OHLCV swing-structure trend follower (L9/L41 class, 0/213 survival). The +96% total return is a mirage from ~2 extreme days — 2024-12-10 alone is +75.4% (return_kurtosis 43.1, skew 3.37) and accounts for essentially all of 2024's +53%; remove the outliers and there is no edge. Sharpe is only 0.50 with a CI [-0.13, 1.11] that straddles zero, and information_ratio -0.52 against a meaningful buy-hold benchmark means it UNDERPERFORMS holding XRP on a risk-adjusted basis — the headline is XRP's own directional beta (correlation 0.53) captured on a couple of lucky breaks, not alpha. The edge is not persistent (losing 2020/2022/2023, weak 2025-2026) and carries a 32% drawdown (CI to 51.5%). avg_trade_return_pct 2.32% is above fees but is itself dominated by the same outlier trades. Optimization would best-of-N overfit this fat-tailed noise and collapse in walk-forward OOS and the 15-day holdout, as this class does every time. Abandon at BACKTEST_REVIEW rather than spend the optimization budget.

Implementation

Long-short market-structure trend-change swing strategy on XRPUSDT.BINANCE USD-M perpetual, 4-hour bars. Swing pivots are confirmed from price structure alone (a bar whose high dominates the pivot_lookback bars on each side, and the mirror for lows), and the last two confirmed highs and lows are retained. A LONG is taken when price breaks the last significant swing high by break_buffer_atr x ATR while the most recent swing low is already higher than the one before it (the higher-low that defines the new uptrend), and the break is fresh (the prior close was not already beyond the level). SHORT is the exact mirror. The stop is structural — placed stop_buffer_atr x ATR under the newly-formed higher-low (above the lower-high for shorts) — and RATCHETS to each successive swing as the new trend prints, so the target is the whole trend leg with no fixed take-profit. calculate_signal returns a continuous, natural-unit decision variable every bar: (close - midpoint of the live swing range) / ATR. Sizing is risk-first (equity x risk_pct / stop distance) with a hard gross-notional cap of equity x max_notional_frac x leverage.

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

At BACKTEST_REVIEW, verify on the full ~6-year XRP span that the edge repeats across multiple independent trend legs; inspect the per-trade PnL distribution and robustness after removing the top winner.

Verification Results

Return hinges on a single trade — ex the best trade the sandbox is net negative. largest_win ~$8,004 exceeds the entire +5.17% net return, so the other 22 trades net to roughly -2.8%. More one-winner-dependent than the BNB sibling (where ex-best was ~breakeven). Trend-following legitimately earns on the fat tail, but on only 23 trades this makes the headline fragile.

Verification Results

Optimization should be aware the holdout may be near-empty; intrinsic to a low-frequency swing-structure mechanism, not a tunable defect.

Verification Results

Thin sample and 15-day holdout zero-trade risk. 23 trades over 362 days is below the ~100-trade floor for a single year (though ~140 over XRP's full ~6-year history clears it). At ~23/yr the Phase-3 15-day holdout may contain 0-1 trades (hard zero-trades-gate risk) and OOS windows will be sparse. Sharpe CI [-1.21, 1.84] straddles zero.

Backtest Review

Sound, overfitting-resistant construction: 3 core parameters, risk-first structural-stop sizing, clean pivot logic, leverage issue honestly resolved to 1.0

Backtest Review

avg_trade_return_pct 2.32% is above the 0.15% futures fee floor, PF 1.41, balanced long/short (95L/96S), 191 trades

Backtest Review

Headline +96% is an outlier mirage: 2024-12-10 alone is +75.4% in one day (plus 2020-12-04 +27%); return_kurtosis 43.1 / skew 3.37 show the record rests on ~2 days. 2024's +53% annual is essentially that single day

Backtest Review

Sharpe 0.50 with CI [-0.13, 1.11] straddling zero — statistically indistinguishable from no skill

Backtest Review

information_ratio -0.52 vs a meaningful buy-hold benchmark: risk-adjusted it UNDERPERFORMS holding XRP; the return is captured directional beta (benchmark_correlation 0.53) on a couple of lucky breaks, not alpha

Backtest Review

Not persistent: losing 2020/2022/2023, weak 2025-2026; max_drawdown 32.2% (CI to 51.5%)

Backtest Review

OHLCV single-instrument trend/structure class has 0/213 survival here (L9/L41); optimization best-of-N overfits fat-tailed noise and collapses in OOS/holdout

Outcome Summary

XrpMarketStructureTrendChangeSwingLS4H detected trend changes from pure swing-pivot structure on XRP, entering at a confirmed higher-high/higher-low (or the mirror) flip with a tight structural stop trailed along the new trend. Its backtest posted +96% with 191 balanced trades, PF 1.41, and a 2.32% average trade, but Sharpe was just 0.50 with a confidence interval spanning zero, a 32.2% drawdown, and a -0.52 information ratio — and roughly 75 of the 96 percentage points came from a single day, 2024-12-10. At backtest review the analyst issued an abandon verdict, judging the result captured XRP beta on a couple of lucky breaks rather than persistent alpha and citing the 0/213 survival of the single-instrument OHLCV trend/structure class. It was abandoned after 2 iterations before optimization, analysis, or risk review, to avoid overfitting fat-tailed noise that collapses in walk-forward and holdout.

Outcome Summary

A profitable-looking swing-structure trend follower whose entire return comes from one or two extreme days is captured directional beta, not alpha — a Sharpe CI straddling zero and a negative information ratio versus buy-and-hold are the tells, and this single-instrument OHLCV class does not survive walk-forward.

Outcome Summary

The analyst abandoned it at backtest review (pre-optimization): the headline return is an outlier mirage of captured XRP directional beta (benchmark correlation 0.53) rather than alpha — risk-adjusted it underperforms holding XRP, it is not persistent (losing 2020/2022/2023, weak 2025-2026), carries a 32% drawdown, and belongs to the single-instrument OHLCV trend/structure class with 0/213 survival, so optimization would overfit the fat-tailed noise and collapse in OOS/holdout.

Outcome Summary

A long-short, single-instrument directional strategy on XRPUSDT.BINANCE USD-M (3 parameters) that traded market-structure trend changes detected from pure price structure — entering when price broke the last significant swing high/low while a confirmed higher-low/lower-high established a new trend sequence, with a structural stop at the invalidating swing and a stop trailed to each new swing.

Outcome Summary

The initial backtest (XRPUSDT 4H, 2402 data days, 2020-01 to 2026-08) returned +96% with 191 balanced trades (95 long/96 short), profit factor 1.41, and avg_trade_return_pct 2.32% — above the fee floor. But Sharpe was only 0.50 (CI [-0.13, 1.11] straddling zero), max drawdown 32.2%, information ratio -0.52 versus buy-and-hold, and the return rested on ~2 outlier days (2024-12-10 alone +75.4%, kurtosis 43.1, skew 3.37).
Strategy report

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