📐 Indikator Cluster

Indikator Fibonacci Otomatis dengan AI — Ready Pine Script

Oleh Dan Machado · 10 menit baca

Fibonacci Retracement adalah salah satu tools paling populer di trading. Tapi menggambar level secara manual tiap kali ada swing high/low baru tedious. Tutorial ini punya Pine Script lengkap yang auto-detect pivots dan plot semua Fibonacci levels otomatis — generated dengan AI.

Apa Itu Fibonacci Retracement?

Fibonacci retracement based pada urutan angka Fibonacci (0, 1, 1, 2, 3, 5, 8, 13…). Rasio kunci untuk trading:

0%
Origin
23.6%
Shallow
38.2%
Standard
50%
Midpoint
61.8%
Golden ★
78.6%
Deep
100%
Full

Level 61.8% (Golden Ratio) paling diawasi — banyak trader entry di sini karena historically harga bounce dari level ini sering.

Cara Pakai Manual (Tradisional)

  1. Identify swing high dan swing low recent
  2. Tarik Fibonacci tool dari low ke high (untuk uptrend retracement) atau sebaliknya
  3. Wait price retrace ke level Fibonacci
  4. Look for confirmation (candlestick pattern, indicator signal) di level Fib
  5. Entry dengan stop di luar level berikutnya

Masalah: manual approach subjective dan time-consuming. Setiap trader bisa pilih swing point berbeda. Solusi: otomasi.

Pine Script Auto Fibonacci — Code Lengkap

Code di bawah ini auto-detect pivots dan plot Fibonacci levels secara dynamic. Copy ke TradingView Pine Editor.

▸ Pine Script v5 · Auto Fibonacci COPY ↗
//@version=5
indicator("Auto Fibonacci Retracement — IA Trader Pro", overlay=true)

// === INPUTS ===
pivotLeft  = input.int(10, "Pivot Left bars", minval=1)
pivotRight = input.int(10, "Pivot Right bars", minval=1)
showLabels = input.bool(true, "Show level labels")
extendLines = input.bool(true, "Extend lines to right")

// === PIVOT DETECTION ===
ph = ta.pivothigh(high, pivotLeft, pivotRight)
pl = ta.pivotlow(low, pivotLeft, pivotRight)

// === STATE ===
var float swingHigh = na
var float swingLow  = na
var int   swingHighBar = na
var int   swingLowBar  = na

if not na(ph)
    swingHigh = ph
    swingHighBar = bar_index - pivotRight

if not na(pl)
    swingLow = pl
    swingLowBar = bar_index - pivotRight

// === CALCULATE FIBONACCI LEVELS ===
diff = swingHigh - swingLow

f0     = swingLow
f236   = swingLow + diff * 0.236
f382   = swingLow + diff * 0.382
f500   = swingLow + diff * 0.500
f618   = swingLow + diff * 0.618
f786   = swingLow + diff * 0.786
f1000  = swingHigh

// === COLORS ===
col0   = color.new(#FF5252, 0)
col236 = color.new(#FFC107, 30)
col382 = color.new(#00C8C8, 30)
col500 = color.new(#FFFFFF, 30)
col618 = color.new(#00E676, 0)  // Golden ratio highlighted
col786 = color.new(#448AFF, 30)
col100 = color.new(#FF5252, 0)

// === PLOT LINES (using plot lines based on swing) ===
plot(swingHigh, "100%", color=col100, linewidth=1, style=plot.style_linebr)
plot(f786,      "78.6%", color=col786, linewidth=1, style=plot.style_linebr)
plot(f618,      "61.8% Golden", color=col618, linewidth=2, style=plot.style_linebr)
plot(f500,      "50.0%", color=col500, linewidth=1, style=plot.style_linebr)
plot(f382,      "38.2%", color=col382, linewidth=1, style=plot.style_linebr)
plot(f236,      "23.6%", color=col236, linewidth=1, style=plot.style_linebr)
plot(swingLow,  "0%", color=col0, linewidth=1, style=plot.style_linebr)

// === LABELS ===
if showLabels and not na(ph) and barstate.islast
    label.delete(label.new(bar_index, swingHigh, "100% = " + str.tostring(swingHigh, "#.##"),
      color=color.new(color.black, 70), textcolor=color.red, style=label.style_label_left, size=size.small))
    label.delete(label.new(bar_index, f618, "61.8% (Golden) = " + str.tostring(f618, "#.##"),
      color=color.new(color.black, 70), textcolor=#00E676, style=label.style_label_left, size=size.small))
    label.delete(label.new(bar_index, swingLow, "0% = " + str.tostring(swingLow, "#.##"),
      color=color.new(color.black, 70), textcolor=color.red, style=label.style_label_left, size=size.small))

// === ALERTS ===
priceNearGolden = math.abs(close - f618) / close < 0.002  // within 0.2%
alertcondition(priceNearGolden, title="Price at 0.618 Golden Ratio",
  message="Price near Fibonacci 0.618 level — potential reversal zone")

priceNear500 = math.abs(close - f500) / close < 0.002
alertcondition(priceNear500, title="Price at 0.500",
  message="Price near Fibonacci 0.500 level")

priceNear382 = math.abs(close - f382) / close < 0.002
alertcondition(priceNear382, title="Price at 0.382",
  message="Price near Fibonacci 0.382 level — shallow retracement")

// === DASHBOARD TABLE ===
var table info = table.new(position.top_right, 2, 8,
  bgcolor=color.new(color.black, 20),
  border_width=1, border_color=color.gray)

if barstate.islast
    table.cell(info, 0, 0, "FIB LEVEL", text_color=color.white, text_size=size.small,
      bgcolor=color.new(#FFC107, 30))
    table.cell(info, 1, 0, "PRICE", text_color=color.white, text_size=size.small,
      bgcolor=color.new(#FFC107, 30))
    
    table.cell(info, 0, 1, "100%", text_color=#FF5252, text_size=size.tiny)
    table.cell(info, 1, 1, str.tostring(swingHigh, "#.##"), text_color=color.white, text_size=size.tiny)
    
    table.cell(info, 0, 2, "78.6%", text_color=#448AFF, text_size=size.tiny)
    table.cell(info, 1, 2, str.tostring(f786, "#.##"), text_color=color.white, text_size=size.tiny)
    
    table.cell(info, 0, 3, "61.8% ★", text_color=#00E676, text_size=size.tiny)
    table.cell(info, 1, 3, str.tostring(f618, "#.##"), text_color=#00E676, text_size=size.tiny)
    
    table.cell(info, 0, 4, "50.0%", text_color=color.white, text_size=size.tiny)
    table.cell(info, 1, 4, str.tostring(f500, "#.##"), text_color=color.white, text_size=size.tiny)
    
    table.cell(info, 0, 5, "38.2%", text_color=#00C8C8, text_size=size.tiny)
    table.cell(info, 1, 5, str.tostring(f382, "#.##"), text_color=color.white, text_size=size.tiny)
    
    table.cell(info, 0, 6, "23.6%", text_color=#FFC107, text_size=size.tiny)
    table.cell(info, 1, 6, str.tostring(f236, "#.##"), text_color=color.white, text_size=size.tiny)
    
    table.cell(info, 0, 7, "0%", text_color=#FF5252, text_size=size.tiny)
    table.cell(info, 1, 7, str.tostring(swingLow, "#.##"), text_color=color.white, text_size=size.tiny)

Cara Install di TradingView

  1. Buka TradingView, pilih chart asset apa pun (EUR/USD, BTC, V75, dll)
  2. Klik tab “Pine Editor” di bottom panel
  3. Copy seluruh code di atas
  4. Paste di Pine Editor, hapus content default
  5. Klik “Save” (Ctrl+S), beri nama “Auto Fibonacci IA”
  6. Klik “Add to chart”
  7. Fibonacci levels akan auto-plot di chart kamu

💡 Tweak Parameter

Klik gear icon indicator → settings:
Pivot Left/Right (10): kalau terlalu sensitive, naikan ke 15-20
Show labels: disable untuk chart yang sudah crowded
Extend lines: default ON, kasih pandangan future levels

Strategi Trading dengan Fibonacci Auto

1. Bounce di 0.618 Golden Ratio (Most Popular)

  • Wait price retrace ke level 61.8%
  • Look for confirmation: bullish/bearish candle (hammer, engulfing)
  • Combine dengan RSI: kalau RSI oversold di 61.8% retracement → strong buy signal
  • Entry: setelah candle confirmation close
  • Stop loss: 1% di bawah/atas level 78.6%
  • Take profit: 50% level → 38.2% level → 0% (full retracement)

2. Multi-Level Entry (Scaling In)

  • Entry kecil di 38.2% (33% position)
  • Tambah di 50% (33% position)
  • Tambah lagi di 61.8% (34% position)
  • Stop loss untuk semua di luar 78.6%
  • Take profit average position di 0% level

3. Fibonacci Extension untuk Take Profit

Setelah breakout dari level 0% (full retracement), pakai Fib extension untuk targets:

  • 1.272 extension: TP1 (conservative)
  • 1.618 extension: TP2 (golden ratio extension)
  • 2.618 extension: TP3 (aggressive)

Combine dengan Indikator Lain

✓ Best Confluence Combinations

Fib + RSI: 61.8% level + RSI < 30 (oversold) = high probability bounce
Fib + EMA: 50% level + EMA 50 = strong support
Fib + Volume: bounce dari 61.8% dengan volume spike = confirmation
Fib + Candlestick: hammer/doji di level Fib = reversal signal

Limitations & Disclaimer

⚠️ Yang Harus Kamu Tahu

Fibonacci tidak magic. Level Fib hanya area probable bounce, bukan guaranteed bounce. 30-40% setups Fib akan fail — break level dan continue trend. Selalu kombinasi dengan:
• Risk management (stop loss disiplin)
• Multiple confirmation (indicator, candlestick)
• Position sizing yang masuk akal (1-2% per trade)

Modifikasi dengan AI

Mau code Fibonacci yang lebih advanced? Minta AI:

  • “Tambah Fibonacci Fan (rays from swing low)”
  • “Add Fibonacci Time Zones di X-axis”
  • “Combine Fibonacci dengan Bollinger Bands untuk dynamic support/resistance”
  • “Plot multi-timeframe Fibonacci levels”

Lihat lebih jauh: ChatGPT & Claude untuk Generate Indikator.

🚀 Test Fibonacci ini di chart Deriv (demo gratis $10,000 virtual):

Buka Demo Deriv Gratis

Topik Terkait

DM

Dan Machado

Founder IA Trader Pro · Pine Script developer · 5+ tahun trading Fibonacci

⚠️ Disclaimer: Indikator Fibonacci tidak menjamin profit. Selalu kombinasi dengan risk management dan multiple confirmation. Trading binary options berisiko tinggi. Deriv tidak diregulasi Bappebti Indonesia. Artikel ini mengandung affiliate link Deriv. Disclaimer lengkap.

Similar Posts