i try to put in a simplified switch-statement in my tradingview pine script:
//@version=3
study("my_test",shorttitle="bands",overlay=true)
string VOLA_INDEX = ""
if (ticker == "USOIL")
VOLA_INDEX := "OVX"
if (ticker == "GOLD")
VOLA_INDEX := "GVZ"
if (ticker == "GER30")
VOLA_INDEX := "DV1X"
src = security(ticker,"D",close[1])
vola = security(VOLA_INDEX,"D",close[1])
bands1 = src * vola/100 * sqrt(0.00273972602)
bands3 = src * vola/100 * sqrt(0.00821917808)
upper1 = src + bands1
lower1 = src - bands1
plot( src, title="mean", color=black, style=linebr, linewidth=2, transp=100, trackprice = true,offset=-9999)
plot( upper1, title="upper", color=blue, style=linebr, linewidth=2, transp=40, trackprice = true,offset=-9999)
plot( lower1, title="lower", color=blue, style=linebr, linewidth=2, transp=40, trackprice = true,offset=-9999)
somehow, this could fails.
Someone an idea whats wrong with the syntax?
Thank you
:=operator when you want to reassign values. - Baris Yakutline 8in your code, whatvolais etc. - Michel_T.