【问题标题】:Pine V5 type issues : Display RSI value on tradingview chartPine V5 类型问题:在交易视图图表上显示 RSI 值
【发布时间】:2022-01-11 08:52:47
【问题描述】:

我正在尝试在交易视图中的每个柱上方显示 RSI 值。 我无法这样做,因为无论我尝试什么,都会收到以下错误。

不能使用参数 'text'='vt_rsi_str' 调用 'plotshape'。使用了“系列字符串”类型的参数,但应使用“常量字符串”

我显然是在解决这个问题,但我觉得显示 RSI 值应该是可能的,不是吗?

我尝试过的最新掌握的稻草语法如下。 任何建议将不胜感激!

vt_rsi = ta.rsi(close,14)
vt_rsi_str = str.format("{0,number,#}", str.tostring(vt_rsi[0]))
plotshape(vt_rsi_up, style=shape.arrowup, color=#1848cc, title="RSI Up", location=location.top, text=vt_rsi_str)

【问题讨论】:

    标签: pine-script pinescript-v5


    【解决方案1】:

    plot() 函数不支持此功能。详情请看我的回答here

    但是,您可以改用labels。

    //@version=5
    indicator("My Script", overlay=true)
    vt_rsi = ta.rsi(close,14)
    vt_rsi_str = str.format("{0,number,#.##}", vt_rsi)
    label1 = label.new(bar_index, high, text=vt_rsi_str, style=label.style_triangledown, size=size.tiny, color=#1848cc, textcolor=#1848cc)
    label.set_xloc(label1, time, xloc.bar_time)
    label.set_y(label1, high)
    label.set_text(label1, vt_rsi_str)
    

    【讨论】:

    • 谢谢,这很有帮助。我希望我能像使用绘图形状一样让标签穿过屏幕顶部。 :(
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-03
    • 1970-01-01
    • 2021-11-29
    • 1970-01-01
    相关资源
    最近更新 更多