https://tr.tradingview.com/script/vi...abres-LuxAlgo/
sadeleme...
PHP Code:
//@version=5
indicator("MA Sabres Basit v5", overlay=true)
// === MA Ayarları ===
maType = input.string("TEMA", "MA Tipi", options=["SMA","EMA","WMA","TEMA"])
length = input.int(50, "MA Uzunluğu")
count = input.int(20, "Trend Süre (Bar)")
atrLen = input.int(14, "ATR Süresi")
mult = input.float(1.5, "Sabre ATR Çarpanı")
maFn(x, len) =>
switch maType
"SMA" => ta.sma(x, len)
"EMA" => ta.ema(x, len)
"WMA" => ta.wma(x, len)
=> ta.ema(ta.ema(ta.ema(x, len), len), len) // TEMA
ma = maFn(close, length)
atr = ta.atr(atrLen)
isFalling = ta.falling(ma, count)
isRising = ta.rising(ma, count)
upTrend = isFalling[1] and ma > ma[1]
dnTrend = isRising[1] and ma < ma[1]
// Sabre çizimi için polyline
if upTrend or dnTrend
dir = upTrend ? 1 : -1
basePrice = dir == 1 ? low[1] : high[1]
startIdx = bar_index - 1
tipIdx = bar_index + length
tipPrice = basePrice + dir * atr * mult
pts = array.new<chart.point>()
array.push(pts, chart.point.from_index(startIdx, basePrice))
array.push(pts, chart.point.from_index(bar_index + length/2, basePrice + dir * atr * (mult/2)))
array.push(pts, chart.point.from_index(tipIdx, tipPrice))
polyline.new(pts, color = upTrend ? color.green : color.red, width = 2, style = line.style_curve, extend = extend.none)
// Trend onarımı için MA çizgisi
plot(ma, title="MA Trend", color=upTrend ? color.lime : dnTrend ? color.red : color.gray, linewidth=2)
// Sinyal şekli
plotshape(upTrend, location=location.belowbar, style=shape.circle, color=color.green, size=size.small)
plotshape(dnTrend, location=location.abovebar, style=shape.circle, color=color.red, size=size.small)
PHP Code:
//@version=4
study("MA Sabres v4 + BGColor", overlay=true)
// === Ayarlar ===
maLength = input(50, title="SMA Uzunluğu")
atrLength = input(14, title="ATR Periyodu")
mult = input(1.5, title="ATR Çarpanı")
// === Göstergeler ===
ma = sma(close, maLength)
atrVal = atr(atrLength)
// === Trend yönü kontrolü
maSlope = ma - ma[1]
upTrend = maSlope > 0 and maSlope[1] <= 0
dnTrend = maSlope < 0 and maSlope[1] >= 0
isUp = maSlope > 0
isDown = maSlope < 0
// === MA çizgisi
plot(ma, title="SMA", color=color.gray, linewidth=2)
// === Sabre işaretleme
plotshape(upTrend, title="Yukarı Sabre", location=location.belowbar, style=shape.triangleup,
color=color.lime, size=size.small, offset=-1)
plotshape(dnTrend, title="Aşağı Sabre", location=location.abovebar, style=shape.triangledown,
color=color.red, size=size.small, offset=-1)
// === Sabre hedef çizgileri (opsiyon
https://www.tradingview.com/x/aIJllXGF/
Yer İmleri