Created
May 5, 2014 23:16
-
-
Save r2k0/b3128a0f7de1f3d1e14a to your computer and use it in GitHub Desktop.
IV_Ver3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare upper; | |
input period = AggregationPeriod.DAY; | |
input length = 252; | |
def ivGapHi = if isnan(imp_volatility(period=period)) then 999999999999 else imp_volatility(period=period); | |
def ivGapLo = if isnan(imp_volatility(period=period)) then -999999999999 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)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment