0

我有一个证券独有的指标。我只希望它在选择该安全性时可见。有没有办法让它只对那个安全可见?每次都必须关掉它很烦人。

4

1 回答 1

1

您可以创建一个布尔条件来检查符号,然后您可以将其用作绘图条件,或者使用其他渲染(如线条、框等),您可以将代码包装在 if 语句中,该语句仅在正确时执行象征。

sym = input.string("BINANCE:BTCUSDT", title = "symbol for visible")

visible = syminfo.tickerid == sym

plot(visible ? close : na)



var line hh_line = na

hh = ta.highest(high, 50)

new_hh = ta.change(hh) != 0

if visible
    if na(hh_line)
        hh_line := line.new(x1 = bar_index, y1 = hh, x2 = bar_index + 1, y2 = hh, extend = extend.both)
    else
        if new_hh
            line.set_xy1(hh_line, x = bar_index, y = hh)
            line.set_xy2(hh_line, x = bar_index + 1, y = hh)
        else
            line.set_x2(hh_line, x = bar_index + 1)
于 2022-01-17T22:56:29.533 回答