Untitled

 avatar
unknown
plain_text
a month ago
8.6 kB
6
Indexable
//@version=5
indicator("Custom Table with Multiple Timeframes and Indicators", overlay=true)

// EMA ve RSI hesaplamaları
ema34 = ta.ema(close, 34)
ema55 = ta.ema(close, 55)
rsi = ta.rsi(close, 14)

// MACD hesaplaması
[macdLine, signalLine, _] = ta.macd(close, 12, 26, 9)  // MACD, Signal Line ve Histogram'ı hesapla
macdValue = macdLine - signalLine  // MACD'nin değeri (MACD Line - Signal Line)

// Komp RSI ve Komp 233 hesaplamaları (örnek olarak)
komp233 = ta.ema(close, 233) // Örnek olarak EMA 233 kullanıldı
komp34 = ta.ema(close, 34)   // Örnek olarak EMA 34 kullanıldı
kompRSI = ta.rsi(close, 233) // Komp RSI, burada 233 periyotlu RSI kullanıldı

// Zaman dilimlerinden değerler
close15 = request.security(syminfo.ticker, "15", close)
close30 = request.security(syminfo.ticker, "30", close)
close1H = request.security(syminfo.ticker, "60", close)
close2H = request.security(syminfo.ticker, "120", close)
close4H = request.security(syminfo.ticker, "240", close)
closeD = request.security(syminfo.ticker, "D", close)
close3D = request.security(syminfo.ticker, "3D", close)
closeW = request.security(syminfo.ticker, "W", close)

// EMA, RSI, MACD değerlerini zaman dilimlerine göre alalım
ema34_15 = request.security(syminfo.ticker, "15", ta.ema(close, 34))
ema55_15 = request.security(syminfo.ticker, "15", ta.ema(close, 55))
rsi_15 = request.security(syminfo.ticker, "15", ta.rsi(close, 14))
macd_15 = request.security(syminfo.ticker, "15", macdValue)

ema34_30 = request.security(syminfo.ticker, "30", ta.ema(close, 34))
ema55_30 = request.security(syminfo.ticker, "30", ta.ema(close, 55))
rsi_30 = request.security(syminfo.ticker, "30", ta.rsi(close, 14))
macd_30 = request.security(syminfo.ticker, "30", macdValue)

ema34_1H = request.security(syminfo.ticker, "60", ta.ema(close, 34))
ema55_1H = request.security(syminfo.ticker, "60", ta.ema(close, 55))
rsi_1H = request.security(syminfo.ticker, "60", ta.rsi(close, 14))
macd_1H = request.security(syminfo.ticker, "60", macdValue)

ema34_2H = request.security(syminfo.ticker, "120", ta.ema(close, 34))
ema55_2H = request.security(syminfo.ticker, "120", ta.ema(close, 55))
rsi_2H = request.security(syminfo.ticker, "120", ta.rsi(close, 14))
macd_2H = request.security(syminfo.ticker, "120", macdValue)

ema34_4H = request.security(syminfo.ticker, "240", ta.ema(close, 34))
ema55_4H = request.security(syminfo.ticker, "240", ta.ema(close, 55))
rsi_4H = request.security(syminfo.ticker, "240", ta.rsi(close, 14))
macd_4H = request.security(syminfo.ticker, "240", macdValue)

ema34_D = request.security(syminfo.ticker, "D", ta.ema(close, 34))
ema55_D = request.security(syminfo.ticker, "D", ta.ema(close, 55))
rsi_D = request.security(syminfo.ticker, "D", ta.rsi(close, 14))
macd_D = request.security(syminfo.ticker, "D", macdValue)

ema34_3D = request.security(syminfo.ticker, "3D", ta.ema(close, 34))
ema55_3D = request.security(syminfo.ticker, "3D", ta.ema(close, 55))
rsi_3D = request.security(syminfo.ticker, "3D", ta.rsi(close, 14))
macd_3D = request.security(syminfo.ticker, "3D", macdValue)

ema34_W = request.security(syminfo.ticker, "W", ta.ema(close, 34))
ema55_W = request.security(syminfo.ticker, "W", ta.ema(close, 55))
rsi_W = request.security(syminfo.ticker, "W", ta.rsi(close, 14))
macd_W = request.security(syminfo.ticker, "W", macdValue)

// Renk belirleme
colorForRSI(rsiValue) =>
    rsiValue >= 50 ? color.green : color.red

colorForMACD(macdValue) =>
    macdValue >= 0 ? color.green : color.red

colorForEMA(close, emaValue) =>
    close >= emaValue ? color.green : color.red

// Tablo pozisyon ve stil ayarları
tablePosition = input.string('bottom_right', title = 'Table Position', options = ['top_right', 'top_left', 'bottom_right', 'bottom_left'], group="TABLE", inline="TBL")
fontSize = input.string('normal', title = 'Font Size', options = ['tiny', 'small', 'normal', 'large'], group="TABLE", inline="TBL")
tableBorderWth3 = input.int(1, title="Çerçeve Kalınlığı", minval=1, maxval=5, group="TABLE", inline="TBL")
frame_wth3 = input.int(2, title="Çerçeve Kalınlığı", minval=1, maxval=5, group="TABLE", inline="TBL")
frame_color3 = input.color(#000000, title="Çerçeve Rengi", group="TABLE", inline="TBLE")
tableBgColor3 = input.color(#000000, title="Arka Plan Rengi", group="TABLE", inline="TBLE")
tableBorderColor3 = input.color(#e2fa05, title="Çizgi Rengi", group="TABLE", inline="TBLE")

fontSizeMap = fontSize == 'normal' ? size.normal : fontSize == 'small' ? size.small : size.large
positionMap = tablePosition == 'bottom_right' ? position.bottom_right : tablePosition == 'top_left' ? position.top_left : position.bottom_left

var table tbl = table.new(positionMap, 9, 9, bgcolor=tableBgColor3, border_color=tableBorderColor3, border_width = tableBorderWth3, frame_color=frame_color3, frame_width=frame_wth3)

// Tablo başlıkları
if bar_index == 1
    table.cell(tbl, 0, 0, "TICKER ", text_color = color.orange, text_size = fontSizeMap)
    table.cell(tbl, 1, 0, "EMA 34", text_color = color.orange, text_size = fontSizeMap)
    table.cell(tbl, 2, 0, "EMA 55", text_color = color.orange, text_size = fontSizeMap)
    table.cell(tbl, 3, 0, "RSI", text_color = color.orange, text_size = fontSizeMap)
    table.cell(tbl, 4, 0, "Komp RSI", text_color = color.orange, text_size = fontSizeMap)
    table.cell(tbl, 5, 0, "MACD", text_color = color.orange, text_size = fontSizeMap)

// 15 Dakika
table.cell(tbl, 1, 1, str.tostring(close, '#.##'), text_color = close >= ema34_15 ? color.green : color.red, text_size = fontSizeMap)
table.cell(tbl, 2, 1, str.tostring(ema55_15, '#.##'),text_color = close >= ema55_15 ? color.green : color.red, text_size = fontSizeMap)
table.cell(tbl, 3, 1, str.tostring(rsi_15, '#.##'), text_color = colorForRSI(rsi_15), text_size = fontSizeMap)
table.cell(tbl, 4, 1, str.tostring(kompRSI, '#.##'), text_color = colorForRSI(kompRSI), text_size = fontSizeMap)
table.cell(tbl, 5, 1, str.tostring(macd_15, '#.##'), text_color = colorForMACD(macd_15), text_size = fontSizeMap)

// 30 Dakika
table.cell(tbl, 1, 2, str.tostring(ema34_30, '#.##'), text_color = colorForEMA(close30, ema34_30), text_size = fontSizeMap)
table.cell(tbl, 2, 2, str.tostring(ema55_30, '#.##'), text_color = colorForEMA(close30, ema55_30), text_size = fontSizeMap)
table.cell(tbl, 3, 2, str.tostring(rsi_30, '#.##'), text_color = colorForRSI(rsi_30), text_size = fontSizeMap)
table.cell(tbl, 4, 2, str.tostring(kompRSI, '#.##'), text_color = colorForRSI(kompRSI), text_size = fontSizeMap)
table.cell(tbl, 5, 2, str.tostring(macd_30, '#.##'), text_color = colorForMACD(macd_30), text_size = fontSizeMap)

// 1h Dakika
table.cell(tbl, 1, 3, str.tostring(ema34_1H, '#.##'), text_color = colorForEMA(close30, ema34_30), text_size = fontSizeMap)
table.cell(tbl, 2, 3, str.tostring(ema55_1H, '#.##'), text_color = colorForEMA(close30, ema55_30), text_size = fontSizeMap)
table.cell(tbl, 3, 3, str.tostring(rsi_1H, '#.##'), text_color = colorForRSI(rsi_30), text_size = fontSizeMap)
table.cell(tbl, 4, 3, str.tostring(kompRSI, '#.##'), text_color = colorForRSI(kompRSI), text_size = fontSizeMap)
table.cell(tbl, 5, 3, str.tostring(macd_1H, '#.##'), text_color = colorForMACD(macd_30), text_size = fontSizeMap)

// 2h Dakika
table.cell(tbl, 1, 4, str.tostring(ema34_2H, '#.##'), text_color = colorForEMA(close30, ema34_30), text_size = fontSizeMap)
table.cell(tbl, 2, 4, str.tostring(ema55_2H, '#.##'), text_color = colorForEMA(close30, ema55_30), text_size = fontSizeMap)
table.cell(tbl, 3, 4, str.tostring(rsi_2H, '#.##'), text_color = colorForRSI(rsi_30), text_size = fontSizeMap)
table.cell(tbl, 4, 4, str.tostring(kompRSI, '#.##'), text_color = colorForRSI(kompRSI), text_size = fontSizeMap)
table.cell(tbl, 5, 4, str.tostring(macd_2H, '#.##'), text_color = colorForMACD(macd_30), text_size = fontSizeMap)

// 4h Dakika
table.cell(tbl, 1, 2, str.tostring(ema34_4H, '#.##'), text_color = colorForEMA(close30, ema34_30), text_size = fontSizeMap)
table.cell(tbl, 2, 2, str.tostring(ema55_4H, '#.##'), text_color = colorForEMA(close30, ema55_30), text_size = fontSizeMap)
table.cell(tbl, 3, 2, str.tostring(rsi_4H, '#.##'), text_color = colorForRSI(rsi_30), text_size = fontSizeMap)
table.cell(tbl, 4, 2, str.tostring(kompRSI, '#.##'), text_color = colorForRSI(kompRSI), text_size = fontSizeMap)
table.cell(tbl, 5, 2, str.tostring(macd_4H, '#.##'), text_color = colorForMACD(macd_30), text_size = fontSizeMap)

Leave a Comment