OPEN-SOURCE SCRIPT

SMA Trend Takip + MACD & RSI Teyit

//version=5
indicator("SMA Trend Takip + MACD & RSI Teyit", overlay=true)

// Kullanıcı tarafından ayarlanabilir SMA değerleri
smaShortLength = input(50, title="Kısa Dönem SMA")
smaLongLength = input(200, title="Uzun Dönem SMA")

// SMA'ları hesapla
smaShort = ta.sma(close, smaShortLength)
smaLong = ta.sma(close, smaLongLength)

// MACD hesapla ve opsiyonel olarak kullan
useMACD = input(true, title="MACD Kullan")
[macdLine, signalLine, _] = ta.macd(close, 12, 26, 9)
macdConfirmBuy = not useMACD or macdLine > signalLine
macdConfirmSell = not useMACD or macdLine < signalLine

// RSI hesapla ve opsiyonel olarak kullan
useRSI = input(true, title="RSI Kullan")
rsiLength = input(14, title="RSI Periyodu")
rsi = ta.rsi(close, rsiLength)
rsiConfirmBuy = not useRSI or rsi > 50
rsiConfirmSell = not useRSI or rsi < 50

// Trend belirleme (MACD ve RSI teyitli veya devre dışı bırakılabilir)
bullishTrend = smaShort > smaLong and macdConfirmBuy and rsiConfirmBuy
bearishTrend = smaShort < smaLong and macdConfirmSell and rsiConfirmSell

// Renkli arka plan ile trend gösterimi
bgcolor(bullishTrend ? color.green : bearishTrend ? color.red : na, transp=85)

// Trend yönüne göre oklar çiz
plotshape(series=ta.crossover(smaShort, smaLong) and bullishTrend, location=location.belowbar, color=color.green, style=shape.labelup, size=size.small, title="Boğa Trendi")
plotshape(series=ta.crossunder(smaShort, smaLong) and bearishTrend, location=location.abovebar, color=color.red, style=shape.labeldown, size=size.small, title="Ayı Trendi")

// SMA'ları göster
plot(smaShort, color=color.blue, title="Kısa Dönem SMA")
plot(smaLong, color=color.orange, title="Uzun Dönem SMA")

Penafian