如何在延伸的线上获得价值-TradingView Pine脚本 [英] How to get value at a point of line extended - TradingView Pine script
本文介绍了如何在延伸的线上获得价值-TradingView Pine脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用下面的代码画一条线:
Im using the code below to draw a line:
//@version=4
simplesma = sma(close, 14)
var line3 = line.new(bar_index[0], high[0], bar_index, low, extend = extend.right)
line.set_xy1(line3, bar_index[5], simplesma[5])
line.set_xy2(line3, bar_index[3], simplesma[3])
该线已使用历史记录中的2点绘制.
That line has been drawn using 2 points in the history.
然后我使用此代码绘制图
And then I use this code to draw a plot
price_point = line.get_price(line3,bar_index)
plot(price_point, title='Price', color=#ffcc00, transp=30)
我正在尝试在标签上显示值,但是以下代码不起作用:
Im trying to display the value on a label but the following code does not work:
var label3 = label.new(bar_index, high, text = "Value: "+ tostring(price_point, "#.########"), style = label.style_label_lower_left, color=#ffcc00, textcolor=#ff0000)
label.set_xy(label3,bar_index, price_point)
您能帮我在标签上显示吗?
Can you please help me to show it on label ?
推荐答案
变量 price_point
是当前柱线(bar_index)上的值.您不需要使用函数 tostring()
.
The variable price_point
is the value at the current bar (bar_index). You don't need to use the function tostring()
.
这篇关于如何在延伸的线上获得价值-TradingView Pine脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文