This script compares the implied volatility to the historic volatility as a ratio.
The plot indicates how high the current implied volatility for the next 30 days is relative to the actual volatility realized over the set period. This is most useful for options traders as it may show when the premiums paid on options are over valued relative to the historic risk.
The default is set to one year (252 bars) however any number of bars can be set for the lookback period for HV.
The default is set to VIX for the IV on SPX or SPY but other CBOE implied volatility indexes may be used. For /CL you have OVX/HV and for /GC you have GVX/HV.
Note that the CBOE data for these indexes may be delayed and updated EOD and may not be suitable for intraday information. (Future versions of this script may be developed to provide a realtime intraday study. )