如何为自定义绘制的线条添加文本标签?
为Pine Script折线图添加标签失败的问题
我正尝试为绘制的折线图添加标签,但始终无法实现。以下是我目前的代码:
if PSILastDOt line1 = line.new(x1=bar_index[1], y1=close, x2=bar_index, y2=close, extend = extend.both, style = line.style_solid, color = color_change, width = 2) label1 = label.new(bar_index + 5, close, str.tostring(close), xloc.bar_index, yloc.price, color.rgb(255, 255, 255, 100), label.style_label_up, color.white) line.delete(line1[CC])
运行后标签无法正常显示,且尝试直接用自定义线条line1作为label.new的y参数时,会报错:
Cannot call 'label.new' with argument 'y'='line1'. An argument of 'series line' type was used but a 'series float' is expected.
我还试过用plotshape实现标签,没有效果;另外尝试过vitruvius的解决方案,同样无效。
内容的提问来源于stack exchange,提问作者Dj Donnie
相关产品推荐
相关产品推荐

