PlotShape - {{price}} - PineScript - V5
PlotShape - {{price}} - PineScript - V5
我写了一个追踪止损脚本。我希望代码显示触及止损的价格。
但它将 {{Price}} 显示为字符串,而不是触及止损的柱的实际编号。
有人知道如何解决这个问题吗?
您不能使用 plotshape()
函数来做到这一点。它需要一个 const string
,这意味着该值必须在编译时已知。
您可以使用 label
。
示例来自 here。它将绘制柱线指数和最高价。
//@version=4
study("My Script", overlay=true)
label.new(bar_index, high, style=label.style_none,
text="x=" + tostring(bar_index) + "\ny=" + tostring(high))
我写了一个追踪止损脚本。我希望代码显示触及止损的价格。
但它将 {{Price}} 显示为字符串,而不是触及止损的柱的实际编号。
有人知道如何解决这个问题吗?
您不能使用 plotshape()
函数来做到这一点。它需要一个 const string
,这意味着该值必须在编译时已知。
您可以使用 label
。
示例来自 here。它将绘制柱线指数和最高价。
//@version=4
study("My Script", overlay=true)
label.new(bar_index, high, style=label.style_none,
text="x=" + tostring(bar_index) + "\ny=" + tostring(high))