FYRETRADE INDICATOR
AVERAGE IV vs HV
input mode = { "histMinusImp", default "impMinusHist"};
input length = 252;
input displace = 0;
plot SMA = Average(ImpVolatility()-HistoricalVolatility()[-displace], length);
SMA.SetDefaultColor(GetColor(1));
---------------------------------------------------------------------------------
Other indicator green/red
IV VS HV
#sdi_hivdelta - difference between historical and implied volatility
#hint: plots the histogram of the difference between historical and implied volatility. the idea is that options are richly priced when iv exceeds hv and selling options is the more advantageous strategy.
declare lower;
input mode = { "histMinusImp", default "impMinusHist"};
#hint mode: select which way to perform the difference calculation.
input length = 20;
#hint length: number of bars to perform historicalVolatility calculation
def ihDelta = historicalVolatility(length)- impVolatility();
plot hid = if mode == mode.impMinusHist then -ihDelta else ihDelta;
hid.setPaintingStrategy(paintingStrategy.HISTOGRAM);
hid.setlineWeight(5);
hid.assignValueColor(
if hid < 0 and hid <= hid[1] then color.RED
else if hid < 0 and hid > hid[1] then color.DARK_RED
else if hid >= 0 and hid >= hid[1] then color.GREEN
else color.DARK_GREEN);