MQL5 v1.25: Durchbruchwahrscheinlichkeit an den S/R-Labels

User-Wunsch. Der Bot haengt P(break) als drittes CSV-Feld an (R;preis;pct /
S;preis;pct), der Indikator schreibt es ins Label:
  "Widerstand 84.536  ·  Durchbruch 34%"

Quelle = dasselbe kalibrierte Logit-Modell wie der S/R-Auto-Close, heute auf die
M30-Level nachtrainiert (AUC 0.72 out-of-sample, Kalibrierung geprueft).
Richtung: Widerstand = Bruch nach oben (+1), Support = nach unten (-1); Merkmale
identisch zu _sr_close_hint/_stop_approach_hint (M5-Momentum, EMA-Richtung,
Abstand/ATR). Abschaltbar via InpShowPBreak.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Axel Hocks
2026-07-30 19:01:23 +02:00
co-authored by Claude Opus 4.8
parent 6238d6f12e
commit b23a3d4e5c
2 changed files with 38 additions and 4 deletions
+25 -2
View File
@@ -1946,8 +1946,31 @@ class TradingEngine:
try:
dl = self._draw_levels() # echte Pivot-Struktur, nicht [zones]-Config
lines = [f"SYM;{self.data.symbol or ''}"]
for p in dl.get("res", []): lines.append(f"R;{p}")
for p in dl.get("sup", []): lines.append(f"S;{p}")
# P(Durchbruch) je Linie mitgeben (User-Wunsch 2026-07-30) → der Indikator
# schreibt sie ins Label: „Widerstand 84.536 · Durchbruch 34%".
# Richtung: Widerstand = Bruch nach OBEN (+1), Support = nach UNTEN (1);
# Merkmale identisch zu `_sr_close_hint`/`_stop_approach_hint` (M5-Momentum,
# `wt` = EMA-Richtung stimmt mit der Bruchrichtung, `dist` = Abstand/ATR).
# ⚠ Das Modell ist auf GENAU diese M30-Level trainiert (Nachtraining
# 2026-07-30) — Kalibrierung out-of-sample geprüft (AUC 0,72).
def _pb_for(level, dd):
try:
pf = (self.wave.snapshot() or {}).get("pb_feats") or {}
atr = pf.get("atr"); m6 = pf.get("mom6"); m3 = pf.get("mom3")
ed = pf.get("ema_diff")
b = (self.data.snapshot() or {}).get("bid")
if not (atr and b) or None in (m6, m3, ed):
return None
wt = 1.0 if ed * dd > 0 else 0.0
return round(_p_break(m6 * dd, m3 * dd, wt, abs(level - b) / atr) * 100)
except Exception:
return None
for p in dl.get("res", []):
_pb = _pb_for(p, 1)
lines.append(f"R;{p}" + (f";{_pb}" if _pb is not None else ""))
for p in dl.get("sup", []):
_pb = _pb_for(p, -1)
lines.append(f"S;{p}" + (f";{_pb}" if _pb is not None else ""))
# Regressionskanal (M30) als Trendlinien-Anker → MQL5 zieht OBJ_TREND
# (Format CH;<U|M|L>;t1;p1;t2;p2 mit Broker-Zeiten).
try: