# Adaptive VIX Moving Average with Ehlers Alpha Formula

In the last post I described a relatively simply method to incorporate the VIX into the well-known AMA or Adaptive Moving Average framework. The alpha formula requires two separate parameters- a short and a long-term constant which requires greater specification by the user. Ideally the fewer parameters you have to specify the better (although it is important to note that logical requirements for maximum lag and minimum responsiveness often tends to dicate the bounds).

Ehlers suggests in his paper on the “Fractal Adaptive Moving Average” using the following formula to compute the alpha in the exponential average:

**alpha= exp(- 4.6*(D -1)) **

where D is analogous to the “VI” or trend factor in the previous post. Note that this formula was adapted in a different way for creating an adaptive volatility measure in this post. I find it to be quite useful and intuitive so it represents a viable alternative to the AMA framework in the last post.

Based on reader feedback I will simplify the percentrank function to be a rolling lookback of 2000 days to make it easier to avoid confusion in replication (the previous used an anchored lookback or “expanding time window”). We can substitute the percentrank of 1/(10-day sma of VIX) for “D” in the formula and calculate the EMA/Exponential moving average of SPY using the alpha output. Here is what the adaptive alpha should look like going back to 1996:

Note that a higher alpha means a faster moving average (less smoothing and lag) while a lower alpha means a slower moving average (more smoothing and lag). We can see in the above chart that the alpha is higher most of the time in bull markets and lower in bear markets (with the 90’s being an exception). No doubt there is a relationship between the VIX and mean-reversion which tended to work well on SPY in periods when the alpha was low. My research in fact shows that profitability was 4x higher buying on down days when this alpha measure was low versus high. What this implies is that you are smoothing more when price is noisy or mean-reverting and smoothing less when price is a decent estimate of tomorrow’s price. Obviously this is exactly what we are looking for when creating an adaptive filter.

Let’s now take a look at how this new transition calculation performs in the adaptive moving average framework. Once again we will compare the strategy of buying when the close of SPY is > 200sma versus the AMA> 200sma.

Consistent with the previous post the AMA strategy is superior to the basic 200sma strategy with fewer trades. The Ehlers alpha method in this case leads to very similar results as using the classic AMA framework for calculating alpha but with even fewer trades. Note that a “D” of 4 vs 4.6 produced a near identical match to the performance and number of trades as the classic AMA framework. In either case I hope this shows the robustness of using the VIX (or you could use historical volatility or GARCH) in an adaptive moving average as a substitute for using the price. In my opinion it is logical to use an adaptive method for smoothing rather than using static smoothing methods or worse yet the actual price in a trend-following strategy.

Nice post David!

Thanks John!

best regards,

david

Thanks for an excellent post. Hoever, I wonder if the formula for alpha has typo since D < 1 therefore alpha could be larger than 1.

Hi Cdao, the alpha is not larger than 1 in this case since the percentrank is bounded from 0 to 1. best regards, David

David, the value of alpha exp(-4.6*(D-1). You have written that D is bound by 1. A d value of 0.2 would mean an alpha value of exp(-4.6*(0.2-1). This exponent is equal to 39.8. Is this what you are expecting or is the negative sign before 4.6 a typo?

David, I went back to read Ehler’s paper. D is bound by 1 and 2. Thus his exponent is always negative or zero. While I have not yet tried to repeat your calculation, changing the exponent to -4.6 *(1-D) would seem to get the values you have shown. Please help.

David, sorry to keep bothering you. I just carried out alpha calculations using excel as follows: 1) downloaded ^VIX data. Calculated average of O,H,L,C for each day. Calculated 10-d SMA of the daily averages. Calculated 2000-d PERCENTRANK for each day. Calculated alpha as exp(-4.6*(1-D). My numbers are very different from yours. What am I doing wrong? Can I send you my spreadsheet?

Once agai, thanks for all your great articles.

Hi David, would you have the code for the two series (adaptive and static).

Could you explain the rationale for using the VIX (a derivative of option prices) instead of smoothed prices?