InvestorsHub Logo
Followers 43
Posts 22776
Boards Moderated 2
Alias Born 10/16/2008

Re: None

Wednesday, 09/18/2013 6:26:45 PM

Wednesday, September 18, 2013 6:26:45 PM

Post# of 3631
IV code, implied vol

declare upper;
input period = AggregationPeriod.DAY ;
#hint period: time period to use for aggregating implied volatility.
input length =252 ;
#hint length: #bars to use in implied volatility calculation.
def ivGapHi = if isnan(imp_volatility(period=period)) then 99999999999 else imp_volatility(period=period);
def ivGapLo = if isnan(imp_volatility(period=period)) then -99999999999 else imp_volatility(period=period);
def periodHigh = highest( ivGapLo,length=length);
def periodLow = lowest( ivGapHi, length=length);
def ivRange = periodHigh - periodLow ;
def ivp = round( 100*(imp_volatility(period=period) - periodLow)/ivRange, 0);
AddLabel(1, Concat("IV%: ", ivp), color = CreateColor(255-(ivp*2.55),ivp*2.55,0));

Disaster is Only a Keystroke Away!

Join the InvestorsHub Community

Register for free to join our community of investors and share your ideas. You will also get access to streaming quotes, interactive charts, trades, portfolio, live options flow and more tools.