Pine Script · TradingView · Free Code

10 Indikator Pine Script Ready-to-Copy untuk TradingView

Penulis: Tim Editorial · Diperbarui: Mei 2026 · Waktu baca: 18 menit

📌 Yang Anda dapatkan

  • 10 indikator Pine Script v5 ready-to-copy untuk TradingView
  • Semua kode terkomentar dan compile tanpa error
  • Mencakup trend, momentum, volatility, S/R, dan risk management
  • Setiap indicator dapat di-customize via input parameters
  • Gratis untuk digunakan dan dimodifikasi

🎯 Cara menggunakan

Setiap indicator: Copy kode → TradingView → Pine Editor (bawah chart) → Paste → SaveAdd to chart. Selesai dalam 30 detik per indicator.

10 Indikator Ready-to-Copy

01 Trend Following Multi-EMA Cross System

Sistem 3 EMA (9, 21, 50) dengan visual stack alignment dan signal beli/jual otomatis.

pinescript
//@version=5
indicator("Multi-EMA Cross System", overlay=true)

ema9 = ta.ema(close, 9)
ema21 = ta.ema(close, 21)
ema50 = ta.ema(close, 50)

plot(ema9, "EMA 9", color=color.aqua, linewidth=2)
plot(ema21, "EMA 21", color=color.orange, linewidth=2)
plot(ema50, "EMA 50", color=color.red, linewidth=2)

bullish_stack = ema9 > ema21 and ema21 > ema50
bearish_stack = ema9 < ema21 and ema21 < ema50

bgcolor(bullish_stack ? color.new(color.green, 90) : bearish_stack ? color.new(color.red, 90) : na)

buy_signal = ta.crossover(ema9, ema21) and ema21 > ema50
sell_signal = ta.crossunder(ema9, ema21) and ema21 < ema50

plotshape(buy_signal, "Buy", shape.triangleup, location.belowbar, color.green, size=size.normal)
plotshape(sell_signal, "Sell", shape.triangledown, location.abovebar, color.red, size=size.normal)

alertcondition(buy_signal, "Buy Signal", "EMA Buy Signal terdeteksi")
alertcondition(sell_signal, "Sell Signal", "EMA Sell Signal terdeteksi")
02 Momentum RSI Divergence Detector

Mendeteksi divergence bullish dan bearish antara harga dan RSI secara otomatis.

pinescript
//@version=5
indicator("RSI Divergence Detector", overlay=false)

rsi_length = input.int(14, "RSI Length")
lookback = input.int(5, "Pivot Lookback")

rsi = ta.rsi(close, rsi_length)
plot(rsi, "RSI", color=color.blue)
hline(70, "Overbought", color=color.red)
hline(30, "Oversold", color=color.green)

ph = ta.pivothigh(rsi, lookback, lookback)
pl = ta.pivotlow(rsi, lookback, lookback)

bull_div = pl and pl < pl[1] and ta.valuewhen(pl, low[lookback], 0) > ta.valuewhen(pl, low[lookback], 1)
bear_div = ph and ph > ph[1] and ta.valuewhen(ph, high[lookback], 0) < ta.valuewhen(ph, high[lookback], 1)

plotshape(bull_div, "Bull Div", shape.labelup, location.belowbar, color.green, text="DIV")
plotshape(bear_div, "Bear Div", shape.labeldown, location.abovebar, color.red, text="DIV")
03 Volatility Volatility Squeeze Detector

Identifikasi pasar dalam konsolidasi rendah volatilitas – signal awal breakout besar.

pinescript
//@version=5
indicator("Volatility Squeeze", overlay=true)

length = input.int(20, "BB Length")
mult_bb = input.float(2.0, "BB Mult")
mult_kc = input.float(1.5, "KC Mult")

basis = ta.sma(close, length)
dev = mult_bb * ta.stdev(close, length)
upper_bb = basis + dev
lower_bb = basis - dev

ema = ta.ema(close, length)
range_ma = ta.ema(ta.tr(true), length)
upper_kc = ema + range_ma * mult_kc
lower_kc = ema - range_ma * mult_kc

squeeze = (lower_bb > lower_kc) and (upper_bb < upper_kc)

plot(basis, "Basis", color.gray)
plot(upper_bb, "Upper BB", color.aqua)
plot(lower_bb, "Lower BB", color.aqua)
bgcolor(squeeze ? color.new(color.orange, 70) : na)
alertcondition(squeeze and not squeeze[1], "Squeeze ON", "Volatility Squeeze terdeteksi")
alertcondition(not squeeze and squeeze[1], "Squeeze OFF", "Squeeze release - potential breakout!")
04 Support/Resistance Auto Support & Resistance

Menggambar otomatis level S/R berdasarkan pivot high/low yang dikonfirmasi multiple touch.

pinescript
//@version=5
indicator("Auto S/R Levels", overlay=true)

lookback = input.int(10, "Pivot Lookback")
strength = input.int(2, "Min Touches")

ph = ta.pivothigh(high, lookback, lookback)
pl = ta.pivotlow(low, lookback, lookback)

var line[] resistance_lines = array.new_line()
var line[] support_lines = array.new_line()

if not na(ph)
    line.new(bar_index - lookback, ph, bar_index, ph, color=color.red, width=1, extend=extend.right)
if not na(pl)
    line.new(bar_index - lookback, pl, bar_index, pl, color=color.green, width=1, extend=extend.right)
05 Volume Volume-Weighted MACD

Versi MACD yang memberikan bobot lebih pada periode dengan volume tinggi.

pinescript
//@version=5
indicator("Volume Weighted MACD", overlay=false)

fast = input.int(12, "Fast Length")
slow = input.int(26, "Slow Length")
signal = input.int(9, "Signal Length")

vwma_fast = ta.vwma(close, fast)
vwma_slow = ta.vwma(close, slow)
macd_line = vwma_fast - vwma_slow
signal_line = ta.ema(macd_line, signal)
histogram = macd_line - signal_line

plot(macd_line, "MACD", color.blue, linewidth=2)
plot(signal_line, "Signal", color.orange, linewidth=2)
plot(histogram, "Histogram", color=histogram >= 0 ? color.green : color.red, style=plot.style_columns)
hline(0)
06 Mean Reversion Bollinger Band Mean Reversion

Strategy MR dengan filter ADX – hanya signal saat pasar ranging (ADX < 25).

pinescript
//@version=5
indicator("BB Mean Reversion", overlay=true)

length = input.int(20, "BB Length")
mult = input.float(2.0, "BB StdDev")
adx_threshold = input.int(25, "ADX Max for Ranging")

basis = ta.sma(close, length)
dev = mult * ta.stdev(close, length)
upper = basis + dev
lower = basis - dev

plot(upper, "Upper", color.red)
plot(basis, "Basis", color.gray)
plot(lower, "Lower", color.green)

[plus_di, minus_di, adx] = ta.dmi(14, 14)
ranging = adx < adx_threshold

buy = ranging and ta.crossover(close, lower)
sell = ranging and ta.crossunder(close, upper)

plotshape(buy, "Buy", shape.triangleup, location.belowbar, color.green)
plotshape(sell, "Sell", shape.triangledown, location.abovebar, color.red)
07 Trend Strength ADX Trend Strength Filter

Visual ADX dengan zone trending (>25), kuat (>40), dan ranging (<20).

pinescript
//@version=5
indicator("ADX Trend Filter", overlay=false)

length = input.int(14, "ADX Length")
[plus_di, minus_di, adx] = ta.dmi(length, length)

plot(adx, "ADX", color.blue, linewidth=2)
plot(plus_di, "+DI", color.green)
plot(minus_di, "-DI", color.red)

hline(20, "Ranging", color.gray, linestyle=hline.style_dashed)
hline(25, "Trend Start", color.orange, linestyle=hline.style_dashed)
hline(40, "Strong Trend", color.purple, linestyle=hline.style_dashed)

bgcolor(adx > 40 ? color.new(color.purple, 90) : adx > 25 ? color.new(color.green, 90) : color.new(color.gray, 95))
08 Multi-Timeframe MTF Trend Confirmation

Memeriksa tren di 3 timeframe (current, H4, Daily) secara simultan.

pinescript
//@version=5
indicator("MTF Trend Confirmation", overlay=true)

ema_length = input.int(50, "EMA Length")

ema_current = ta.ema(close, ema_length)
ema_h4 = request.security(syminfo.tickerid, "240", ta.ema(close, ema_length))
ema_daily = request.security(syminfo.tickerid, "D", ta.ema(close, ema_length))

trend_current = close > ema_current ? 1 : -1
trend_h4 = close > ema_h4 ? 1 : -1
trend_daily = close > ema_daily ? 1 : -1
total = trend_current + trend_h4 + trend_daily

bgcolor(total == 3 ? color.new(color.green, 80) : total == -3 ? color.new(color.red, 80) : na)

var table info = table.new(position.top_right, 2, 4, border_width=1)
if barstate.islast
    table.cell(info, 0, 0, "Timeframe", bgcolor=color.gray, text_color=color.white)
    table.cell(info, 1, 0, "Trend", bgcolor=color.gray, text_color=color.white)
    table.cell(info, 0, 1, "Current")
    table.cell(info, 1, 1, trend_current > 0 ? "▲ Up" : "▼ Down", text_color=trend_current > 0 ? color.green : color.red)
    table.cell(info, 0, 2, "H4")
    table.cell(info, 1, 2, trend_h4 > 0 ? "▲ Up" : "▼ Down", text_color=trend_h4 > 0 ? color.green : color.red)
    table.cell(info, 0, 3, "Daily")
    table.cell(info, 1, 3, trend_daily > 0 ? "▲ Up" : "▼ Down", text_color=trend_daily > 0 ? color.green : color.red)
09 Risk Management ATR Stop Loss Helper

Menggambar level stop loss dinamis berdasarkan ATR untuk position sizing.

pinescript
//@version=5
indicator("ATR Stop Loss Helper", overlay=true)

atr_length = input.int(14, "ATR Length")
atr_mult = input.float(2.0, "ATR Multiplier")

atr = ta.atr(atr_length)
stop_long = low - atr * atr_mult
stop_short = high + atr * atr_mult

plot(stop_long, "Long Stop", color.green, linewidth=1, style=plot.style_circles)
plot(stop_short, "Short Stop", color.red, linewidth=1, style=plot.style_circles)

var label info_label = na
if barstate.islast
    label.delete(info_label)
    info_label := label.new(bar_index, high * 1.001,
        "Long Stop: " + str.tostring(stop_long, format.mintick) + "\nShort Stop: " + str.tostring(stop_short, format.mintick) + "\nATR: " + str.tostring(atr, format.mintick),
        style=label.style_label_down, color=color.new(color.black, 20), textcolor=color.white)
10 Session Trading London/NY Session Markers

Visualisasi sesi London (08:00-17:00 GMT) dan NY (13:00-22:00 GMT) di chart.

pinescript
//@version=5
indicator("Session Markers", overlay=true)

show_london = input.bool(true, "Show London")
show_ny = input.bool(true, "Show New York")
show_asian = input.bool(false, "Show Asian")

is_london = time(timeframe.period, "0800-1700:1234567", "GMT")
is_ny = time(timeframe.period, "1300-2200:1234567", "GMT")
is_asian = time(timeframe.period, "0000-0700:1234567", "GMT")

bgcolor(show_london and is_london ? color.new(color.blue, 92) : na, title="London")
bgcolor(show_ny and is_ny ? color.new(color.orange, 92) : na, title="New York")
bgcolor(show_asian and is_asian ? color.new(color.purple, 92) : na, title="Asian")

Cara menggunakan kode ini

1

Copy kode

Klik tombol “Copy” di pojok kanan atas setiap code block.

2

Buka TradingView

Login dan navigasi ke chart instrumen yang Anda inginkan (EUR/USD, BTC/USDT, dll).

3

Buka Pine Editor

Klik Pine Editor tab di bagian bawah chart.

4

Paste dan Save

Hapus contoh kode default, paste kode kami, klik Save, beri nama (e.g., “Multi-EMA Cross”).

5

Add to Chart

Klik Add to chart. Indicator akan muncul. Customize parameter via gear icon ⚙️.

Cara customize dengan AI

Setiap indicator dapat di-modify dengan ChatGPT atau Claude:

🔧 Customization Prompt

Berikut kode Pine Script:
[paste kode]

Tolong modifikasi untuk:
- [perubahan spesifik 1]
- [perubahan spesifik 2]
- Tambah [feature baru]
- Hapus [feature lama]

Pastikan tetap compile dan kompatibel dengan Pine Script v5.

Contoh modifikasi umum:

  • Ganti EMA dengan SMA atau WMA
  • Tambah filter berdasarkan timeframe lebih tinggi
  • Modifikasi alert messages
  • Add color customization options
  • Integrasi dengan indicator lain

✓ Best practice

Test setiap modifikasi di paper trading 1-2 minggu sebelum live. Indicator yang berfungsi di backtest tidak selalu berfungsi di live trading.

Backtest indicators ini

Untuk backtest, konversi indicator menjadi strategy:

  1. Buka indicator di Pine Editor
  2. Ganti indicator() dengan strategy()
  3. Tambah strategy.entry() dan strategy.exit()
  4. Save dan add ke chart
  5. Buka Strategy Tester tab
  6. Review hasil: net profit, win rate, max drawdown

Atau gunakan AI prompt:

🔄 Convert to Strategy

Konversi indicator Pine Script ini menjadi strategy yang dapat di-backtest:

[paste kode indicator]

Aturan tambahan:
- Risk per trade: 1% modal
- Stop loss: 1.5x ATR
- Take profit: 3x ATR
- Position size: based on stop loss distance
- Commission: 0.05%
- Slippage: 2 ticks
⚠️ Disclaimer: Indikator-indikator ini adalah tools, bukan jaminan profit. 70-89% trader retail kehilangan uang. Selalu test di akun demo dan gunakan manajemen risiko yang tepat. Tidak ada strategi yang menang 100%.

Similar Posts