如何在 plot 函数中使用交替文本字符串

How to use alternating text strings in plot function

在我的绘图函数中尝试使用此 "text=" 时:

plotshape(someLow,title="low", style=shape.diamond, location=location.belowbar, offset=0, text=(lowerLow ? "LL" : "HL"), color=color.green, transp=0)

...我收到错误:

line 77: Cannot call 'plotshape' with arguments (..., text=series[string], ...)

... 因为文本必须是 "const string" 而不是 "series[string]"

那么如何绘制交替文本(不重复整个绘图功能线)?

您可以使用label.newPine Script Language Reference Manual

中寻找

试试这个:

l = label.new(bar_index, close,
     text= someLow ? "LL" : "HL")
label.delete(not lowerLow ? l: na)