SuperTrend + MACD Pine Script — Strategy Combo TradingView
Combo SuperTrend + MACD adalah salah satu strategy paling reliable untuk trend trading. SuperTrend menentukan direction trend, MACD confirm momentum. Bersama, mengurangi false signals signifikan. Tutorial ini punya Pine Script lengkap siap pakai.
Apa Itu SuperTrend?
SuperTrend adalah indikator trend-following yang menggunakan ATR (Average True Range) untuk plot dynamic support/resistance:
- Garis hijau di bawah price: Trend bullish (support)
- Garis merah di atas price: Trend bearish (resistance)
- Flip green → red: Reversal signal bearish
- Flip red → green: Reversal signal bullish
Default parameter: ATR period 10, Multiplier 3.0.
Mengapa Combine dengan MACD?
💡 Dual Confirmation Power
SuperTrend bagus untuk trend direction, tapi sometimes lag — terlalu lambat trigger reversal.
MACD bagus untuk momentum, tapi banyak false signals di sideways market.
Combine: SuperTrend confirm trend, MACD confirm momentum → entry hanya saat keduanya align. Reduces whipsaws 50-70%.
Pine Script Lengkap — Copy & Paste
//@version=5
indicator("SuperTrend + MACD Combo — IA Trader Pro", overlay=true)
// === INPUTS ===
// SuperTrend
stATR = input.int(10, "SuperTrend ATR Period")
stMult = input.float(3.0, "SuperTrend Multiplier", step=0.1)
// MACD
macdFast = input.int(12, "MACD Fast Length")
macdSlow = input.int(26, "MACD Slow Length")
macdSig = input.int(9, "MACD Signal Length")
// Visual
showArrows = input.bool(true, "Show entry arrows")
showLabels = input.bool(true, "Show BUY/SELL labels")
showDashboard = input.bool(true, "Show dashboard")
// === SUPERTREND CALCULATION ===
[supertrend, direction] = ta.supertrend(stMult, stATR)
upTrend = direction < 0
downTrend = direction > 0
// === MACD CALCULATION ===
[macdLine, signalLine, histLine] = ta.macd(close, macdFast, macdSlow, macdSig)
macdBullish = histLine > 0
macdBearish = histLine < 0
// === COMBO SIGNALS ===
// BUY: SuperTrend flips bullish AND MACD histogram positive
stFlipBuy = direction < 0 and direction[1] > 0
stFlipSell = direction > 0 and direction[1] < 0
buySignal = (stFlipBuy and macdBullish) or (upTrend and ta.crossover(histLine, 0))
sellSignal = (stFlipSell and macdBearish) or (downTrend and ta.crossunder(histLine, 0))
// === PLOT SUPERTREND ===
upTrendPlot = plot(upTrend ? supertrend : na, "Up Trend",
color=color.new(#00E676, 0), style=plot.style_linebr, linewidth=2)
downTrendPlot = plot(downTrend ? supertrend : na, "Down Trend",
color=color.new(#FF5252, 0), style=plot.style_linebr, linewidth=2)
// === BACKGROUND ===
bgcolor(upTrend ? color.new(#00E676, 95) : color.new(#FF5252, 95), title="Trend BG")
// === ARROWS ===
plotshape(showArrows and buySignal, title="BUY", location=location.belowbar,
color=color.new(#00E676, 0), style=shape.triangleup, size=size.small)
plotshape(showArrows and sellSignal, title="SELL", location=location.abovebar,
color=color.new(#FF5252, 0), style=shape.triangledown, size=size.small)
// === LABELS ===
if showLabels and buySignal
label.new(bar_index, low, "BUY",
color=color.new(#00E676, 0),
textcolor=color.white,
style=label.style_label_up,
size=size.small)
if showLabels and sellSignal
label.new(bar_index, high, "SELL",
color=color.new(#FF5252, 0),
textcolor=color.white,
style=label.style_label_down,
size=size.small)
// === ALERTS ===
alertcondition(buySignal, title="SuperTrend+MACD BUY",
message="Combo BUY signal: SuperTrend bullish + MACD positive momentum")
alertcondition(sellSignal, title="SuperTrend+MACD SELL",
message="Combo SELL signal: SuperTrend bearish + MACD negative momentum")
// === DASHBOARD TABLE ===
var table dash = table.new(position.top_right, 2, 5,
bgcolor=color.new(color.black, 20),
border_width=1, border_color=color.gray)
if showDashboard and barstate.islast
table.cell(dash, 0, 0, "INDICATOR", text_color=color.white, text_size=size.small,
bgcolor=color.new(#448AFF, 30))
table.cell(dash, 1, 0, "STATUS", text_color=color.white, text_size=size.small,
bgcolor=color.new(#448AFF, 30))
table.cell(dash, 0, 1, "SuperTrend", text_color=color.white, text_size=size.tiny)
table.cell(dash, 1, 1, upTrend ? "▲ BULL" : "▼ BEAR",
text_color=upTrend ? #00E676 : #FF5252, text_size=size.tiny)
table.cell(dash, 0, 2, "MACD Hist", text_color=color.white, text_size=size.tiny)
table.cell(dash, 1, 2, macdBullish ? "POS +" : "NEG -",
text_color=macdBullish ? #00E676 : #FF5252, text_size=size.tiny)
table.cell(dash, 0, 3, "MACD Value", text_color=color.white, text_size=size.tiny)
table.cell(dash, 1, 3, str.tostring(histLine, "#.####"),
text_color=color.white, text_size=size.tiny)
table.cell(dash, 0, 4, "SIGNAL", text_color=color.white, text_size=size.tiny,
bgcolor=color.new(#FFC107, 50))
signalText = upTrend and macdBullish ? "🚀 BUY" :
downTrend and macdBearish ? "🛑 SELL" : "⏸ WAIT"
signalColor = upTrend and macdBullish ? #00E676 :
downTrend and macdBearish ? #FF5252 : color.gray
table.cell(dash, 1, 4, signalText, text_color=signalColor, text_size=size.tiny,
bgcolor=color.new(#FFC107, 80))
Cara Install & Pakai
- Buka TradingView, pilih chart asset apa pun
- Klik tab “Pine Editor” di bottom
- Copy seluruh code di atas, paste di editor (hapus default)
- Save (Ctrl+S), nama: “SuperTrend MACD Combo”
- Klik “Add to chart”
- Indikator akan plot SuperTrend lines, MACD signals, dashboard di top-right
Cara Baca Signals
🚀 BUY Signal
- SuperTrend line berubah hijau (di bawah price)
- MACD histogram positive (atau cross atas zero)
- Arrow hijau muncul di bawah candle
- Background chart slightly green tint
- Dashboard show “🚀 BUY”
🛑 SELL Signal
- SuperTrend line berubah merah (di atas price)
- MACD histogram negative (atau cross bawah zero)
- Arrow merah muncul di atas candle
- Background chart slightly red tint
- Dashboard show “🛑 SELL”
⏸ WAIT
Indikator divergence — SuperTrend kata satu hal, MACD kata lain. Tidak entry. Wait alignment.
Best Practices
1. Timeframe Recommendation
- M5-M15: Untuk scalping di synthetic (V75)
- H1-H4: Untuk swing trading forex
- Daily: Untuk position trading stock
2. Parameter Tuning
3. Risk Management
- Stop loss: Place di luar SuperTrend line (akan flip kalau breached)
- Take profit: R/R minimum 1:2, atau exit ketika SuperTrend flip arah
- Position size: Max 2% balance per trade
- Filter: Avoid trade di low-volume periods (Asian session untuk forex)
Strategi Lengkap dengan Entry & Exit
📋 Trade Plan Template
BUY Setup:
1. Wait SuperTrend flip ke hijau (green line below price)
2. Confirm MACD histogram positive (di atas zero)
3. Entry di close candle pertama setelah signal
4. Stop loss: di bawah SuperTrend line + 5 pips buffer
5. Take profit: 2x risk (1:2 R/R) atau ketika SuperTrend flip merah
Inverse untuk SELL signal.
Limitations
⚠️ Tidak Magic Formula
Combo ini work bagus di trending markets. Di sideways/ranging, masih bisa kena whipsaw. Tips:
• Avoid trade di low ADX (< 20 = ranging)
• Skip news event high-impact (NFP, FOMC)
• Daytime weekend untuk synthetic (volatility lower)
🚀 Test combo SuperTrend+MACD di chart Deriv (demo gratis):
Buka Demo Deriv GratisTopik Terkait
- Auto Fibonacci Indikator
- Ichimoku Cloud Pine Script
- 10 Pine Script Indikator Ready
- AI untuk Generate Pine Script
