Untitled
unknown
plain_text
9 months ago
7.8 kB
8
Indexable
//@version=5
indicator("1", overlay=true)
// Hisse Sembollerini, Giriş/Çıkış Fiyatlarını ve Alış Tarihlerini Belirleyin
hisse_1_symbol = input.string("", "Hisse 1")
hisse_1_giris = input.float(0, "Giriş Fiyatı")
hisse_1_cikis = input.float(0, "Çıkış Fiyatı")
hisse_1_alistarihi = input.time(timestamp("2025-01-01 00:00:00"), "Alış Tarihi")
hisse_2_symbol = input.string("", "Hisse 2")
hisse_2_giris = input.float(0, "Giriş Fiyatı")
hisse_2_cikis = input.float(0, "Çıkış Fiyatı")
hisse_2_alistarihi = input.time(timestamp("2025-01-01 00:00:00"), "Alış Tarihi")
hisse_3_symbol = input.string("", "Hisse 3")
hisse_3_giris = input.float(0, "Giriş Fiyatı")
hisse_3_cikis = input.float(0, "Çıkış Fiyatı")
hisse_3_alistarihi = input.time(timestamp("2025-01-01 00:00:00"), "Alış Tarihi")
// Her bir hissenin anlık fiyatını al
hisse_1_guncel = request.security(hisse_1_symbol, "1D", close)
hisse_2_guncel = request.security(hisse_2_symbol, "1D", close)
hisse_3_guncel = request.security(hisse_3_symbol, "1D", close)
// Geçen günleri hesapla ve formatla
hisse_1_gecengun = math.floor((timenow - hisse_1_alistarihi) / (24 * 60 * 60 * 1000))
hisse_2_gecengun = math.floor((timenow - hisse_2_alistarihi) / (24 * 60 * 60 * 1000))
hisse_3_gecengun = math.floor((timenow - hisse_3_alistarihi) / (24 * 60 * 60 * 1000))
hisse_1_gun_format = " " + str.tostring(hisse_1_gecengun + 1)
hisse_2_gun_format = "Gün " + str.tostring(hisse_2_gecengun + 1)
hisse_3_gun_format = "Gün " + str.tostring(hisse_3_gecengun + 1)
// Tüm hisse fiyatlarını kontrol et
alarm_triggered = (hisse_1_guncel >= hisse_1_cikis or hisse_1_guncel <= hisse_1_giris) or
(hisse_2_guncel >= hisse_2_cikis or hisse_2_guncel <= hisse_2_giris) or
(hisse_3_guncel >= hisse_3_cikis or hisse_3_guncel <= hisse_3_giris)
// Tek alarm oluştur
if alarm_triggered
alert("Hedef fiyatına ulaşıldı veya zarar durdur seviyesine ulaşıldı.", alert.freq_once_per_bar)
// Tablo Boyutu ve Stil Ayarları
var table nezTable = table.new(position.top_right, 7, 40, bgcolor = color.white, frame_width = 1, frame_color = color.black, border_color = color.black, border_width = 1)
// Başlık Satırını Ekleyelim
table.cell(nezTable, 0, 0, 'Hisse', text_color = #eeff00, bgcolor = #2e2d2d, text_size = size.normal, text_halign = text.align_center)
table.cell(nezTable, 1, 0, "Değer", text_color = #eeff00, bgcolor = #2e2d2d, text_size = size.normal, text_halign = text.align_center)
table.cell(nezTable, 2, 0, "Giriş", text_color = #eeff00, bgcolor = #2e2d2d, text_size = size.normal, text_halign = text.align_center)
table.cell(nezTable, 3, 0, "Çıkış", text_color = #eeff00, bgcolor = #2e2d2d, text_size = size.normal, text_halign = text.align_center)
table.cell(nezTable, 4, 0, "Durum", text_color = #eeff00, bgcolor = #2e2d2d, text_size = size.normal, text_halign = text.align_center)
table.cell(nezTable, 5, 0, "Alış Tarihi", text_color = #eeff00, bgcolor = #2e2d2d, text_size = size.normal, text_halign = text.align_center)
table.cell(nezTable, 6, 0, "Gün", text_color = #eeff00, bgcolor = #2e2d2d, text_size = size.normal, text_halign = text.align_center)
// Hisse 1
durum_1 = if hisse_1_guncel <= hisse_1_giris
"AL"
else
if hisse_1_guncel >= hisse_1_cikis
"SAT"
else
"Bekle"
bgcolor_1_giris = if durum_1 == "AL"
#0bff13f6
else
na
bgcolor_1_cikis = if durum_1 == "SAT"
#f80505
else
na
bgcolor_1_durum = if durum_1 == "AL"
#03ff0bf5
else
if durum_1 == "SAT"
#ff5252fc
else
color.white
table.cell(nezTable, 0, 1, hisse_1_symbol, text_color = color.black, bgcolor = color.white, text_size = size.small, text_halign = text.align_left)
table.cell(nezTable, 1, 1, str.tostring(hisse_1_guncel), text_color = color.black, bgcolor = color.white, text_size = size.small, text_halign = text.align_left)
table.cell(nezTable, 2, 1, str.tostring(hisse_1_giris), text_color = color.black, bgcolor = bgcolor_1_giris, text_size = size.small, text_halign = text.align_left)
table.cell(nezTable, 3, 1, str.tostring(hisse_1_cikis), text_color = color.black, bgcolor = bgcolor_1_cikis, text_size = size.small, text_halign = text.align_left)
table.cell(nezTable, 4, 1, durum_1, text_color = color.black, bgcolor = bgcolor_1_durum, text_size = size.small, text_halign = text.align_left)
table.cell(nezTable, 5, 1, str.format("{0, date, yyyy-MM-dd}", hisse_1_alistarihi), text_color = color.black, bgcolor = color.white, text_size = size.small, text_halign = text.align_left)
table.cell(nezTable, 6, 1, hisse_1_gun_format, text_color = color.black, bgcolor = color.white, text_size = size.small, text_halign = text.align_left)
// Hisse 2
durum_2 = if hisse_2_guncel <= hisse_2_giris
"AL"
else
if hisse_2_guncel >= hisse_2_cikis
"SAT"
else
"Bekle"
bgcolor_2_giris = if durum_2 == "AL"
#04f10cfa
else
na
bgcolor_2_cikis = if durum_2 == "SAT"
#ff0000
else
na
bgcolor_2_durum = if durum_2 == "AL"
#04fd0cf7
else
if durum_2 == "SAT"
#fe0000
else
color.white
table.cell(nezTable, 0, 2, hisse_2_symbol, text_color = color.black, bgcolor = color.white, text_size = size.small, text_halign = text.align_left)
table.cell(nezTable, 1, 2, str.tostring(hisse_2_guncel), text_color = color.black, bgcolor = color.white, text_size = size.small, text_halign = text.align_left)
table.cell(nezTable, 2, 2, str.tostring(hisse_2_giris), text_color = color.black, bgcolor = bgcolor_2_giris, text_size = size.small, text_halign = text.align_left)
table.cell(nezTable, 3, 2, str.tostring(hisse_2_cikis), text_color = color.black, bgcolor = bgcolor_2_cikis, text_size = size.small, text_halign = text.align_left)
table.cell(nezTable, 4, 2, durum_2, text_color = color.black, bgcolor = bgcolor_2_durum, text_size = size.small, text_halign = text.align_left)
table.cell(nezTable, 5, 2, str.format("{0, date, yyyy-MM-dd}", hisse_2_alistarihi), text_color = color.black, bgcolor = color.white, text_size = size.small, text_halign = text.align_left)
table.cell(nezTable, 6, 2, hisse_2_gun_format, text_color = color.black, bgcolor = color.white, text_size = size.small, text_halign = text.align_left)
// Hisse 3
durum_3 = if hisse_3_guncel <= hisse_3_giris
"AL"
else
if hisse_3_guncel >= hisse_3_cikis
"SAT"
else
"Bekle"
bgcolor_3_giris = if durum_3 == "AL"
#04f10cfa
else
na
bgcolor_3_cikis = if durum_3 == "SAT"
#ff0000
else
na
bgcolor_3_durum = if durum_3 == "AL"
#04fd0cf7
else
if durum_3 == "SAT"
#fe0000
else
color.white
table.cell(nezTable, 0, 3, hisse_3_symbol, text_color = color.black, bgcolor = color.white, text_size = size.small, text_halign = text.align_left)
table.cell(nezTable, 1, 3, str.tostring(hisse_3_guncel), text_color = color.black, bgcolor = color.white, text_size = size.small, text_halign = text.align_left)
table.cell(nezTable, 2, 3, str.tostring(hisse_3_giris), text_color = color.black, bgcolor = bgcolor_3_giris, text_size = size.small, text_halign = text.align_left)
table.cell(nezTable, 3, 3, str.tostring(hisse_3_cikis), text_color = color.black, bgcolor = bgcolor_3_cikis, text_size = size.small, text_halign = text.align_left)
table.cell(nezTable, 4, 3, durum_3, text_color = color.black, bgcolor = bgcolor_3_durum, text_size = size.small, text_halign = text.align_left)
table.cell(nezTable, 5, 3, str.format("{0, date, yyyy-MM-dd}", hisse_3_alistarihi), text_color = color.black, bgcolor = color.white, text_size = size.small, text_halign = text.align_left)
table.cell(nezTable, 6, 3, hisse_3_gun_format, text_color = color.black, bgcolor = color.white, text_size = size.small, text_halign = text.align_left)Editor is loading...
Leave a Comment