Get Updates:
Email
Twitter
RSS

VIX Stretch

I’ve been reading the book Short Term Trading Strategies That Work by Larry Connors and Cesar Alvarez this weekend. Several of the strategies in the book call for the use of a “VIX Stretch” when the VIX has stretched to 5% or greater from its 10 period moving average. The indicator below plots the VIX stretch. The stretch line has been reversed so that a positive vix stretch is plotted on the negative axis to agree with the normal convention for an indicator. The signal dots you see are an indication of three or more consecutive days outside the 5% stretch envelope with the indicated trade direction in agreement with the 200 period moving average of the underlying. The details of the strategy are described fully in the book which I found to be a nice addition to my bookshelf. Thanks to reader Bill M for providing me with a copy.

!!!!! NOTE !!!!! The new build of TOS and its script editor has problems with code pasted directly from a web browser. If you cut and paste the below code and get lots of red, this is the cause. I found that by pasting the code into a text editor and ensuring that it is converted to plain text first solved the problem. Otherwise, you will need to remove the invisible line-feed characters embedded after the semicolons.

VIX Stretch

VIX Stretch

# TS_VixStretch
# http://www.thinkscripter.com
# thinkscripter@gmail.com
# Last Update 22 Jan 2010

declare lower;

input threshold = 5.0;

plot zero = 0;
zero.setDefaultColor(color.white);
plot fivePercent = threshold;
fivePercent.setDefaultColor(color.dark_gray);
plot negFivePercent = -threshold;
negFivePercent.setDefaultColor(color.dark_gray);

def SMA = average(close,200);
def VIX = close("VIX");
def VIXSMA = Average(VIX, 10);
plot stretch = -((VIX-VIXSMA)/VIXSMA)*100.0;
stretch.setDefaultColor(color.magenta);

plot signal = if (stretch<-threshold and stretch[1]<-threshold and stretch[2]<-threshold and close>SMA) or (stretch>threshold and stretch[1]>threshold and stretch[2]>threshold and close<SMA) then stretch else double.nan;
signal.setStyle(curve.POINTS);
signal.assignValueColor(if stretch <-threshold then color.green else color.red);
signal.setLineWeight(1);

Leave a Reply