Trading The Fear Index

The importable AIQ EDS file based on Markos Katsanos’ article in the August 2022 issue of Stocks & Commodities magazine, “Trading The Fear Index” and the “CUM1.csv” file can be obtained on request via email to info@TradersEdgeSystems.com. Code for the author’s system is set up in the AIQ code file.

Synopsis: Here is a long-short strategy to capitalize on stock market volatility using volatility-based exchange-traded funds (ETFs or ETNs)…

! VIX ETF SYSTEM
! This should be applied only to long VIX ETF.
! VIX ETF DAILY LONG-SHORT TRADING SYSTEM
! COPYRIGHT MARKOS KATSANOS 2022
! To be applied on a daily chart of long VIX ETFs:
! VXX,VIXY,UVXY,VIXM,VXZ,SVOL
! INPUTS:
C is [close].
H is [high].
L is [low].
VIXUPMAX is 50. ! VIX UP% MAX
VBARS is 6. ! Number of bars to calculate VIXUP,VIXDN & RC
STBARSL is 25. ! Number of bars to calculate slow stochastic
STBARSS is 10. ! Number of bars to calculate fast stochastic
! COMPARISON INDEX
VIXC is TickerUDF("VIX",C).
VIXH is TickerUDF("VIX",H).
VIXL is TickerUDF("VIX",L).
SPYC is TickerUDF("SPY",C).
SPYH is TickerUDF("SPY",H).
SPYL is TickerUDF("SPY",L).
! STOCHASTIC
STOCHVS is (VIXC-lowresult(VIXL,STBARSS))/(highresult(VIXH, STBARSS)-lowresult(VIXL, STBARSS)+0.0001)100. STVIXS is simpleavg(STOCHVS,3). STOCHSS is (SPYC-lowresult(SPYL,STBARSS))/(highresult(SPYH,STBARSS)-lowresult(SPYL,STBARSS)+0.0001)100.
STSPYS is simpleavg(STOCHSS,3).
STOCHVL is (VIXC-lowresult(VIXL,STBARSL))/(highresult(VIXH,STBARSL)-lowresult(VIXL,STBARSL)+0.0001)100. STVIXL is simpleavg(STOCHVL,3). STOCHSL is (SPYC-lowresult(SPYL,STBARSL))/(highresult(SPYH,STBARSL)-lowresult(SPYL,STBARSL)+0.0001)100.
STSPYL is simpleavg(STOCHSL,3).
!VIX
VIXDN is (VIXC/valresult(highresult(VIXC,VBARS),1)-1)100. VIXUP is (VIXH/valresult(lowresult(VIXL,VBARS),1)-1)100.
! CORRELATION TREND
PeriodToTest is VBARS-1.
!CUM1 is a custom ticker from DTU import of a CSV file** !CUM1 file is required for this system to work
! PEARSON CORRELATION
ValIndex is TickerUDF("VIX", [close]).
ValTkr is TickerUDF("CUM1", [close]).
SumXSquared is Sum(Power(ValIndex,2), PeriodToTest).
SumX is Sum(ValIndex, PeriodToTest).
SumYSquared is Sum(Power(ValTkr,2), PeriodToTest).
SumY is Sum(ValTkr, PeriodToTest).
SumXY is Sum(ValTkr*ValIndex, PeriodToTest).
SP is SumXY - ( (SumX * SumY) / PeriodToTest ).
SSx is SumXSquared - ( (SumX * SumX) / PeriodToTest ).
SSy is SumYSquared - ( (SumY * SumY) / PeriodToTest ).
RC is SP/SQRT(SSx*SSy).
!LONG
BR1 if HasDataFor(STBARSL+10)>STBARSL+3.
BR2 if STVIXL>STSPYL .
BR3 if STVIXS>STSPYS.
BR4 if STVIXS>valresult(STVIXS,1).
BR5 if VIXUP>VIXUPMAX.
BR6 if RC>0.8.
BR7 if RC>valresult(RC,1).
BUY if BR1 and BR2 and BR3 and BR4 and BR5 and BR6 and BR7.
SR1 is STSPYS>STVIXS.
SR2 is STVIXS<valresult(STVIXS,1).
SELL if SR1 or SR2.
!SHORT
SS1 if HasDataFor(STBARSS+10)>STBARSS+3.
SS2 if VIXC<= lowresult(VIXC,3). SS3 if VIXUP15.
SS6 if STSPYS>STVIXS.
SS7 if STSPYS>valresult(STSPYS,1).
SHORT if SS1 and SS2 and SS3 and SS4 and SS5 and SS6 and SS7.
CR1 if VIXUP>VIXUPMAX.
CR2 if STVIXS>valresult(STVIXS,1).
CR3 if RC>0.8.
COVER if CR1 and CR2 and CR3.
TEST if 1=1.

Figure 6 shows the CUM1.csv file that must be created in Excel and then imported using the DTU utility to a new index ticker called “CUM1.” The file increments one unit, like an index, for each trading day starting on 10/1/2003 and continues to the current date. This file would have to be updated manually via the data manager function.

Sample Chart

FIGURE 6: AIQ SYSTEMS. This shows the portion of the CUM1.csv file that must be created in Excel.

Figure 7 shows a summary EDS backtest of the system using the VXX and VXZ from 6/21/2018 to 6/21/2022.

Sample Chart

FIGURE 7: AIQ SYSTEMS. This shows a summary EDS backtest of the system using the VXX and VXZ from 6/21/2018 to 6/21/2022.

—Richard Denning
info@TradersEdgeSystems.com
for AIQ Systems