Untitled

 avatar
unknown
plain_text
2 months ago
3.6 kB
45
Indexable
//@version=6
indicator(title = 'Trend 18 XL', shorttitle = 'Trend 18 XL', overlay = true)

// Zaman Dilimleri
Group1 = 'SuperTrend Tablo '
times = array.new_string(18)
array.set(times, 0, input.timeframe('15', 'Zaman Dilimi - A', group = Group1))
array.set(times, 1, input.timeframe('30', 'Zaman Dilimi - B', group = Group1))
array.set(times, 2, input.timeframe('60', 'Zaman Dilimi - C', group = Group1))
array.set(times, 3, input.timeframe('120', 'Zaman Dilimi - D', group = Group1))
array.set(times, 4, input.timeframe('144', 'Zaman Dilimi - E', group = Group1))
array.set(times, 5, input.timeframe('170', 'Zaman Dilimi - F', group = Group1))
array.set(times, 6, input.timeframe('180', 'Zaman Dilimi - G', group = Group1))
array.set(times, 7, input.timeframe('240', 'Zaman Dilimi - H', group = Group1))
array.set(times, 8, input.timeframe('D', 'Zaman Dilimi - I', group = Group1))
array.set(times, 9, input.timeframe('2D', 'Zaman Dilimi - J', group = Group1))
array.set(times, 10, input.timeframe('3D', 'Zaman Dilimi - K', group = Group1))
array.set(times, 11, input.timeframe('4D', 'Zaman Dilimi - L', group = Group1))
array.set(times, 12, input.timeframe('5D', 'Zaman Dilimi - M', group = Group1))
array.set(times, 13, input.timeframe('W', 'Zaman Dilimi - N', group = Group1))
array.set(times, 14, input.timeframe('M', 'Zaman Dilimi - O', group = Group1))
array.set(times, 15, input.timeframe('3M', 'Zaman Dilimi - P', group = Group1))
array.set(times, 16, input.timeframe('6M', 'Zaman Dilimi - Q', group = Group1))
array.set(times, 17, input.timeframe('12M', 'Zaman Dilimi - R', group = Group1))

// Tablo Pozisyonu ve Stil Ayarları
TablePos = input.string('Sol Alt', 'Tablo Pozisyonu', ['Sağ Yukarı', 'Sağ Alt', 'Sol Yukarı', 'Sol Alt'], group = Group1)
TextSize1 = input.string('Küçük', 'Tablo Yazı Büyüklüğü', ['Normal', 'Küçük', 'Büyük'], group = Group1)
textSize = TextSize1 == 'Normal' ? size.normal : TextSize1 == 'Büyük' ? size.large : TextSize1 == 'Küçük' ? size.small : size.small
tabPos = TablePos == 'Sağ Yukarı' ? position.top_right : TablePos == 'Sol Alt' ? position.bottom_left : TablePos == 'Sol Yukarı' ? position.top_left : position.bottom_right

var SuperTrendTable = table.new(tabPos, 3, 18, bgcolor = color.new(color.black, 0)) // Dikey Tablo

// ATR ve Factor Ayarları
atrPeriod = input(18, 'ATR Uzunluğu')
factor = input.float(7.02, 'Factor', step = 0.01)

// Supertrend Hesaplama Fonksiyonu
calc_supertrend(atrPeriod, factor, timeframe) =>
    [supertrend, direction] = ta.supertrend(factor, atrPeriod)
    [supertrend, direction]

// Supertrend Durumu Fonksiyonu
supertrend_status(direction) =>
    direction < 0 ? 'Y' : 'D'

// Supertrend Renk Fonksiyonu
supertrend_color(direction) =>
    direction < 0 ? color.new(color.green, 15) : color.new(color.red, 15)

// Tabloya Verilerin Eklenmesi
for i = 0 to 17 
    [supertrend_value, supertrend_direction] = request.security(syminfo.tickerid, array.get(times, i), calc_supertrend(atrPeriod, factor, array.get(times, i)))
    trend_status = supertrend_status(supertrend_direction)
    trend_color = supertrend_color(supertrend_direction)
    
    table.cell(SuperTrendTable, 0, i, array.get(times, i), text_size = textSize, bgcolor = trend_color) // Zaman Dilimi
    table.cell(SuperTrendTable, 1, i, trend_status, text_size = textSize, bgcolor = trend_color) // Trend Durumu
    table.cell(SuperTrendTable, 2, i, str.tostring(supertrend_value, '#.##'), text_size = textSize, bgcolor = trend_color) // Fiyat
Leave a Comment