It was posted somewhere earlier in the forum, here is the script. Note: I made some changes
Code:
#Dilbert_VixFix
# V1.0 - 052816 - Dilbert - 1st code cut
# VixFix is a pretty close approximation to the standard VIX or implied volatility. It can be used on intraday chart aggregations, and on symbols that do not have options. When VixFIX spikes high it provides some pretty good buy signals.
input OverSold = .1; # .1 good for SPY 1 day 1 minute chart
input OverBought = .01; # .01 good for SPY 1 day 1 minute chart
input LengthVF = 22;
input LengthMA = 20;
input percentilelength = 252;
declare lower;
def C = close;
def L = low;
def VixFix = (Highest (C, LengthVF) - L) / (Highest (C, LengthVF)) * 100;
def agg= getaggregationPeriod();
#VixFix.AssignValueColor(Color.GREEN);
#plot OS = OverSold;
#OS.AssignValueColor(Color.CYAN);
#plot OB = OverBought;
#OB.AssignValueColor(Color.CYAN);
plot baseline = 20;
plot range = round((vixfix/highest(vixfix,percentilelength)) * 100,0);
input high_VF = 80;
input low_VF = 20;
AddLabel(yes, "Volatility: "+ aspercent(range/100), if range> range from 1 bars ago then Color.GREEN else Color.RED);