如何使用输入来关闭 Lines.new

问题描述 投票:0回答:1

我正在尝试为 Line.new 创建一个开关,但我不知道如何去做。

ShowAsiaRange = input.bool(true,'Show Asia Range', group= M1)

tl = line.new(LineFromDate, rth_low, LineToDate, rth_low, xloc=xloc.bar_time, color=line_color, style=upperlower_line_style, width=sessionLineWidth)
line.delete(tl[1])

th = line.new(LineFromDate, rth_high, LineToDate, rth_high, xloc=xloc.bar_time, color=line_color, style=upperlower_line_style, width=sessionLineWidth)
line.delete(th[1])

tm = line.new(LineFromDate, rth_mid, LineToDate, rth_mid, xloc=xloc.bar_time, color=user_midline_color, style=middle_line_style, width=Width)
line.delete(tm[1])

我尝试过 if 函数,但没有用。

input pine-script line pine-script-v5
1个回答
0
投票

在 pinescript v5 中,您可以使用:

draw = input.bool(true,"draw line ?")
var line1 = line.new(draw?bar_index-10:na, draw?low:na, bar_index, low, extend=extend.right, color = color.green)
© www.soinside.com 2019 - 2024. All rights reserved.