Untitled
unknown
plain_text
9 months ago
3.7 kB
10
Indexable
////////////////////////////////////////////////
///////hacim tablosu//////
// Kullanıcıdan sembol girişleri
// Tabloyu göster/gizle düğmesi
string s00 = syminfo.tickerid // Mevcut grafikteki sembol kullanılır
frame_color1 = input.color(#000000, title="Çerçeve Rengi",group = "HACİM TABLOSU AYARLARI")
frame_width1 = input.int(4, title="Çerçeve Kalınlığı", minval=1, maxval=5)
// Parametreler
lookbackPeriod = input.int(20, title="Geriye Dönük Mum Sayısı")
// Tablo konumu için kullanıcı girişi
tablePosition1 = input.string("top_center", title="Tablo Konumu", options=["top_left", "top_center", "top_right", "bottom_left", "bottom_center", "bottom_right"])
// Tablo boyutu için kullanıcı girişi
tableSize3 = input.string("tiny", title="Tablo Boyutu", options=["tiny", "small", "normal", "large"])
// Tablo stil ayarları için kullanıcı girişleri
tableBgColor1 = input.color(color.rgb(42, 46, 57), title="Tablo Arka Plan Rengi")
tableBorderColor1 = input.color(#000000, title="Tablo Çerçeve Rengi")
tableBorderWidth1 = input.int(1, title="Tablo Çerçeve Kalınlığı", minval=1, maxval=5)
// Renk seçenekleri için kullanıcı girişleri
headerColor = input.color(#000000, title="Başlık Arka Plan Rengi")
buyColor = input.color(#17a91c, title="Alış Hacmi Rengi")
sellColor = input.color(#d30a0a, title="Satış Hacmi Rengi")
resultBuyColor = input.color(#17a91c, title="Sonuç Alış Rengi")
resultSellColor = input.color(#d30a0a, title="Sonuç Satış Rengi")
textColor3 = input.color(color.white, title="Metin Rengi")
calculateVolumes(closeData, volumeData) =>
float upVolumeSum = 0.0
float downVolumeSum = 0.0
for i = 0 to lookbackPeriod - 1
upVolumeSum += (closeData[i] > closeData[i + 1] ? volumeData[i] : 0)
downVolumeSum += (closeData[i] < closeData[i + 1] ? volumeData[i] : 0)
totalVolume = upVolumeSum + downVolumeSum
result = upVolumeSum > downVolumeSum ? "Pozitif" : "Negatif"
[upVolumeSum, downVolumeSum, result]
// Mevcut sembol için hacim hesaplaması
[up1, down1, res1] = calculateVolumes(close, volume)
// Tablo oluştur
var table volumeTable = na
if showTable1
if na(volumeTable)
volumeTable := table.new(position=tablePosition1, columns=4, rows=2, bgcolor=tableBgColor1, border_color=tableBorderColor1, border_width=tableBorderWidth1, frame_color=frame_color1, frame_width=frame_width1)
// Başlık satırı
if bar_index == 0
table.cell(volumeTable, 0, 0, "Hacim Analizi", bgcolor=headerColor, text_color=textColor, text_size=getFontSize(tableSize3))
table.cell(volumeTable, 1, 0, "Alış Hacmi", bgcolor=headerColor, text_color=textColor, text_size=getFontSize(tableSize3))
table.cell(volumeTable, 2, 0, "Satış Hacmi", bgcolor=headerColor, text_color=textColor, text_size=getFontSize(tableSize3))
table.cell(volumeTable, 3, 0, "Sonuç", bgcolor=headerColor, text_color=textColor, text_size=getFontSize(tableSize3))
// Mevcut sembol verilerini tabloya ekle
table.cell(volumeTable, 0, 1, s00, text_color=textColor, text_size=getFontSize(tableSize3))
table.cell(volumeTable, 1, 1, str.tostring(up1, format.volume), bgcolor=buyColor, text_color=textColor, text_size=getFontSize(tableSize3))
table.cell(volumeTable, 2, 1, str.tostring(down1, format.volume), bgcolor=sellColor, text_color=textColor, text_size=getFontSize(tableSize3))
table.cell(volumeTable, 3, 1, res1, bgcolor=res1 == "Pozitif" ? resultBuyColor : resultSellColor, text_color=textColor, text_size=getFontSize(tableSize3))
else
if not na(volumeTable)
table.delete(volumeTable)
volumeTable := na
Editor is loading...
Leave a Comment