OPEN-SOURCE SCRIPT
MACD PRO + Filtro + Genesis

//version=6
indicator("MACD PRO + Filtro + Delay", overlay=true)
// ======================
// 🔧 INPUTS
// ======================
source = close
fastLen = input.int(12, "Fast")
slowLen = input.int(26, "Slow")
signalLen = input.int(9, "Signal")
delay = input.int(1, "Delay (velas após cruzamento)", minval=0, maxval=5)
emaFilterLen = input.int(100, "EMA Tendência")
// ======================
// 📊 MACD
// ======================
[macd, signal, hist] = ta.macd(source, fastLen, slowLen, signalLen)
// ======================
// 📈 FILTRO DE TENDÊNCIA
// ======================
ema = ta.ema(close, emaFilterLen)
trendBuy = close > ema
trendSell = close < ema
// ======================
// 🔀 CRUZAMENTOS
// ======================
buyCross = ta.crossover(macd, signal)
sellCross = ta.crossunder(macd, signal)
// ======================
// ⏱️ DELAY (controle de vela)
// ======================
buySignal = buyCross[delay]
sellSignal = sellCross[delay]
// ======================
// ✅ CONFIRMAÇÃO DE CANDLE
// ======================
candleBuy = close > open
candleSell = close < open
// ======================
// 🎯 SINAL FINAL (FILTROS)
// ======================
finalBuy = buySignal and trendBuy and candleBuy
finalSell = sellSignal and trendSell and candleSell
// ======================
// 📍 PLOTAGEM
// ======================
plotshape(finalBuy,
title="Compra",
style=shape.triangleup,
location=location.belowbar,
color=color.lime,
size=size.small,
text="BUY")
plotshape(finalSell,
title="Venda",
style=shape.triangledown,
location=location.abovebar,
color=color.red,
size=size.small,
text="SELL")
// ======================
// 📉 EMA NO GRÁFICO
// ======================
plot(ema, "EMA 200", color=color.orange)
// ======================
// 🔔 ALERTAS
// ======================
alertcondition(finalBuy, "Compra", "Sinal de COMPRA confirmado")
alertcondition(finalSell, "Venda", "Sinal de VENDA confirmado"
indicator("MACD PRO + Filtro + Delay", overlay=true)
// ======================
// 🔧 INPUTS
// ======================
source = close
fastLen = input.int(12, "Fast")
slowLen = input.int(26, "Slow")
signalLen = input.int(9, "Signal")
delay = input.int(1, "Delay (velas após cruzamento)", minval=0, maxval=5)
emaFilterLen = input.int(100, "EMA Tendência")
// ======================
// 📊 MACD
// ======================
[macd, signal, hist] = ta.macd(source, fastLen, slowLen, signalLen)
// ======================
// 📈 FILTRO DE TENDÊNCIA
// ======================
ema = ta.ema(close, emaFilterLen)
trendBuy = close > ema
trendSell = close < ema
// ======================
// 🔀 CRUZAMENTOS
// ======================
buyCross = ta.crossover(macd, signal)
sellCross = ta.crossunder(macd, signal)
// ======================
// ⏱️ DELAY (controle de vela)
// ======================
buySignal = buyCross[delay]
sellSignal = sellCross[delay]
// ======================
// ✅ CONFIRMAÇÃO DE CANDLE
// ======================
candleBuy = close > open
candleSell = close < open
// ======================
// 🎯 SINAL FINAL (FILTROS)
// ======================
finalBuy = buySignal and trendBuy and candleBuy
finalSell = sellSignal and trendSell and candleSell
// ======================
// 📍 PLOTAGEM
// ======================
plotshape(finalBuy,
title="Compra",
style=shape.triangleup,
location=location.belowbar,
color=color.lime,
size=size.small,
text="BUY")
plotshape(finalSell,
title="Venda",
style=shape.triangledown,
location=location.abovebar,
color=color.red,
size=size.small,
text="SELL")
// ======================
// 📉 EMA NO GRÁFICO
// ======================
plot(ema, "EMA 200", color=color.orange)
// ======================
// 🔔 ALERTAS
// ======================
alertcondition(finalBuy, "Compra", "Sinal de COMPRA confirmado")
alertcondition(finalSell, "Venda", "Sinal de VENDA confirmado"
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.