indicator("Trend Master 60 - Final Alarmlı", overlay=true)
kamaLen = input.int(21, "Hassasiyet")
atrLen = input.int(14, "Volatilite Periyodu")
mult = input.float(2.0, "Dinamik Bant Çarpanı")
mom = math.abs(close - close[kamaLen])
volatility = 0.0
for i = 0 to kamaLen - 1
volatility := volatility + math.abs(close[i] - close[i+1])
er = volatility != 0 ? mom / volatility : 0
fastAlpha = 2.0 / (2.0 + 1.0)
slowAlpha = 2.0 / (30.0 + 1.0)
sc = math.pow(er * (fastAlpha - slowAlpha) + slowAlpha, 2)
var float kama = close
kama := kama + sc * (close - kama)
atrValue = ta.atr(atrLen)
upperBand = kama + (atrValue * mult)
lowerBand = kama - (atrValue * mult)
var int trendStatus = 0
buySignal = ta.crossover(close, upperBand) and trendStatus != 1
sellSignal = ta.crossunder(close, lowerBand) and trendStatus != -1
if buySignal
trendStatus := 1
else if sellSignal
trendStatus := -1
plot(kama, "Trend Çizgisi", color=color.new(color.gray, 50), linewidth=2)
u = plot(upperBand, "Üst Sınır", color=color.new(color.teal, 85))
l = plot(lowerBand, "Alt Sınır", color=color.new(color.maroon, 85))
fill(u, l, color=trendStatus == 1 ? color.new(color.green, 92) : color.new(color.red, 92))
plotshape(buySignal, "AL", shape.labelup, location=location.belowbar, color=color.green, text="AL", textcolor=color.white, size=size.normal)
plotshape(sellSignal, "SAT", shape.labeldown, location=location.abovebar, color=color.red, text="SAT", textcolor=color.white, size=size.normal)
bgcolor(trendStatus == 1 ? color.new(color.green, 97) : trendStatus == -1 ? color.new(color.red, 97) : na)
alertcondition(buySignal, title="AL Sinyali", message="Alpha-Pulse: AL Trendi Başladı!")
alertcondition(sellSignal, title="SAT Sinyali", message="Alpha-Pulse: SAT Trendi Başladı!")