Thursday, February 7, 2013

Thinkscript IV vs HV histogram

This is a great histogram showing the difference between IV & HV, I learned the importance  of knowing where the future and actual volatility is


See http://www.smalldoginvestor.com

#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);

No comments:

Post a Comment