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:
co-authored by
Claude Opus 4.8
parent
6238d6f12e
commit
b23a3d4e5c
+25
-2
@@ -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:
|
||||
|
||||
+13
-2
@@ -12,7 +12,12 @@
|
||||
//| 4) Der Bot muss laufen (schreibt die CSV alle ~5 s). |
|
||||
//+------------------------------------------------------------------+
|
||||
#property copyright "Oil Trading Bot"
|
||||
#property version "1.24"
|
||||
#property version "1.25"
|
||||
// v1.25 (2026-07-30): S/R-Labels zeigen die DURCHBRUCHWAHRSCHEINLICHKEIT
|
||||
// (User-Wunsch) — der Bot haengt sie als drittes CSV-Feld an (R;preis;pct).
|
||||
// Quelle = dasselbe kalibrierte P(break)-Modell wie der S/R-Auto-Close, auf
|
||||
// die M30-Level nachtrainiert (AUC 0,72 out-of-sample). Niedrig = Level
|
||||
// haelt eher. Abschaltbar via InpShowPBreak.
|
||||
// v1.24 (2026-07-30): Farb-Inputs UMBENANNT — MT5 speichert Input-Werte je
|
||||
// Chart-Instanz und ueberschreibt damit NEUE Defaults, auch nach Recompile
|
||||
// (deshalb blieben die Pfeile gold). Durch die Umbenennung findet MT5 keinen
|
||||
@@ -117,6 +122,7 @@ input int InpZoneAlpha = 10; // Deckkraft der Zonenfuellung in %
|
||||
input bool InpShowPrice = true; // aktuellen Kurs oben rechts anzeigen
|
||||
input int InpPriceSize = 20; // Schriftgroesse des Kurses
|
||||
input int InpLabelSize = 12; // Schriftgroesse der Linien-Beschriftungen (+4 per User-Wunsch)
|
||||
input bool InpShowPBreak = true; // Durchbruchwahrscheinlichkeit am S/R-Label
|
||||
input color InpLabelColor = clrWhite; // Farbe ALLER Linien-Beschriftungen (User-Wunsch: weiss)
|
||||
input color InpPriceColor = clrWhite; // Kurs oben rechts (weiss)
|
||||
// ── Chart-THEME (User-Vorgabe 2026-07-30 „Farben im MT5 wie im Bild") ────────
|
||||
@@ -381,8 +387,13 @@ void Redraw()
|
||||
{
|
||||
double price = StringToDouble(p[1]);
|
||||
if(price <= 0) continue;
|
||||
string lbl = (typ=="R" ? "Widerstand " : "Unterstützung ")
|
||||
// Feld 3 (optional) = P(Durchbruch) in % aus dem kalibrierten Modell des
|
||||
// Bots (User-Wunsch 2026-07-30). Niedrig = Level haelt eher, hoch = bricht
|
||||
// eher. Wird ans Label gehaengt: „Widerstand 84.536 · Durchbruch 34%".
|
||||
string lbl = (typ=="R" ? "Widerstand " : "Unterstuetzung ")
|
||||
+ DoubleToString(price, (int)_Digits);
|
||||
if(InpShowPBreak && k > 2 && StringLen(p[2]) > 0)
|
||||
lbl += " · Durchbruch " + p[2] + "%";
|
||||
color col = (typ=="R" ? InpResColor : InpSupColor);
|
||||
string nm = PFX + typ + "_" + IntegerToString(idx);
|
||||
if(ObjectCreate(0, nm, OBJ_HLINE, 0, 0, price))
|
||||
|
||||
Reference in New Issue
Block a user