Untitled

 avatar
unknown
plain_text
8 days ago
6.8 kB
5
Indexable
//@version=5
indicator("Al/Sat MTF Tablo", overlay=true, max_lines_count=500)

// === Ayarlar
TF1 = input.timeframe("1", title="1m")
TF2 = input.timeframe("3", title="3m")
TF3 = input.timeframe("5", title="5m")
TF4 = input.timeframe("15", title="15m")
TF5 = input.timeframe("45", title="45m")
TF6 = input.timeframe("60", title="1h")
TF7 = input.timeframe("240", title="4h")
TF8 = input.timeframe("D", title="1d")
TF9 = input.timeframe("W", title="1w")
TF10 = input.timeframe("M", title="1M")
TF11 = input.timeframe("3M", title="3M")
TF12 = input.timeframe("6M", title="6M")
TF13 = input.timeframe("12M", title="12M")

transparency = 10

// === Fonksiyon: her timeframe için hesaplama
getCounts() =>
    var int highCount1 = 1
    var float lastHigh1 = high
    if high < lastHigh1
        highCount1 += 1
        lastHigh1 := high
    else
        highCount1 := 1
        lastHigh1 := high

    var int lowCount1 = 1
    var float lastLow1 = low
    if low > lastLow1
        lowCount1 += 1
        lastLow1 := low
    else
        lowCount1 := 1
        lastLow1 := low

    var int riseCount = 1
    var float lastHigh = high
    if high > lastHigh
        riseCount += 1
        lastHigh := high
    else
        riseCount := 1
        lastHigh := high

    var int fallCount = 1
    var float lastLow = low
    if low < lastLow
        fallCount += 1
        lastLow := low
    else
        fallCount := 1
        lastLow := low

    [highCount1, lowCount1, riseCount, fallCount]

// === Mevcut Zaman Dilimi için Counts (Plot için)
[hCurrent, lCurrent, rCurrent, fCurrent] = getCounts()

// === Plot Sinyalleri (Aktif Timeframe İçin)
plotshape(hCurrent == 3, style=shape.triangleup, color=color.green, text="3", location=location.belowbar)
plotshape(hCurrent == 6, style=shape.triangleup, color=color.green, text="6", location=location.belowbar)
plotshape(hCurrent == 7, style=shape.triangleup, color=color.green, text="7", location=location.belowbar)
plotshape(hCurrent == 8, style=shape.triangleup, color=color.green, text="8", location=location.belowbar)
plotshape(hCurrent == 9, style=shape.triangleup, color=color.green, text="9", location=location.belowbar)

plotshape(lCurrent == 3, style=shape.triangledown, color=color.red, text="3", location=location.abovebar)
plotshape(lCurrent == 6, style=shape.triangledown, color=color.red, text="6", location=location.abovebar)
plotshape(lCurrent == 7, style=shape.triangledown, color=color.red, text="7", location=location.abovebar)
plotshape(lCurrent == 8, style=shape.triangledown, color=color.red, text="8", location=location.abovebar)
plotshape(lCurrent == 9, style=shape.triangledown, color=color.red, text="9", location=location.abovebar)

plotshape(rCurrent == 3, style=shape.circle, color=color.blue, text="3", location=location.abovebar)
plotshape(rCurrent == 6, style=shape.circle, color=color.blue, text="6", location=location.abovebar)
plotshape(rCurrent == 7, style=shape.circle, color=color.blue, text="7", location=location.abovebar)
plotshape(rCurrent == 8, style=shape.circle, color=color.blue, text="8", location=location.abovebar)
plotshape(rCurrent == 9, style=shape.circle, color=color.blue, text="9", location=location.abovebar)

plotshape(fCurrent == 3, style=shape.circle, color=color.orange, text="3", location=location.belowbar)
plotshape(fCurrent == 6, style=shape.circle, color=color.orange, text="6", location=location.belowbar)
plotshape(fCurrent == 7, style=shape.circle, color=color.orange, text="7", location=location.belowbar)
plotshape(fCurrent == 8, style=shape.circle, color=color.orange, text="8", location=location.belowbar)
plotshape(fCurrent == 9, style=shape.circle, color=color.orange, text="9", location=location.belowbar)

// === MTF Değerleri Çek
[h1, l1, r1, f1] = request.security(syminfo.tickerid, TF1, getCounts())
[h2, l2, r2, f2] = request.security(syminfo.tickerid, TF2, getCounts())
[h3, l3, r3, f3] = request.security(syminfo.tickerid, TF3, getCounts())
[h4, l4, r4, f4] = request.security(syminfo.tickerid, TF4, getCounts())
[h5, l5, r5, f5] = request.security(syminfo.tickerid, TF5, getCounts())
[h6, l6, r6, f6] = request.security(syminfo.tickerid, TF6, getCounts())
[h7, l7, r7, f7] = request.security(syminfo.tickerid, TF7, getCounts())
[h8, l8, r8, f8] = request.security(syminfo.tickerid, TF8, getCounts())
[h9, l9, r9, f9] = request.security(syminfo.tickerid, TF9, getCounts())
[h10, l10, r10, f10] = request.security(syminfo.tickerid, TF10, getCounts())
[h11, l11, r11, f11] = request.security(syminfo.tickerid, TF11, getCounts())
[h12, l12, r12, f12] = request.security(syminfo.tickerid, TF12, getCounts())
[h13, l13, r13, f13] = request.security(syminfo.tickerid, TF13, getCounts())


// === TABLO
// === Renkli tablo hücreleri için yardımcı fonksiyon
// === Renkli tablo hücreleri için yardımcı fonksiyon
getCellColor(val, isBuy) =>
    val >= 3 ? color.new(isBuy ? color.green : color.red, transparency) : color.new(color.gray, 80)

// === TABLO
var table t = table.new(position.top_right, 15, 15, border_width=1)

if bar_index == 0
    table.cell(t, 0, 0, "TF", bgcolor=color.gray, text_color=color.white)
    table.cell(t, 1, 0, "Al ", bgcolor=color.new(color.green, transparency), text_color=color.white)
    table.cell(t, 2, 0, "Al ", bgcolor=color.new(color.green, transparency), text_color=color.white)
    table.cell(t, 3, 0, "Sat ", bgcolor=color.new(color.red, transparency), text_color=color.white)
    table.cell(t, 4, 0, "Sat ", bgcolor=color.new(color.red, transparency), text_color=color.white)

// === Tablodaki her satır için hücreleri renkli yerleştiriyoruz
f_drawRow(tf, rowIndex, h, f, l, r) =>
    table.cell(t, 0, rowIndex, tf, text_color=color.white)
    table.cell(t, 1, rowIndex, str.tostring(f), bgcolor=getCellColor(h, true), text_color=color.white)
    table.cell(t, 2, rowIndex, str.tostring(h), bgcolor=getCellColor(f, true), text_color=color.white)
    table.cell(t, 3, rowIndex, str.tostring(r), bgcolor=getCellColor(l, false), text_color=color.white)
    table.cell(t, 4, rowIndex, str.tostring(l), bgcolor=getCellColor(r, false), text_color=color.white)

// === Satırları yerleştir
f_drawRow(TF1, 1, h1, f1, l1, r1)
f_drawRow(TF2, 2, h2, f2, l2, r2)
f_drawRow(TF3, 3, h3, f3, l3, r3)
f_drawRow(TF4, 4, h4, f4, l4, r4)
f_drawRow(TF5, 5, h5, f5, l5, r5)
f_drawRow(TF6, 6, h6, f6, l6, r6)
f_drawRow(TF7, 7, h7, f7, l7, r7)
f_drawRow(TF8, 8, h8, f8, l8, r8)
f_drawRow(TF9, 9, h9, f9, l9, r9)
f_drawRow(TF10, 10, h10, f10, l10, r10)
f_drawRow(TF11, 11, h11, f11, l11, r11)
f_drawRow(TF12, 12, h12, f12, l12, r12)
f_drawRow(TF13, 13, h13, f13, l13, r13)

Editor is loading...
Leave a Comment