I keep receiving the following error. I don't understand because the variable is declared. Any suggestions? The script is simply trying to highlight the background based on conditional statements regarding the ticker VIX. Thanks!
Error: Undeclared identifier
vix_highlight
study(title="VIX Momo", shorttitle="Vix Momo", overlay=false)
//VIX Momo Highlight
vix_ticker = 'VIX'
smaValue_30_VIX = sma(close, 30) smaValue_50_VIX = sma(close, 50) smaValue_200_VIX = sma(close, 200)
vix_30sma = security(vix_ticker, 'D', smaValue_30_VIX) vix_50sma = security(vix_ticker, 'D', smaValue_50_VIX) vix_200sma = security(vix_ticker, 'D', smaValue_200_VIX)
timeFrame_VIX = input(title="Other time frame", type=resolution,
defval="180")
smaClose_VIX = security(vix_ticker, timeFrame_VIX, sma(close,200))
threehr_price_VIX = security(vix_ticker, timeFrame_VIX, close)
red_VIX = (vix_30sma > vix_50sma) and (threehr_price_VIX >= smaClose_VIX) and (close >= vix_50sma)
vix_highlight = bgcolor(red_VIX ? #eb4034 : na, transp = 80)
plot(vix_highlight)