OPEN-SOURCE SCRIPT
2 MACD VISUEL — 4H / 1H / 15M + CONFIRMATION 5M

//version=6
indicator("MTF MACD VISUEL — 4H / 1H / 15M + CONFIRMATION 5M", overlay=true, max_labels_count=500)
// ─────────────────────────────
// Fonction MACD Histogram
// ─────────────────────────────
f_macd(src) =>
fast = ta.ema(src, 12)
slow = ta.ema(src, 26)
macd = fast - slow
signal = ta.ema(macd, 9)
hist = macd - signal
hist
// ─────────────────────────────
// MTF MACD HISTOGRAM
// ─────────────────────────────
h4 = request.security(syminfo.tickerid, "240", f_macd(close))
h1 = request.security(syminfo.tickerid, "60", f_macd(close))
h15 = request.security(syminfo.tickerid, "15", f_macd(close))
h5 = request.security(syminfo.tickerid, "5", f_macd(close))
// Signes
s4 = h4 > 0 ? 1 : h4 < 0 ? -1 : 0
s1 = h1 > 0 ? 1 : h1 < 0 ? -1 : 0
s15 = h15 > 0 ? 1 : h15 < 0 ? -1 : 0
s5 = h5 > 0 ? 1 : h5 < 0 ? -1 : 0
// Conditions
three_same = (s4 == s1) and (s1 == s15) and (s4 != 0)
five_same = three_same and (s5 == s4)
// BUY / SELL logiques
isBUY = five_same and s4 == 1
isSELL = five_same and s4 == -1
// ─────────────────────────────
// DASHBOARD VISUEL (en haut du graphique)
// ─────────────────────────────
var table dash = table.new(position.top_right, 4, 2, border_color=color.black)
table.cell(dash, 0, 0, "4H", bgcolor = s4 == 1 ? color.green : s4 == -1 ? color.red : color.gray)
table.cell(dash, 1, 0, "1H", bgcolor = s1 == 1 ? color.green : s1 == -1 ? color.red : color.gray)
table.cell(dash, 2, 0, "15M", bgcolor = s15 == 1 ? color.green : s15 == -1 ? color.red : color.gray)
table.cell(dash, 3, 0, "5M", bgcolor = s5 == 1 ? color.green : s5 == -1 ? color.red : color.gray)
table.cell(dash, 0, 1, s4 == 1 ? "↑" : s4 == -1 ? "↓" : "·", bgcolor=color.new(color.black, 0), text_color=color.white)
table.cell(dash, 1, 1, s1 == 1 ? "↑" : s1 == -1 ? "↓" : "·", bgcolor=color.new(color.black, 0), text_color=color.white)
table.cell(dash, 2, 1, s15 == 1 ? "↑" : s15 == -1 ? "↓" : "·", bgcolor=color.new(color.black, 0), text_color=color.white)
table.cell(dash, 3, 1, s5 == 1 ? "↑" : s5 == -1 ? "↓" : "·", bgcolor=color.new(color.black, 0), text_color=color.white)
// ─────────────────────────────
// SIGNES VISUELS SUR LE GRAPHIQUE
// ─────────────────────────────
plotshape(isBUY, title="BUY", style=shape.triangleup, location=location.belowbar, color=color.green, size=size.large, text="BUY")
plotshape(isSELL, title="SELL", style=shape.triangledown, location=location.abovebar, color=color.red, size=size.large, text="SELL")
// Histogramme du MACD 5M en couleur tendance
plot(h5, title="MACD Hist 5M", color = h5 >= 0 ? color.green : color.red, style=plot.style_columns)
// ─────────────────────────────
// Alerte Webhook (message constant OBLIGATOIRE)
// ─────────────────────────────
alertcondition(isBUY, title="Signal BUY Confirmé", message="MTF_MACD_BUY")
alertcondition(isSELL, title="Signal SELL Confirmé", message="MTF_MACD_SELL")
indicator("MTF MACD VISUEL — 4H / 1H / 15M + CONFIRMATION 5M", overlay=true, max_labels_count=500)
// ─────────────────────────────
// Fonction MACD Histogram
// ─────────────────────────────
f_macd(src) =>
fast = ta.ema(src, 12)
slow = ta.ema(src, 26)
macd = fast - slow
signal = ta.ema(macd, 9)
hist = macd - signal
hist
// ─────────────────────────────
// MTF MACD HISTOGRAM
// ─────────────────────────────
h4 = request.security(syminfo.tickerid, "240", f_macd(close))
h1 = request.security(syminfo.tickerid, "60", f_macd(close))
h15 = request.security(syminfo.tickerid, "15", f_macd(close))
h5 = request.security(syminfo.tickerid, "5", f_macd(close))
// Signes
s4 = h4 > 0 ? 1 : h4 < 0 ? -1 : 0
s1 = h1 > 0 ? 1 : h1 < 0 ? -1 : 0
s15 = h15 > 0 ? 1 : h15 < 0 ? -1 : 0
s5 = h5 > 0 ? 1 : h5 < 0 ? -1 : 0
// Conditions
three_same = (s4 == s1) and (s1 == s15) and (s4 != 0)
five_same = three_same and (s5 == s4)
// BUY / SELL logiques
isBUY = five_same and s4 == 1
isSELL = five_same and s4 == -1
// ─────────────────────────────
// DASHBOARD VISUEL (en haut du graphique)
// ─────────────────────────────
var table dash = table.new(position.top_right, 4, 2, border_color=color.black)
table.cell(dash, 0, 0, "4H", bgcolor = s4 == 1 ? color.green : s4 == -1 ? color.red : color.gray)
table.cell(dash, 1, 0, "1H", bgcolor = s1 == 1 ? color.green : s1 == -1 ? color.red : color.gray)
table.cell(dash, 2, 0, "15M", bgcolor = s15 == 1 ? color.green : s15 == -1 ? color.red : color.gray)
table.cell(dash, 3, 0, "5M", bgcolor = s5 == 1 ? color.green : s5 == -1 ? color.red : color.gray)
table.cell(dash, 0, 1, s4 == 1 ? "↑" : s4 == -1 ? "↓" : "·", bgcolor=color.new(color.black, 0), text_color=color.white)
table.cell(dash, 1, 1, s1 == 1 ? "↑" : s1 == -1 ? "↓" : "·", bgcolor=color.new(color.black, 0), text_color=color.white)
table.cell(dash, 2, 1, s15 == 1 ? "↑" : s15 == -1 ? "↓" : "·", bgcolor=color.new(color.black, 0), text_color=color.white)
table.cell(dash, 3, 1, s5 == 1 ? "↑" : s5 == -1 ? "↓" : "·", bgcolor=color.new(color.black, 0), text_color=color.white)
// ─────────────────────────────
// SIGNES VISUELS SUR LE GRAPHIQUE
// ─────────────────────────────
plotshape(isBUY, title="BUY", style=shape.triangleup, location=location.belowbar, color=color.green, size=size.large, text="BUY")
plotshape(isSELL, title="SELL", style=shape.triangledown, location=location.abovebar, color=color.red, size=size.large, text="SELL")
// Histogramme du MACD 5M en couleur tendance
plot(h5, title="MACD Hist 5M", color = h5 >= 0 ? color.green : color.red, style=plot.style_columns)
// ─────────────────────────────
// Alerte Webhook (message constant OBLIGATOIRE)
// ─────────────────────────────
alertcondition(isBUY, title="Signal BUY Confirmé", message="MTF_MACD_BUY")
alertcondition(isSELL, title="Signal SELL Confirmé", message="MTF_MACD_SELL")
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.