İleri Seviye Finansal Eğitim
Premium
7.4 - Custom İndikatör Geliştirme
undefined undefined
30 Ekim 2025
1 görüntülenme
💻 Custom İndikatör Geliştirme (Pine Script)
Bu Modülde Neler Öğreneceksiniz?
Pine Script temellerini, kendi indikatörünüzü yazmayı, alert sistemi, strategy testi ve TradingView'da yayınlamayı öğreneceksiniz.
Pine Script, TradingView'ın kendi programlama dilidir. Basit syntax'ı ile kendi indikatörlerinizi, stratejilerinizi ve alertlerinizi oluşturabilirsiniz.
🎯 Pine Script Temelleri
Temel Yapı
//@version=5
indicator("My Indicator", overlay=true)
// Değişkenler
length = input.int(14, "Period")
src = input.source(close, "Source")
// Hesaplama
ma = ta.sma(src, length)
// Çizim
plot(ma, color=color.blue, linewidth=2)
indicator("My Indicator", overlay=true)
// Değişkenler
length = input.int(14, "Period")
src = input.source(close, "Source")
// Hesaplama
ma = ta.sma(src, length)
// Çizim
plot(ma, color=color.blue, linewidth=2)
Önemli Fonksiyonlar
- ta.sma(): Simple Moving Average
- ta.ema(): Exponential MA
- ta.rsi(): RSI hesaplama
- ta.crossover(): Yukarı kesişim
- ta.crossunder(): Aşağı kesişim
- plot(): Grafik çizimi
- plotshape(): Şekil çizimi
- alertcondition(): Alert oluşturma
📝 Örnek İndikatörler
//@version=5
indicator("MA Crossover", overlay=true)
// Input
fastLength = input.int(9, "Fast MA")
slowLength = input.int(21, "Slow MA")
// Hesaplama
fastMA = ta.sma(close, fastLength)
slowMA = ta.sma(close, slowLength)
// Çizim
plot(fastMA, "Fast MA", color.blue, 2)
plot(slowMA, "Slow MA", color.red, 2)
// Sinyaller
bullishCross = ta.crossover(fastMA, slowMA)
bearishCross = ta.crossunder(fastMA, slowMA)
plotshape(bullishCross, "Buy", shape.triangleup, location.belowbar, color.green, size=size.small)
plotshape(bearishCross, "Sell", shape.triangledown, location.abovebar, color.red, size=size.small)
// Alert
alertcondition(bullishCross, "Buy Signal", "MA Crossover BUY!")
alertcondition(bearishCross, "Sell Signal", "MA Crossover SELL!")
indicator("MA Crossover", overlay=true)
// Input
fastLength = input.int(9, "Fast MA")
slowLength = input.int(21, "Slow MA")
// Hesaplama
fastMA = ta.sma(close, fastLength)
slowMA = ta.sma(close, slowLength)
// Çizim
plot(fastMA, "Fast MA", color.blue, 2)
plot(slowMA, "Slow MA", color.red, 2)
// Sinyaller
bullishCross = ta.crossover(fastMA, slowMA)
bearishCross = ta.crossunder(fastMA, slowMA)
plotshape(bullishCross, "Buy", shape.triangleup, location.belowbar, color.green, size=size.small)
plotshape(bearishCross, "Sell", shape.triangledown, location.abovebar, color.red, size=size.small)
// Alert
alertcondition(bullishCross, "Buy Signal", "MA Crossover BUY!")
alertcondition(bearishCross, "Sell Signal", "MA Crossover SELL!")
//@version=5
indicator("RSI + Bollinger", overlay=false)
// RSI
rsiLength = input.int(14, "RSI Length")
rsiValue = ta.rsi(close, rsiLength)
// Bollinger on RSI
bbLength = input.int(20, "BB Length")
bbMult = input.float(2.0, "BB Mult")
basis = ta.sma(rsiValue, bbLength)
dev = bbMult * ta.stdev(rsiValue, bbLength)
upper = basis + dev
lower = basis - dev
// Plot
plot(rsiValue, "RSI", color.blue, 2)
plot(basis, "Basis", color.yellow)
p1 = plot(upper, "Upper", color.red)
p2 = plot(lower, "Lower", color.green)
fill(p1, p2, color.new(color.gray, 90))
// Levels
hline(70, "Overbought", color.red, linestyle=hline.style_dashed)
hline(30, "Oversold", color.green, linestyle=hline.style_dashed)
hline(50, "Middle", color.gray)
indicator("RSI + Bollinger", overlay=false)
// RSI
rsiLength = input.int(14, "RSI Length")
rsiValue = ta.rsi(close, rsiLength)
// Bollinger on RSI
bbLength = input.int(20, "BB Length")
bbMult = input.float(2.0, "BB Mult")
basis = ta.sma(rsiValue, bbLength)
dev = bbMult * ta.stdev(rsiValue, bbLength)
upper = basis + dev
lower = basis - dev
// Plot
plot(rsiValue, "RSI", color.blue, 2)
plot(basis, "Basis", color.yellow)
p1 = plot(upper, "Upper", color.red)
p2 = plot(lower, "Lower", color.green)
fill(p1, p2, color.new(color.gray, 90))
// Levels
hline(70, "Overbought", color.red, linestyle=hline.style_dashed)
hline(30, "Oversold", color.green, linestyle=hline.style_dashed)
hline(50, "Middle", color.gray)
//@version=5
indicator("Volume Spike", overlay=true)
// Volume MA
volLength = input.int(20, "Volume MA")
volMultiplier = input.float(2.0, "Spike Multiplier")
volMA = ta.sma(volume, volLength)
volSpike = volume > volMA * volMultiplier
// Color bars
barcolor(volSpike ? color.yellow : na)
// Plot volume
plot(volMA, "Vol MA", color.blue, display=display.none)
// Alert
if volSpike
label.new(bar_index, high, "🔥", style=label.style_label_down, color=color.yellow, textcolor=color.black)
alert("Volume Spike Detected!", alert.freq_once_per_bar)
indicator("Volume Spike", overlay=true)
// Volume MA
volLength = input.int(20, "Volume MA")
volMultiplier = input.float(2.0, "Spike Multiplier")
volMA = ta.sma(volume, volLength)
volSpike = volume > volMA * volMultiplier
// Color bars
barcolor(volSpike ? color.yellow : na)
// Plot volume
plot(volMA, "Vol MA", color.blue, display=display.none)
// Alert
if volSpike
label.new(bar_index, high, "🔥", style=label.style_label_down, color=color.yellow, textcolor=color.black)
alert("Volume Spike Detected!", alert.freq_once_per_bar)
🚀 Strategy Backtesting
//@version=5
strategy("My Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
// Indicators
fastMA = ta.sma(close, 9)
slowMA = ta.sma(close, 21)
// Entry Conditions
longCondition = ta.crossover(fastMA, slowMA)
shortCondition = ta.crossunder(fastMA, slowMA)
// Execute Trades
if longCondition
strategy.entry("Long", strategy.long)
if shortCondition
strategy.entry("Short", strategy.short)
// Exit Conditions
if ta.crossunder(fastMA, slowMA)
strategy.close("Long")
if ta.crossover(fastMA, slowMA)
strategy.close("Short")
// Plot
plot(fastMA, "Fast", color.blue)
plot(slowMA, "Slow", color.red)
strategy("My Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
// Indicators
fastMA = ta.sma(close, 9)
slowMA = ta.sma(close, 21)
// Entry Conditions
longCondition = ta.crossover(fastMA, slowMA)
shortCondition = ta.crossunder(fastMA, slowMA)
// Execute Trades
if longCondition
strategy.entry("Long", strategy.long)
if shortCondition
strategy.entry("Short", strategy.short)
// Exit Conditions
if ta.crossunder(fastMA, slowMA)
strategy.close("Long")
if ta.crossover(fastMA, slowMA)
strategy.close("Short")
// Plot
plot(fastMA, "Fast", color.blue)
plot(slowMA, "Slow", color.red)
💡 Backtest Sonuçları: TradingView otomatik olarak Net Profit, Win Rate, Max Drawdown, Sharpe Ratio gibi metrikleri gösterir.
🎓 Bilgi Testi (5 Soru)
Soru 1/5
Pine Script'te hangi fonksiyon Simple Moving Average hesaplar?
A) ta.sma()
B) ma.simple()
C) sma()
D) moving_average()
Önemli Hatırlatmalar
- Version: Her zaman //@version=5 ile başlayın
- Overlay: overlay=true fiyat üstüne, false alt panele çizer
- Input: input.int(), input.float() ile kullanıcı ayarları
- ta.* Fonksiyonları: Teknik analiz hesaplamaları
- Backtest: Strategy ile gerçek performans test edin
- Pratik: TradingView Pine Editor'de deneyerek öğrenin
Etiketler
#pine-script