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

时间:2020-08-27 19:33:01

标签: 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 = 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])


0 个答案:

没有答案