Williams’ VIX Fix Indicator for ThinkorSwim

BenTen

BenTen

Administrative
Staff
VIP
The Williams’ VIX Fix indicator helps to measure volatility for individual stocks, similar to how the VIX does for the S&P 500 Index. Williams Vix Fix also includes a 20 Bollinger Bands indicating extremes in the signal line.

Some traders believe the Vix Fix indicator can find market bottoms in all instruments.



thinkScript Code

Rich (BB 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;
declare lower;
def C = close;
def L = low;
plot VixFix = (Highest (C, LengthVF) - L) / (Highest (C, LengthVF)) * 100;
#VixFix.AssignValueColor(Color.GREEN);
plot OS = OverSold;
OS.AssignValueColor(Color.CYAN);
plot OB = OverBought;
OB.AssignValueColor(Color.CYAN);
Alert(VixFix crosses above OverSold, "VixFIX crosses above OverSold", Alert.Bar, Sound.Ring);
#Alert(VixFix > OverSold, "VixFIX > OverSold", Alert.TICK, Sound.Ring);


# BollingerBands code

input ShowBollingerBands = No;
input displace = 0;
input BBlength = 20;
input Num_Dev_Dn = -2.0;
input Num_Dev_up = 2.0;
input averageType = AverageType.Simple;

def sDev = stdev(data = VixFix[-displace], length = BBlength);
def MidLine = MovingAverage(averageType, data = VixFix[-displace], length = BBlength);

def LowerBand = MidLine + num_Dev_Dn * sDev;
def UpperBand = MidLine + num_Dev_Up * sDev;
plot LB = if ShowBollingerBands then LowerBand else Double.NaN;
plot UB = if ShowBollingerBands then UpperBand else Double.NaN;
LB.SetDefaultColor(GetColor(0));
UB.SetDefaultColor(GetColor(5));


VixFix.AssignValueColor(if VixFix > UpperBand then Color.Green else Color.Red);

input corrLength = 20;
def correlationWith = ImpVolatility();

plot CorrelationIV = correlation(VixFix, correlationWith, corrLength);
CorrelationIV.SetDefaultColor(color.light_gray);
addlabel(yes, "Correlation w IV: "+ correlationIV,color.light_gray);

Shareable Link

http://tos.mx/yAq7s5

thinkScript Code (Mobius)

Rich (BB code):
# Williams_Vix_Fix
# Mobius
# Addition of mean for easier reading.
# V01.2016
declare lower;

input n = 22;
plot WVF = (Highest (Close, n) - Low) / (Highest(Close, n)) * 100;
     WVF.SetDefaultColor(Color.Cyan);

plot mean = inertiaAll(WVF);
     mean.SetDefaultColor(Color.Gray);

addCloud(mean, WVF, color.green, color.red);

# End Code Williams Vix Fix

Shareable Link

http://tos.mx/5HigXD
 
Last edited:
D

diazlaz

Well-known member
2019 Donor
VIP
Ported CM_Williams_Vix_Fix Indicator - Helps find market bottoms, it looks interesting indicator to stop reversals.

Seems to work best with lower time frames. please explore and share your experiences :)



Code:
#ts_CMWilliamsVixFix_20190928 - CM_Williams_Vix_Fix Finds Market Bottoms
#Ported from https://www.tradingview.com/script/og7JPrRA-CM-Williams-Vix-Fix-Finds-Market-Bottoms/
#Original Author ChrisMoody
#Ported By diazlaz
#
#20190908.01 - Initial Release
#20190908.02 - Add ability to reverse logic and highlight potential tops

declare lower;

input colorCandles = yes; #hint Color Candles
input plotBottoms = yes; #hint Plot Bottoms if yes or Plots Tops if no.
input pd = 22; #hint LookBack Period Standard Deviation High
input bbl = 20; #hint Bolinger Band Length
input mult = 2.0; #hint Bollinger Band Standard Dev
input lb = 50; #hint Look Back Period Percentile High
input ph = .85; #hint Highest Percentile - 0.90=90%, 0.95=95%, 0.99=99%
input pl = 1.01; #hint Lowest Percentile - 1.10=90%, 1.05=95%, 1.01=99%
input hp = no; #hint Show High Range - Based on Percentile and LookBack Period?
input sd = no; #Show Standard Deviation Line?

def wvf = if plotBottoms then ((Highest(close, pd) - low) / (Highest(close, pd))) * 100 else
    ((Lowest(close, pd) - high) / (Lowest(close, pd))) * 100;
def sDev = mult * StDev(wvf, bbl);
def midLine = Average(wvf, bbl);
def lowerBand = midLine - sDev;
def upperBand = midLine + sDev;

def rangeHigh = (Highest(wvf, lb)) * ph;
def rangeLow = (Lowest(wvf, lb)) * pl;

plot pRH = (if hp and rangeHigh then rangeHigh else Double.NaN);
pRH.SetLineWeight(2);
pRH.AssignValueColor(Color.ORANGE);

plot pRL = (if hp and rangeLow then rangeLow else Double.NaN);
pRL.SetLineWeight(2);
pRL.AssignValueColor(Color.ORANGE);

plot pUB = (if sd and upperBand then upperBand else Double.NaN);
pUB.SetLineWeight(2);
pUB.AssignValueColor(Color.ORANGE);

plot pWVF = wvf;
pWVF.SetPaintingStrategy(paintingStrategy = PaintingStrategy.HISTOGRAM);
pWVF.SetLineWeight(2);
pWVF.AssignValueColor(if wvf >= upperBand or wvf >= rangeHigh then Color.LIME else Color.GRAY);

AssignPriceColor(
   if colorCandles then     
      if wvf >= upperBand or wvf >= rangeHigh then Color.LIME else Color.GRAY
   else
      Color.CURRENT
);
 
Last edited:
BenTen

BenTen

Administrative
Staff
VIP
Thank you. I actually have this version and the enhanced one ready to go. Converted them to share with our Warehouse members 😂

Amazing work by the way. You beat me to it. 🎉

Since you already share the initial version I’ll drop the updated one sometimes next week. It has less signals but more reliable than this one.
 
D

diazlaz

Well-known member
2019 Donor
VIP
awesome - looking forward to it Ben! - been playing with the code, seems it does a damn good job also findings tops ;) - more experimentation and minor tweaks might be necessary, maybe you can take it further:

input plotBottoms = yes; #hint Plot Bottoms if yes or Plots Tops if no.
def wvf = if plotBottoms then ((Highest(close, pd) - low) / (Highest(close, pd))) * 100 else
((Lowest(close, pd) - high) / (Lowest(close, pd))) * 100;

if set to no, it flips the logic and highlights potential tops.

Tops

 
Last edited:
D

diazlaz

Well-known member
2019 Donor
VIP
i'm currently developing a trend indicator out of it (work in progress):



I think this has some potential of identifying reversals, or has an opportunity to provide a signal when it's a good time to go long or short interday, or can serve as a stop/reversal indicator, but it's going to need to be paired with an additional set of confirmation indicators. i'm curious to see what Ben comes up with to improve the signal. I think there is some value here when paired up.

Ideally so far, what I found, is that once the signals are exhausted (the last green bar), then it's a good time to trigger, otherwise it still early and could fall or increase further.

I will backtest this model and see if there is any edge just using it as a standalone and share the results shortly.
 
BenTen

BenTen

Administrative
Staff
VIP
I plan on releasing this sometime next week, but @diazlaz was kind enough to port the first version to ThinkorSwim yesterday so I thought it would be fair to share this now, so there is no delay on the development of this indicator.

FILTERED ENTRIES -- Plus AGGRESSIVE FILTERED ENTRIES - HIGHLIGHT BARS AND ALERTS
I recommend watching this video before using the indicator: http://vimeopro.com/user32804960/tradingview-indicators/video/115973132

thinkScript Code

Code:
# VIX_FIX v3 Major Update
# Based on Larry Williams' Vix Fix
# Assembled by BenTen at useThinkScript.com
# Converted from https://www.tradingview.com/script/pJpXG5JH-CM-Williams-Vix-Fix-V3-Ultimate-Filtered-Alerts/
# Video intro: https://vimeopro.com/user32804960/tradingview-indicators/video/115973132

# Discussion: https://usethinkscript.com/threads/vix-fix-v3-major-update-for-thinkorswim.721/

input pd = 22;
input bbl = 20;
input mult = 2.0;
input lb = 50;
input ph = 0.85;
input pl = 1.01;

# Downtrend Criterias
input ltLB = 40;
input mtLB = 14;
input str = 3;

# Williams Vix Fix Formula
def wvf = ((highest(close, pd) - low) / (highest(close, pd))) * 100;
def sDev = mult * stdev(wvf, bbl);
def midLine = SimpleMovingAvg(wvf, bbl);
def lowerBand = midLine - sDev;
def upperBand = midLine + sDev;
def rangeHigh = (highest(wvf, lb)) * ph;

#  Filtered Bar Criteria
def upRange = low > low[1] and close > high[1];
def upRange_Aggr = close > close[1] and close > open[1];
#  Filtered Criteria
def filtered = ((wvf[1] >= upperBand[1] or wvf[1] >= rangeHigh[1]) and(wvf<upperBand and wvf<rangeHigh));
def filtered_Aggr = (wvf[1] >= upperBand[1] or wvf[1] >= rangeHigh[1]);

#  Alerts Criteria
def alert1 = wvf >= upperBand or wvf >= rangeHigh;
def alert2 = (wvf[1] >= upperBand[1] or wvf[1] >= rangeHigh[1]) and(wvf<upperBand and wvf<rangeHigh);
def alert3 = upRange and close > close[str] and(close<close[ltLB] or close<close[mtLB]) and filtered;
def alert4 = upRange_Aggr and close > close[str] and(close<close[ltLB] or close<close[mtLB]) and filtered_Aggr;

assignPriceColor(if alert4 then Color.ORANGE else if Alert3 then Color.CYAN else Color.WHITE);
 
Last edited:
J

john3

Active member
2019 Donor
Is the name coincidental? What does it have to do with the VIX?
 
BenTen

BenTen

Administrative
Staff
VIP
@john3

William’s VIX Fix is a synthetic VIX(CBOE Volatility Index) calculation which can be used in any market to mimic the performance (but not the quotes) of the well-known volatility index (the WVF is not based on option’s implied volatility but derived from historical and intraday prices only).
More on that here: https://m.benzinga.com/article/458117
 
J

john3

Active member
2019 Donor
@BenTen, maybe I'm dense, but I still don't get what 22 bars on, say, NFLX, has to do with VIX.
 
S

skynetgen

Well-known member
Wow you guys are working hard on this! I am also testing something: Check out the simple add of
Code:
plot mean = inertia(inv_WVF,meanlength);
     mean.SetDefaultColor(Color.Gray);
addCloud( inv_WVF,mean, color.green, color.red);
with 20 period, 50 mean. on daily
 
Last edited:
D

diazlaz

Well-known member
2019 Donor
VIP
Great find everyone! Looking at it, I think the logic that introduced in the video and in the enhanced filter, can be turned into a price action indicator and embed this logic in other indicators?

Thoughts?
 
korygill

korygill

Active member
VIP
@john3 , if you watch the video, they explain why they use 22 for length.
...
...
spoiler alert:
that's how many trading days there are in most months.
 
D

diazlaz

Well-known member
2019 Donor
VIP
@diazlaz That could be possible 🤔
it made me think differently, if we all provide our insights, we can create a class of price action indicators, that is primarily driven by price action rather than a technical indicator, and then use this price action to compliment the technical indicators. really good reminder to have selection criteria also incorporate price.
 
J

john3

Active member
2019 Donor
@john3 , if you watch the video, they explain why they use 22 for length.
...
...
spoiler alert:
that's how many trading days there are in most months.
I saw that. The question is what does it have to do with the CBOE's VIX?
 
S

skynetgen

Well-known member
I saw that. The question is what does it have to do with the CBOE's VIX?
Well the original creator idea was to create "VIX" like any indicator for any security (not just SPX). This indicator matches VIX somewhat ( if you apply original one to SPX) hence the name. But yeah while VIX is tied to put/call ratios this is just price range based

philosophy behind it that spikes in range change correlate with tops and bottoms
 
J007RMC

J007RMC

Active member
2019 Donor
VIP
Im liking Vix FIX so far the only draw back Ive found is the lower indicator takin up valuable real-estate on my laptop. is it possible to write the lower indicator onto the chart itself?
 
Top