This report shall serve as the validation for the related Pinescript indicator that uses the VWMA based ATR for volatility regime identification. The validation was completed by using the R Quantmod library to compare the results of 3 indicators on SPY against the VIX. For the purpose of this analysis, the CBOE Volatility Index (VIX) shall serve as the benchmark representing the true volatility level by comparing its linear relationship with the indicators: the Larry Williams VIX Fix, the VWMA based ATR that is the subject of this report, and a regular ATR that is normalized to price.
suppressMessages(library(quantmod))
options(scipen = 999)
getSymbols(Symbols = c('^VIX', 'SPY'))
The VIX Fix is an approximation of the VIX that was developed by technical trader Larry Williams. Based on the analysis below, a strong positive linear relationship exists between the VIX Fix and the Actual VIX.
Correlation of 0.78 between the two indicators.
Simple linear regression accounts for 60.85% of the variability in the VIX (R² = 0.6085).
The slope coefficient of 255.6 indicates that an increase of 0.01 in the VIX Fix corresponds to an increase of 2.56 points on the VIX.
The y intercept is a VIX of 11.32 when VIX Fix is 0.
The coefficients are highly significant (p < 2e-16).
The residual standard error is 5.617 points on the VIX.
The scatter plot indicates that dispersion increases dramatically at higher volatility levels.
# Larry Williams VIX Fix
VixFixLW <- (rollmax(x = Cl(SPY), k = 22) - Lo(SPY)) /
rollmax(x = Cl(SPY), k = 22)
test <- na.omit(merge.xts(VixFixLW, Cl(VIX)))
colnames(test) <- c('VixFix', 'VIX')
mod <- lm(test$VIX ~ test$VixFix)
plot(x = as.numeric(test$VixFix), y = as.numeric(test$VIX),
xlab = 'VIX Fix', ylab = 'Actual VIX') + abline(mod)
## integer(0)
cor(x = test$VixFix, y = test$VIX)
## VIX
## VixFix 0.7800489
summary(mod)
##
## Call:
## lm(formula = test$VIX ~ test$VixFix)
##
## Residuals:
## Min 1Q Median 3Q Max
## -20.471 -3.305 -0.968 2.341 39.519
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 11.3240 0.1324 85.56 <0.0000000000000002 ***
## test$VixFix 255.6002 3.0571 83.61 <0.0000000000000002 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 5.617 on 4498 degrees of freedom
## Multiple R-squared: 0.6085, Adjusted R-squared: 0.6084
## F-statistic: 6990 on 1 and 4498 DF, p-value: < 0.00000000000000022
A stronger positive relationship exists between the Modified VWMA ATR and VIX than previously observed between the VIX Fix and VIX.
Correlation of 0.9151 between the two indicators.
Simple linear regression accounts for 83.73% of the variability in the VIX (R² = 0.8373).
The slope coefficient of 797.11 indicates that an increase of 0.01 in the Modified VWMA ATR corresponds to a 7.97 point increase in the VIX.
The y intercept is a VIX of 7.75 when Modified VWMA ATR is 0.
The coefficients are highly significant (p < 2e-16).
The residual standard error (3.618 points on the VIX) indicates a smaller deviation on average between predicted and actual VIX values compared to the previous model.
# Modified ATR Using the Volume Weighted Moving Average of the True Range
ModifiedATR <- VWMA(price = TR(HLC(SPY))$tr, volume = Vo(SPY), n = 14) / Cl(SPY)
test2 <- na.omit(merge.xts(ModifiedATR, Cl(VIX)))
colnames(test2) <- c('ModifiedATR', 'VIX')
mod2 <- lm(test2$VIX ~ test2$ModifiedATR)
plot(x = as.numeric(test2$ModifiedATR), y = as.numeric(test2$VIX),
xlab = 'Modified VWMA ATR', ylab = 'VIX') + abline(mod2)
## integer(0)
cor(x = test2$ModifiedATR, y = test2$VIX)
## VIX
## ModifiedATR 0.9150521
summary(mod2)
##
## Call:
## lm(formula = test2$VIX ~ test2$ModifiedATR)
##
## Residuals:
## Min 1Q Median 3Q Max
## -22.3208 -2.1199 -0.4349 1.8897 18.3507
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 7.75125 0.09621 80.56 <0.0000000000000002 ***
## test2$ModifiedATR 797.10669 5.23468 152.27 <0.0000000000000002 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3.618 on 4505 degrees of freedom
## Multiple R-squared: 0.8373, Adjusted R-squared: 0.8373
## F-statistic: 2.319e+04 on 1 and 4505 DF, p-value: < 0.00000000000000022
The strongest positive relationship was found between the Normalized ATR and VIX:
Correlation of 0.9399 between the two indicators.
Simple linear regression accounts for 88.35% of the variability in the VIX (R² = 0.8835).
The slope coefficient of 947.37 indicates that an increase of 0.01 in the Normalized ATR corresponds to an increase of 9.47 in the VIX.
The y intercept is a VIX value of 6.61 when the Normalized ATR is 0.
The coefficients are highly significant (p < 2e-16).
The residual standard error is 3.062 VIX points.
This model contained the best fit results of the three reviewed.
# Standard ATR Normalized to Price
NormalizedATR <- ATR(HLC(SPY), n = 14)$atr / Cl(SPY)
test3 <- na.omit(merge.xts(NormalizedATR, Cl(VIX)))
colnames(test3) <- c('NormalizedATR', 'VIX')
mod3 <- lm(test3$VIX ~ test3$NormalizedATR)
plot(x = as.numeric(test3$NormalizedATR), y = as.numeric(test3$VIX),
xlab = 'Normalized ATR', ylab = 'VIX') + abline(mod3)
## integer(0)
cor(x = test3$NormalizedATR, y = test3$VIX)
## VIX
## NormalizedATR 0.9399473
summary(mod3)
##
## Call:
## lm(formula = test3$VIX ~ test3$NormalizedATR)
##
## Residuals:
## Min 1Q Median 3Q Max
## -18.1044 -1.9297 -0.5214 1.6099 24.9310
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 6.60938 0.08509 77.67 <0.0000000000000002 ***
## test3$NormalizedATR 947.36971 5.12543 184.84 <0.0000000000000002 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3.062 on 4505 degrees of freedom
## Multiple R-squared: 0.8835, Adjusted R-squared: 0.8835
## F-statistic: 3.416e+04 on 1 and 4505 DF, p-value: < 0.00000000000000022
Why opt for the Modified VWMA ATR if the regular ATR is a better fit?
Volumetric analysis is more likely to highlight sell off events despite generating residual noise in nonvolatile market environments. This is evidenced by the range of residuals (Max - Min) being smaller in the Modified VWMA ATR model vs the regular ATR model.
As a result, the Modified VWMA ATR should perform more consistently in volatile or illiquid markets where the regular ATR’s precision could become less reliable due the indicator’s poor weighting during sudden distortions in the data that are volume driven events or the result of illiquidity premium.
Volume-weighting in the identification of volatility regimes is more consistent with price action trading techniques.