What I'm trying to do is write code for an option screener to return stocks where current implied volatility is greater than implied volatility from 1 day ago by 0.5. Here is what I currently have:
# Defining current imp volatility
def currentIV = imp_volatility();
# Defining implied volatility from 1 day ago
def previousIV = getValue(imp_volatility(), 1);
# Comparing the current value to the previous value
(currentIV - previousIV > 0.5)
Newbie to thinkscript but the statement in the last line is apparently invalid. I also have the option of using something simpler like "ImpVolatility() from 5 bars ago is less than ImpVolatility()", but unsure how to edit this line to include the "by 0.5" parameter.
Feel like I'm missing something pretty simple here but any help would be greatly appreciated. Thanks in advance.
# Defining current imp volatility
def currentIV = imp_volatility();
# Defining implied volatility from 1 day ago
def previousIV = getValue(imp_volatility(), 1);
# Comparing the current value to the previous value
(currentIV - previousIV > 0.5)
Newbie to thinkscript but the statement in the last line is apparently invalid. I also have the option of using something simpler like "ImpVolatility() from 5 bars ago is less than ImpVolatility()", but unsure how to edit this line to include the "by 0.5" parameter.
Feel like I'm missing something pretty simple here but any help would be greatly appreciated. Thanks in advance.