Pine script Pine脚本:Line.delete函数仍显示“old”;“鬼魂”;线

Pine script Pine脚本:Line.delete函数仍显示“old”;“鬼魂”;线,pine-script,Pine Script,代码应该删除旧的行,但我仍然在窗口中找到旧的重影行 我试图隔离变量并将它们包含在if语句中,但没有成功。不确定是否是的if语句 任何帮助都将不胜感激 Weekly_SR = timeframe.period == '26' or timeframe.period == '30' or timeframe.period == '60' // Start & End time for Week startWeek = time("W") endWeek = startW

代码应该删除旧的行,但我仍然在窗口中找到旧的重影行

我试图隔离变量并将它们包含在if语句中,但没有成功。不确定是否是的if语句

任何帮助都将不胜感激

Weekly_SR = timeframe.period == '26' or timeframe.period == '30' or timeframe.period == '60'

// Start & End time for Week
startWeek = time("W")
endWeek = startWeek + 432000000

[wphigh, wplow, wpclose] = security(syminfo.tickerid, 'W', [high[1], low[1], close[1]], lookahead = true)

//Weekly Pivot Points
wpivot = (wphigh + wplow + wpclose) / 3
wr1 = wpivot + (wphigh - wplow) * 0.382
wra = wpivot + (wphigh - wplow) * 0.236
wsa = wpivot - (wphigh - wplow) * 0.236
ws1 = wpivot - (wphigh - wplow) * 0.382

//Week
abovews1 = close[1] > ws1

belowwr1 = close[1] < wr1

if(Weekly_SR and abovews1)
    wraLevel = line.new(
                  x1 = startWeek, y1 = wra, 
                  x2 = endWeek, y2 = wra,
                  xloc = xloc.bar_time,
                  extend = extend.none, 
                  color = color.white, 
                  style = line.style_dashed, 
                  width = 1)
    line.delete(wraLevel[1])
    
if(Weekly_SR and belowwr1)
    wsaLevel = line.new(
                  x1 = startWeek, y1 = wsa, 
                  x2 = endWeek, y2 = wsa,
                  xloc = xloc.bar_time,
                  extend = extend.none, 
                  color = color.white, 
                  style = line.style_dashed, 
                  width = 1)
    line.delete(wsaLevel[1])


Weekly\u SR=timeframe.period=='26'或timeframe.period=='30'或timeframe.period=='60'
//一周的开始和结束时间
startWeek=时间(“W”)
周末=startWeek+432000000
[wphigh,wplow,wpclose]=安全性(syminfo.tickerid,'W',[high[1],low[1],close[1]],lookahead=true)
//每周支点
wpivot=(wphigh+wplow+wpclose)/3
wr1=wpivot+(wphigh-wplow)*0.382
wra=wpivot+(wphigh-wplow)*0.236
wsa=wpivot-(wphigh-wplow)*0.236
ws1=wpivot-(wphigh-wplow)*0.382
//周
高于ws1=关闭[1]>ws1
低于wwr1=关闭[1]