Untitled

 avatar
unknown
plain_text
a month ago
2.5 kB
5
Indexable

//@version=5
indicator("1/1 Gann Level", overlay=true, max_bars_back=400)

// Kullanıcı girişleri (Görseldeki ayarlara göre)
showLevel = input.bool(true, title="1/1 Seviyesi")
lineColor = input.color(color.yellow, title="Renk", inline="lineSettings")
lineWidth = input.int(2, title="", minval=1, maxval=5, inline="lineSettings")
lineStyle = input.string("Düz Çizgi", options=["Düz Çizgi", "Kesikli Çizgi"], title="", inline="lineSettings")

showIntersection = input.bool(true, title="1/1 Kesişimi")
labelColor = input.color(color.yellow, title="Renk", inline="labelSettings")
labelPosition = input.string("Bar altı", options=["Bar altı"], title="", inline="labelSettings")

// Çizgi stili seçimi
lineStyleOption = lineStyle == "Düz Çizgi" ? line.style_solid : line.style_dotted

// Pivot periyodu
pivotPeriod = input.int(144, title="Pivot Periyodu", minval=1)

// En düşük ve en yüksek fiyat hesaplaması (Mevcut 1/1 Seviyesi)
lowestLow = ta.lowest(low, pivotPeriod)
highestHigh = ta.highest(high, pivotPeriod)
gannLevel = (lowestLow + highestHigh) / 2

// 144 periyotluk Gann seviyesi hesaplaması
lowestLow144 = ta.lowest(low, 144)
highestHigh144 = ta.highest(high, 144)
gann144Level = (lowestLow144 + highestHigh144) / 2

// Önceki çizgiyi silme
var line gannLine = na
var line gann144Line = na

if not na(gannLine)
    line.delete(gannLine)
if not na(gann144Line)
    line.delete(gann144Line)

// Yeni çizgiyi oluşturma (Mevcut 1/1 Seviyesi)
if showLevel
    gannLine := line.new(x1=bar_index - pivotPeriod, y1=gannLevel, x2=bar_index, y2=gannLevel, extend=extend.right, color=lineColor, width=lineWidth, style=lineStyleOption)

// Yeni çizgiyi oluşturma (144 Periyot Gann Seviyesi)
if showLevel
    gann144Line := line.new(x1=bar_index - 144, y1=gann144Level, x2=bar_index, y2=gann144Level, extend=extend.right, color=lineColor, width=lineWidth, style=lineStyleOption)

// Sadece çizgiyi yukarı kesen mumlarda etiket oluşturma (Mevcut 1/1 Seviyesi)
if showIntersection and close > gannLevel and close[1] <= gannLevel[1]
    label.new(x=bar_index, y=low, text="1/1", color=labelColor, textcolor=color.black, style=label.style_label_up, size=size.small)

// Sadece çizgiyi yukarı kesen mumlarda etiket oluşturma (144 Periyot Gann Seviyesi)
if showIntersection and close > gann144Level and close[1] <= gann144Level[1]
    label.new(x=bar_index, y=low, text="1/1", color=labelColor, textcolor=color.black, style=label.style_label_up, size=size.small)
Leave a Comment