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 de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.