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
+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)