Undeclared identifiers
Posted: Sun Sep 26, 2021 12:03 pm
I am trying to write a simple indicator in pine-script but I can't get rid of the undeclared identifier error when I add the line.delete() function. I couldn't resolve this with all the previous suggestions for this error message. To be honest, mine is probably a simpler problem!
line 20: Undeclared identifier 'WkIBL';
line 21: Undeclared identifier 'WkIBH';
line 22: Undeclared identifier 'WkIBHx';
line 23: Undeclared identifier 'WkIBLx';
line 24: Undeclared identifier 'WkIBM'
I have been over this article, but none of the solutions seem to apply.
https://kodify.net/tradingview/errors/u ... dentifier/
Below is the code.
line 20: Undeclared identifier 'WkIBL';
line 21: Undeclared identifier 'WkIBH';
line 22: Undeclared identifier 'WkIBHx';
line 23: Undeclared identifier 'WkIBLx';
line 24: Undeclared identifier 'WkIBM'
I have been over this article, but none of the solutions seem to apply.
https://kodify.net/tradingview/errors/u ... dentifier/
Below is the code.
Code: Select all
//@version=4
study(title=" Weekly Initial Balance", shorttitle="WkIB", overlay=true)
TuesC = (dayofweek == dayofweek.tuesday)
Mon = (dayofweek == dayofweek.monday)
TwodayHigh = highest(high, 2)
TwodayLow = lowest(low, 2)
IBHx = TwodayHigh + ((TwodayHigh-TwodayLow)/2)
IBLx = TwodayLow - ((TwodayHigh-TwodayLow)/2)
Mid = (TwodayHigh + TwodayLow) / 2
if(TuesC)
WkIBM = line.new(x1=bar_index[1], y1=Mid, x2=bar_index, y2=Mid, extend=extend.right, color=#F2E8DC, style=line.style_dotted)
WkIBL = line.new(x1=bar_index[1], y1=TwodayLow, x2=bar_index, y2=TwodayLow, extend=extend.right, color=#F2E8DC)
WkIBH = line.new(x1=bar_index[1], y1=TwodayHigh, x2=bar_index, y2=TwodayHigh, extend=extend.right, color=#F2E8DC)
WkIBHx = line.new(x1=bar_index[1], y1=IBHx, x2=bar_index, y2=IBHx, extend=extend.right, color=#F2E8DC, style=line.style_dashed)
WkIBLx = line.new(x1=bar_index[1], y1=IBLx, x2=bar_index, y2=IBLx, extend=extend.right, color=#F2E8DC, style=line.style_dashed)
if(Mon)
line.delete(WkIBL[1])
line.delete(WkIBH[1])
line.delete(WkIBHx[1])
line.delete(WkIBLx[1])
line.delete(WkIBM[1])