Pinescript。计算每天的柱数

问题描述 投票:0回答:1

//@版本=5 指示器(“Ebanina”,覆盖= true)

barscum = ta.barssince(ta.change(时间(“D”))) + 1 var table ebanina = table.new(position.bottom_center, 4, 5) table.cell(ebanina, 2, 0, str.tostring(barscum), text_color = color.rgb(0, 0, 0), text_halign = text.align_right)

我正在尝试在不同的工具上显示每天的柱数。一切都很好,除了加密货币。在加密货币上,价值是动态的,并且随着每个柱的变化而变化。而且我找不到解决方法。

pine-script trading tradingview-api
1个回答
0
投票
I came only to this decision. Once a year, you need to rewrite the date. 
Maybe I'll find an answer by then.



//@version=5
indicator("Ebanina", overlay=true)
openses = timestamp("10 Aug 2023 00:00")      
closeses   = timestamp("11 Aug 2023 00:00") 
timeses(tm) =>
    var int _bar = na 
    if time_close[1] <= tm and time >= tm
        _bar := bar_index
    _bar   
beginning   = timeses(openses)
end  = timeses(closeses)
muchbars  = end - beginning
var table ebanina = table.new(position.bottom_center, 4, 5)
table.cell(ebanina, 2, 0, str.tostring(muchbars), text_color = color.rgb(0, 0, 0), text_halign = text.align_right)
© www.soinside.com 2019 - 2024. All rights reserved.