Hi,
sorry i delayed my answer but i trade very heavily last few months. I find better
TOS code for IV rank, here it is:
def
vol = imp_volatility;
#rec data = if !isNaN(vol) then vol else data[1];
def data = vol;
def hi = highest(data,252);
def lo = lowest(data,252);
def perct = round((data - lo)*100/ (hi - lo),0);
plot x = perct;
plot H = 90;
plot L = 20;
this will draw a line tool bellow your chart . If u want to see just a number at your left chart corner use this:
declare upper;
input period = AggregationPeriod.DAY ;
input length =252 ;
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 = Color.PLUM);