feat(fade): swap filtro live hurst->trend_max 3.0 (gate PORT06 sul path live)

Punto 7 roadmap sweep. Gate trendmax_port06_impact.py (engine exit16_port06_impact
riusato, parita' canonica 1.00000; maschera hurst IDENTICA al live via
fade_base.hurst_skip_mask; PORT06 pesi cap, path live EXIT-16):

- CANDIDATO (hurst+trend) BOCCIATO: over-filtering (FULL Sharpe 7.23->7.11,
  meta' dei trade) nonostante DD 2.68->2.06.
- SCOPERTA: il loss-guard Hurst e' ridondante-DANNOSO post-EXIT-16 (NESSUNO
  batte LIVE: FULL Sh 8.07 vs 7.23). EXIT-16 ha eliminato i wick-stop che hurst
  evitava -> gli ingressi saltati (66% delle barre) sono tornati vincenti.
  Il test che promosse hurst (2026-06-02) era sull'engine PRE-EXIT-16.
- TREND-ONLY domina LIVE su tutte le metriche (FULL Sh 7.89 DD 2.46, OOS Sh 9.91
  DD 1.20) ed e' la config che la ricerca EXIT-16 aveva davvero promosso (entries
  trend-filtrate, no hurst) mai eseguita dal live. Plateau 2.5/3.0/3.5 robusto.

Decisione (utente): SWAP. _defs.py: trend_max=3.0 + ema_long=200 nelle 6 fade,
hurst_max rimosso (hurst_skip_mask resta in fade_base). hourly_report: monitor
stop-rate per epoca PRE->HURST->TREND (verdetto a n>=30). CLAUDE.md aggiornato
(paragrafo hurst marcato storico). Diario docs/diary/2026-06-07-trendmax-gate.md.

Lezione: ri-gateare ogni filtro quando cambia l'exit engine.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Adriano Dal Pastro
2026-06-07 10:29:57 +00:00
parent 11ace196c7
commit e3bb622b90
5 changed files with 370 additions and 19 deletions
+15 -7
View File
@@ -18,11 +18,19 @@ UNIVERSE8 = ["ADA", "BNB", "BTC", "DOGE", "ETH", "LTC", "SOL", "XRP"]
# MR02/MR07 lo ignorano (**params). Vedi docs/diary/2026-06-01-tp-min-edge.md.
MIN_TP_FRAC = 0.0015
# Loss-guard Hurst (live): salta le fade in regime PERSISTENTE/trending (rolling-Hurst >= 0.55),
# dove si concentrano stop-loss e perdite (stop-rate 43% vs 21% anti-persistente). DIMEZZA il DD
# del PORT06 (FULL 4.10%->2.39%) alzando lo Sharpe. Calcolato dalle SOLE close (no feed esterno).
# Validato 2026-06-02, vedi docs/diary/2026-06-02-fade-lossguard.md.
HURST_MAX = 0.55
# Filtro TREND (live, swap dal loss-guard Hurst il 2026-06-07): salta le fade quando il prezzo
# e' esteso oltre trend_max*ATR(14) dalla EMA(ema_long) — non si fada un trend/crollo esteso.
# E' la config che la ricerca EXIT-16 (2026-06-04) ha effettivamente promosso (entries
# trend-filtrate, niente hurst). Gate PORT06 sul path live (trendmax_port06_impact, 2026-06-07):
# TREND-ONLY domina la config hurst-only su TUTTE le metriche (FULL Sharpe 7.23->7.89,
# OOS Sharpe 9.35->9.91, OOS DD 1.68->1.20), plateau robusto su trend_max 2.5/3.0/3.5.
# Il loss-guard Hurst (validato 2026-06-02 sull'engine PRE-EXIT-16 con SL intrabar) e'
# RIDONDANTE-DANNOSO dopo EXIT-16: attacca lo stesso regime (trending) saltando ingressi che
# con EXIT-16 sono tornati vincenti; la combinazione hurst+trend over-filtra (meta' dei trade,
# FULL Sharpe 7.11). hurst_skip_mask resta disponibile in fade_base (param hurst_max).
# Vedi docs/diary/2026-06-07-trendmax-gate.md.
TREND_MAX = 3.0
EMA_LONG = 200
# EXIT-16 close-confirm SL (live, 2026-06-04): lo SL intrabar fisso veniva triggerato dai
# wick transitori (falsi negativi: l'overshoot che buca lo stop rientra — e' il movimento
@@ -33,8 +41,8 @@ HURST_MAX = 0.55
SL_CONFIRM_ATR = 0.5
FADE = [SleeveSpec(kind="single", name=c, sid=f"{c}_{a}", asset=a, cluster=f"{a}-rev",
params={"min_tp_frac": MIN_TP_FRAC, "hurst_max": HURST_MAX,
"sl_confirm_atr": SL_CONFIRM_ATR})
params={"min_tp_frac": MIN_TP_FRAC, "trend_max": TREND_MAX,
"ema_long": EMA_LONG, "sl_confirm_atr": SL_CONFIRM_ATR})
for a in ("BTC", "ETH") for c in ("MR01", "MR02", "MR07")]
HONEST = [
# DIP01: single-asset 1h -> StrategyWorker (Strategy DIP01_dip_buy). TR01/ROT02: multi-asset.
+18 -11
View File
@@ -47,15 +47,20 @@ def _short(wid: str) -> str:
return f"{code}/{tag}" if tag else code
# --- monitor loss-guard Hurst: stop-rate fade PRIMA/DOPO l'attivazione (hurst_max=0.55, v1.0.0) ---
# --- monitor filtri fade: stop-rate per epoca di config ---
# epoche: PRE (nessun filtro) -> HURST (loss-guard 0.55, v1.0.0) -> TREND (swap
# hurst->trend_max=3.0, 2026-06-07: gate trendmax_port06_impact, hurst ridondante
# post-EXIT-16). Confronta lo stop-rate live di ogni epoca col backtest.
LOSSGUARD_SINCE = "2026-06-02T14:34:30"
FADE_PREFIXES = ("MR01", "MR02", "MR07") # le 3 fade con hurst_max attivo
TRENDSWAP_SINCE = "2026-06-07T10:10:00"
FADE_PREFIXES = ("MR01", "MR02", "MR07")
LOSSGUARD_MIN_SAMPLE = 30
def lossguard_section() -> str:
before = [0, 0] # [closes, stops] prima dell'attivazione
after = [0, 0] # dopo
pre = [0, 0] # [closes, stops] nessun filtro
hurst = [0, 0] # epoca loss-guard Hurst
trend = [0, 0] # epoca filtro trend (config attuale)
for sp in glob.glob(str(PAPER / "*" / "status.json")):
wid = Path(sp).parent.name
if not wid.startswith(FADE_PREFIXES):
@@ -69,7 +74,8 @@ def lossguard_section() -> str:
ev = json.loads(line)
if ev.get("event") != "CLOSE":
continue
b = after if ev.get("ts", "") >= LOSSGUARD_SINCE else before
ts = ev.get("ts", "")
b = trend if ts >= TRENDSWAP_SINCE else hurst if ts >= LOSSGUARD_SINCE else pre
b[0] += 1
if ev.get("reason") == "stop_loss":
b[1] += 1
@@ -77,14 +83,15 @@ def lossguard_section() -> str:
def rate(b):
return b[1] / b[0] * 100 if b[0] else 0.0
L = [f"🛡️ <b>Loss-guard Hurst</b> (fade, dal {LOSSGUARD_SINCE[:16].replace('T', ' ')} UTC)"]
L.append(f" stop-rate PRIMA {rate(before):.0f}% (n={before[0]}) → DOPO {rate(after):.0f}% (n={after[0]})")
if after[0] >= LOSSGUARD_MIN_SAMPLE:
delta = rate(before) - rate(after)
L.append(f" VERDETTO (n≥{LOSSGUARD_MIN_SAMPLE}): {delta:+.0f}pp → "
L = ["🛡️ <b>Filtri fade — stop-rate per epoca</b>"]
L.append(f" PRE {rate(pre):.0f}% (n={pre[0]}) → HURST {rate(hurst):.0f}% (n={hurst[0]})"
f" → TREND {rate(trend):.0f}% (n={trend[0]})")
if trend[0] >= LOSSGUARD_MIN_SAMPLE:
delta = rate(pre) - rate(trend)
L.append(f" VERDETTO epoca TREND (n≥{LOSSGUARD_MIN_SAMPLE}): {delta:+.0f}pp vs PRE → "
f"{'✅ riduce gli stop' if delta > 0 else '⚠️ nessuna riduzione'}")
else:
L.append(f" campione DOPO {after[0]}/{LOSSGUARD_MIN_SAMPLE} → verdetto rimandato")
L.append(f" campione TREND {trend[0]}/{LOSSGUARD_MIN_SAMPLE} → verdetto rimandato")
return "\n".join(L)