ChiliPepper
New member
I got this code a long time ago, and I don't remember where exactly, probably from YouTube. It displays the 52 week IV High & Low, & Current IV Percentile on the upper chart, but it only works on the desktop app. How can I make it so it'll work on the mobile app too?
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("52 Wk High: ", periodHigh), color = Color.Cyan);
AddLabel(2, Concat("52 Wk Low: ", periodLow), color = Color.Cyan);
AddLabel(3, Concat("IV%: ", ivp), color = Color.Cyan);
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("52 Wk High: ", periodHigh), color = Color.Cyan);
AddLabel(2, Concat("52 Wk Low: ", periodLow), color = Color.Cyan);
AddLabel(3, Concat("IV%: ", ivp), color = Color.Cyan);
Last edited: