Pine脚本:Line.delete函数仍显示旧的“ ghost”行

问题描述

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

我试图隔离变量并将它们包含在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,y2 = wsa,width = 1)
    line.delete(wsaLevel[1])


解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)