Indicador Supertrend + MACD Combo — Pine Script Pronto
SuperTrend é um dos melhores indicadores de tendência. MACD é um dos melhores de momentum. Juntos? Um combo poderoso que filtra falsos sinais e identifica entradas de alta probabilidade.
Neste post, te entrego o código Pine Script v5 completo que combina os dois em um único indicador, com sinais visuais e alertas.
Como o combo funciona
- SuperTrend define a direção da tendência (verde = alta, vermelho = baixa)
- MACD confirma o momentum (histograma positivo ou negativo)
- Sinal de COMPRA: SuperTrend virou verde E MACD histograma > 0
- Sinal de VENDA: SuperTrend virou vermelho E MACD histograma < 0
💡 Por que combinar?
SuperTrend sozinho dá muitos falsos sinais em mercado lateral. MACD sozinho atrasa em tendências fortes. Combinados, um filtra os erros do outro. Resultado: menos trades, mas de qualidade superior.
Código Completo
//@version=5
indicator("SuperTrend + MACD Combo — IA Trader Pro", overlay=true)
// === PARÂMETROS ===
atrPeriod = input.int(10, "ATR Período SuperTrend")
factor = input.float(3.0, "Multiplicador SuperTrend", step=0.1)
fastLen = input.int(12, "MACD Fast")
slowLen = input.int(26, "MACD Slow")
sigLen = input.int(9, "MACD Signal")
// === SUPERTREND ===
[supertrend, direction] = ta.supertrend(factor, atrPeriod)
// === MACD ===
[macdLine, signalLine, hist] = ta.macd(close, fastLen, slowLen, sigLen)
// === SINAIS ===
stBuy = direction < 0 and direction[1] >= 0
stSell = direction > 0 and direction[1] <= 0
comboBuy = stBuy and hist > 0
comboSell = stSell and hist < 0
// === PLOTS ===
upTrend = direction < 0 ? supertrend : na
dnTrend = direction > 0 ? supertrend : na
plot(upTrend, "ST Alta", color=#00E676, linewidth=3, style=plot.style_linebr)
plot(dnTrend, "ST Baixa", color=#FF5252, linewidth=3, style=plot.style_linebr)
// Preenchimento
bgcolor(direction < 0 ? color.new(#00E676, 92) : color.new(#FF5252, 92))
// Sinais combo
plotshape(comboBuy, "COMPRA COMBO", shape.labelup, location.belowbar, color.new(#00E676, 0), text="🚀 BUY", textcolor=color.white, size=size.normal)
plotshape(comboSell, "VENDA COMBO", shape.labeldown, location.abovebar, color.new(#FF5252, 0), text="📉 SELL", textcolor=color.white, size=size.normal)
// Sinais SuperTrend apenas (cinza)
plotshape(stBuy and not comboBuy, "ST Alta", shape.triangleup, location.belowbar, color.new(color.gray, 60), size=size.tiny)
plotshape(stSell and not comboSell, "ST Baixa", shape.triangledown, location.abovebar, color.new(color.gray, 60), size=size.tiny)
// Dashboard no canto superior direito
var table dash = table.new(position.top_right, 2, 4, bgcolor=color.new(#06090F, 20), border_width=1, border_color=color.new(color.gray, 80))
if barstate.islast
table.cell(dash, 0, 0, "Indicador", text_color=color.gray, text_size=size.tiny)
table.cell(dash, 1, 0, "Status", text_color=color.gray, text_size=size.tiny)
table.cell(dash, 0, 1, "SuperTrend", text_color=color.white, text_size=size.small)
table.cell(dash, 1, 1, direction < 0 ? "ALTA ▲" : "BAIXA ▼", text_color=direction < 0 ? #00E676 : #FF5252, text_size=size.small)
table.cell(dash, 0, 2, "MACD Hist", text_color=color.white, text_size=size.small)
table.cell(dash, 1, 2, str.tostring(hist, "#.####"), text_color=hist > 0 ? #00E676 : #FF5252, text_size=size.small)
table.cell(dash, 0, 3, "Sinal", text_color=color.white, text_size=size.small)
table.cell(dash, 1, 3, (direction < 0 and hist > 0) ? "🚀 COMPRA" : (direction > 0 and hist < 0) ? "📉 VENDA" : "⏸ AGUARDE", text_color=color.white, text_size=size.small)
// === ALERTAS ===
alertcondition(comboBuy, "Combo COMPRA", "SuperTrend + MACD: sinal de COMPRA confirmado")
alertcondition(comboSell, "Combo VENDA", "SuperTrend + MACD: sinal de VENDA confirmado")
Como usar
- Timeframes recomendados: H1 ou H4 (funciona melhor em tendências médias)
- Ativos: Forex majors, índices sintéticos (V75), cripto
- Espere pelo sinal "COMBO" (com label 🚀 BUY ou 📉 SELL) — ignore as setas cinzas
- Configure alertas para receber notificação quando o combo disparar
- Combine com stop loss 2x ATR e take profit 4x ATR (risco-retorno 1:2)
✅ Melhor resultado
Este combo funciona melhor em mercados com tendência clara. Em lateralização, os sinais ficam raros (o que é bom — protege você de trades ruins).
🚀 Use este combo e aplique na Deriv (conta demo grátis):
Abrir Conta Demo Deriv →📚 Relacionados
→ 10 Indicadores Pine Script
→ Indicador Fibonacci com IA
→ Como Criar Indicadores com IA