我正在尝试访问TradingView上最高和最低的价格表值。我不认为这是可能的,但也许有一个比我更聪明的人谁有解决办法。
我已经看过松树脚本v5引用,看不到任何访问价格规模数据的可用方法。如果您深入了解页面的javascript,那么我认为一些函数可能会显示数据,但是我认为这些函数在文件之外是不可用的。
发布于 2022-10-29 20:54:52
无法直接获得比例值。但是,可以使用chart.left_visible_bar_time
和chart.right_visible_bar_time
获得可见的最高/最低图表值。
您应该注意,在脚本的执行到达可见范围内的最后栏之前,无法确认这些值。即使在历史条形图上迭代时,松树也禁止引用前向数据。
https://www.tradingview.com/pine-script-docs/en/v5/language/Execution_model.html
https://www.tradingview.com/pine-script-docs/en/v5/language/Time_series.html
//@version=5
indicator("visible high/low", overlay = true)
start_time = chart.left_visible_bar_time
end_time = chart.right_visible_bar_time
in_visible_range = time >= start_time and time <= end_time
var float hh = na
var float ll = na
if in_visible_range
if na(hh)
hh := high
ll := low
else
hh := math.max(hh, high)
ll := math.min(ll, low)
if time == end_time
label.new(x = bar_index, y = high, text = "High : " + str.tostring(hh) + "\nLow : " + str.tostring(ll), style = label.style_label_lower_right)
line.new(x1 = bar_index - 1, y1 = hh, x2 = bar_index, y2 = hh, extend = extend.both)
line.new(x1 = bar_index - 1, y1 = ll, x2 = bar_index, y2 = ll, extend = extend.both)```
https://stackoverflow.com/questions/74247041
复制相似问题