我正在尝试为 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 函数,但没有用。
在 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)