Skip to content

View original

LinkFundingCrowdingFilteredDualTimeframeMomentumLS

Hypotheses

LINK Trend + Funding-Crowding Filter — Long-Short, Single-Instrument: Take the 4H/1D Momentum Trade ONLY When Funding Shows the Aligned Side Is NOT Over-Crowded (Trend Has Fuel), Stand Flat When the Move Is Already Leverage-Exhausted, ATR-Trailed (BINANCE LINKUSDT USD-M, 4H Primary + 1D Context, 3-Parameter)

Hypotheses

A LONG-SHORT, SINGLE-INSTRUMENT directional swing on LINKUSDT.BINANCE USD-M perpetual that deliberately reuses the ARCHITECTURE of the factory's one proven survivor (BTC dual-timeframe momentum confluence, Sharpe ~2.0: directional only on timeframe agreement, flat on disagreement, trailing-stop winners) but replaces the second PRICE timeframe with a structural, non-price confirmation drawn from FUNDING — a genuinely additive filter, not a cosmetic symbol-swap of the momentum template (which L62 forbids). The core is a 4H momentum aligned with the 1D trend. The differentiating edge is the FUNDING-CROWDING GATE: a trend that is already over-crowded on its own side (funding in the extreme tail favoring that side) is leverage-exhausted and prone to violent reversal, so those entries are SKIPPED; a trend where funding is neutral/against the crowd still has fuel and is TAKEN. This filters out precisely the late, crowded entries that make raw momentum a 0/213 dead class, in the same way the winner's dual-timeframe agreement filters chop. It is single-instrument (runs end-to-end in the Layer-3 sandbox — unlike the two-leg cross-venue/carry class that dies in verification per L69), it is NOT funding carry and NOT a funding contrarian fade (the position is trend-ALIGNED; funding is used only as a crowding veto), and it is held for DAYS with large per-trend capture, far from the fee graveyard. Funding (funding_rate_updates) is the most reliably injectable supplementary feed. Only 3 free parameters (momentum lookback, funding-crowding percentile threshold, ATR trailing-stop multiple) to resist overfitting, the #1 killer, and the funding gate is a wide (~top/bottom decile) veto rather than a narrow knife-edge, avoiding the sensitivity-cliff / deflated-Sharpe death that just killed the XRP basis-ignition variant.

Hypotheses

Smallest change from previous_code: one new clamped parameter (max_slow_z, bounds declared) and one extra entry condition; the look-ahead-free daily handling and the live funding veto from iteration 2 are untouched, as are imports, the signal, exits and sizing. The added filter is the price-side twin of the hypothesis's own thesis — an already-stretched daily trend is a late, exhausted entry — and it is genuinely additive outside the noisy last year: on a leak-free offline replay of real LINK 4H+1D bars and real funding, whole-history per-trade net goes 0.66% -> 1.13% (PF 1.26 -> 1.51, 315 -> 218 trades, so less fee drag) and 2023-present goes 0.15% -> 0.48% (PF 1.07 -> 1.25). It also cuts the recent 12-month loss by about a third. The response is a plateau (max_slow_z 0.5-0.9 all give whole-history PF 1.40-1.59 and positive 2023+), not a spike. HONEST WARNING, because it matters more than the patch: my replay now reproduces the engine almost exactly (iteration-2 rules give -0.55%/trade, PF 0.75 over 62 trades in the last 12 months vs the engine's PF 0.783 over 54), and I then searched ~50 configurations — entry_z, fast_bars, slow_bars, trail, three exit rules, hard stops, take-profits, crowd_pct 0.05-0.45, an absolute-funding veto, an INVERTED funding gate, extension caps and vol-regime filters. EVERY configuration that is positive over 2023-present is still negative over the last 12 months, and the only settings that flip the last 12 months positive (a vol-regime floor) turn 2023-2025 negative — i.e. they are noise-mining, not an edge. The recent-year loss is concentrated in long entries (-2.32%/trade over 23 longs vs +0.50% over 39 shorts) with no stable side bias in any other year, which reads as regime noise in a ~50-trade sample rather than a fixable defect. So this iteration improves the mechanism, but I could NOT make the pipeline's evaluation window profitable by any honest means; if the sandbox year is the binding criterion, the correct call is to abandon rather than iterate again, and the QA's conclusion that the funding veto is not reliably additive in the current regime stands.

Hypotheses

Differentiated and well-built, but the risk-adjusted edge is below the bar that justifies 2 hours of optimization. Over 217 trades in 6.6 years: Sharpe 0.577 with bootstrap CI [-0.118, 1.291] straddling zero, PSR 0.818, profit_factor 1.40, total_return +36.2% (CAGR 4.8%). This is the L82 dual-timeframe momentum-confluence family (which has one promoted survivor, ADA), so not a class abandon — but the survivable variant showed Sharpe ~1.60/PF ~2.19 on first backtest and L82's authorize-optimize bar is Sharpe >~1.3 with PF >2.0; this is 0.577/1.40, less than half the survivor's edge, and it matches the BtcFastDualTimeframeMomentumConfluence abandoned this batch (Sharpe ~0.59, CI straddles zero) while stronger siblings advanced at ~1.0-1.1. Base Sharpe 0.577 is the ceiling the ~225-trial deflation only lowers, and the CI already includes zero, so it won't clear the deflated-Sharpe gate; the recent regime is negative (2026 -4.1%, rolling Sharpe -8 before a single +8.9% day on 2026-08-22 rescued it), so the holdout sits in the losing regime and leans on one outlier. Its genuine strengths — avg_trade_return_pct 1.35% (not fee-fragile), correct RR asymmetry, low 13% drawdown, 6/7 positive years, stress-robust — don't rescue a Sharpe statistically indistinguishable from zero. Failure pattern: no_edge/insignificant dual-TF momentum below the L82 optimize threshold, recent regime negative (L82/L63).

Implementation

Long/short 4H swing on LINKUSDT.BINANCE USD-M perp. Fast momentum on 4H bars and slow momentum on 1-DAY context bars (admitted only after their day has fully closed — no look-ahead) are each normalised by their own timeframe's realised vol. A position opens only on confluence (both reads beyond +/- entry_z), only while the daily trend is NOT yet stretched (|slow_z| <= max_slow_z, so late/exhausted trends are skipped), and only when the funding-crowding veto passes (skip when funding sits in the top crowd_pct tail for a long or the bottom tail for a short). Exits: ATR trailing stop trail_atr ATRs off the best close since entry, the fast read flipping through -exit_z, or the daily read flipping against the position. Signal every bar is the continuous mean of the two z reads. Sizing is ATR-risk based (2% of equity over the trail_atr*ATR stop), capped at 60% equity notional, leverage 1.0.

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.

Verification Results

Analyst to compare veto-on vs veto-off on the full backtest; if the funding gate is not additive OOS, treat as a momentum re-parameterization and weigh against L81 survivor-class guidance rather than as a novel edge.

Verification Results

The funding-crowding veto (the differentiating edge over the plain dual-timeframe momentum survivor) is correctly implemented and live, but the developer's leak-free replay indicates it is not reliably additive in the recent regime, so most of the edge over the full window is the momentum architecture it is layered on (L62 concern in the current regime). Not a correctness bug — the veto reads point-in-time funding and vetoes the crowded side as specified.

Backtest Review

Well-measured (217 trades over 6.6 years); avg_trade_return_pct 1.35% far above the fee floor (not fee-fragile), commission 3.5% of gross

Backtest Review

Correct trend RR asymmetry (avg_win $1412 > avg_loss $661, PF 1.40, +$161/trade); low drawdown 13.1% (CI to 21.4%); positive in 6 of 7 years; stress-window robust

Backtest Review

Genuinely additive funding-crowding veto (not an L62 cosmetic symbol-swap); L82 dual-TF-confluence family, which has a promoted survivor

Backtest Review

Not robustly significant: Sharpe 0.577 with CI [-0.118, 1.291] straddling zero, PSR 0.818; base Sharpe is the ceiling deflation lowers, won't clear the gate

Backtest Review

Well below the L82 authorize-optimize bar (Sharpe >1.3, PF >2.0); the ADA survivor showed Sharpe ~1.60/PF ~2.19 on first backtest

Backtest Review

Recent regime negative: 2026 -4.1%, rolling Sharpe -8 before a single +8.9% day rescued it — holdout in the losing regime, outlier-dependent

Backtest Review

Matches the BtcFastDualTimeframeMomentumConfluence abandoned this batch (Sharpe ~0.59, CI straddles zero) while siblings advanced at ~1.0-1.1

Iteration History

Verification failed (Layer 4 — QA review): - The funding-crowding veto — the ENTIRE differentiating edge of this hypothesis — is silently DEAD CODE in the backtest. _build_funding_index() filters `if not isinstance(k, int): continue`, keeping int keys only. Verified against the codebase: on the real backtest path the funding_rates dict is built dual-keyed {int: rate, str(int): rate} (supp_collector.py:562-563) and then round-trips through JSON — inline via json.dump at subprocess_runner.py:154, or json.loads(json.dumps(...)) at supp_collector.py:417 — which collapses every key to a STR. So in the Layer-3 sandbox and the normal backtest the strategy iterates str keys, isinstance(k,int) drops 100% of funding points, _funding_index stays empty, _funding_pct stays None, and _crowded() always returns False: the veto NEVER fires. (It 'works' only in the in-process Layer-2 path, which keeps genuine int keys — strategy_verifier.py:108, synthetic_scenarios.py:257 — which is why Layers 1-2 passed.) This is the EXACT bug the DOGE strategy in this same session diagnosed and fixed by coercing int(k) for both key types; that fix was not carried over here. Consequence: the strategy as-executed is bare dual-timeframe momentum confluence with NO funding gate — i.e. the L62-forbidden cosmetic momentum clone / 0/213 OHLCV-trend class the hypothesis explicitly claims NOT to be. The +2.89% sandbox is ungated momentum, corroborated by the trade frequency (~59/yr matches the developer's gate-OFF offline rate ~60/yr, not the gate-ON rate ~44-52/yr). - The slow (1-DAY) momentum read has a ~1-day LOOK-AHEAD that inflates the backtest. Verified: Binance external bars are OPEN-time stamped (ts_init = day open), and the base template calls on_extra_bar() immediately with no lag (base_template.py:286-297). The 1-DAY bar for day D is delivered at D_open carrying that day's full OHLC INCLUDING its close (only truly known at D+1). Slower-timeframe extra legs are excluded from the cross-leg sync barrier (_sync_extra_iids only holds SAME-timeframe legs, base_template.py:205-210), so slow_z reflects day D's close while the strategy trades day D's 4H bars from the second bar of the day onward. slow_z is a REQUIRED confluence condition for entry and a exit trigger, so the strategy effectively knows the day's close direction before the day completes — a direct forward-information leak. The positive sandbox result is contaminated regardless of the funding bug.

Iteration History

Verification failed (Layer 4 — QA review): - With BOTH prior bugs correctly fixed, the honest (leak-free, veto-live) engine result is a net loser (checklist #7, L6/L8). The iteration-2 sandbox: total_return -5.21%, profit_factor 0.783 (<1.0), Sharpe -0.496, expectancy -$96.85/trade, win_rate 0.333, max_drawdown 12.2%, over a measurable 54-trade sample (metrics_reliable: true) with funding credited (603 events). The previous iteration's +2.89% was the phantom: it came entirely from the ~1-day daily look-ahead plus the disabled funding veto. Removing the look-ahead and actually applying the crowding gate flips the strategy negative — which directly REFUTES the hypothesis's central claim that the funding veto is additive. The developer's offline replay predicted +0.70%/trade at PF 1.27, but the engine produces PF 0.783 and a negative total return; the offline number does not reproduce, and the recent evaluation window (the developer's own caveat: 2021 negative, 2020 carries the edge) is where the pipeline scores.

Iteration History

Verification failed (Layer 4 — QA review): - Still a net loser on the honest (leak-free, veto-live) engine result — and now worse (checklist #7, L6/L8). The iteration-3 sandbox: total_return -6.52%, profit_factor 0.603 (<1.0), Sharpe -0.80, avg_trade_return_pct -0.150% (NEGATIVE), win_rate 0.333, over a measurable 36-trade sample with funding credited (380 events). The new extension veto (max_slow_z) did not help the evaluation window; the result deteriorated from iteration 2's -5.21%. Per L8, negative total return with PF<1.0 is disqualifying. - The hypothesis's central claim — that the funding-crowding veto is an additive edge over raw momentum — is empirically refuted, and the developer concedes it. Their exhaustive ~50-config search (entry_z, fast/slow bars, trail, exit rules, hard stops, take-profits, crowd_pct 0.05-0.45, absolute-funding veto, INVERTED funding gate, extension caps, vol-regime filters) found that EVERY configuration positive over 2023-present is negative over the pipeline's last-12-month window, and the only settings that flip recent positive turn 2023-2025 negative (noise-mining). The recent-year loss concentrates in longs (-2.32%/trade over 23) with no stable side bias in any other year — regime noise in a ~50-trade sample. The core momentum is the 0/213 OHLCV-trend class (L9/L41) and the funding veto does not rescue it on the engine. The developer's own words: 'I could NOT make the pipeline's evaluation window profitable by any honest means... the correct call is to abandon rather than iterate again, and the QA's conclusion that the funding veto is not reliably additive in the current regime stands.'
Strategy report

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