Skip to content

Adaptive VIX Moving Average with Ehlers Alpha Formula

December 4, 2019

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.

12 Comments leave one →
  1. John permalink
    December 4, 2019 9:20 am

    Nice post David!

    • david varadi permalink*
      December 4, 2019 2:48 pm

      Thanks John!
      best regards,

  2. cdao permalink
    December 6, 2019 8:00 pm

    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.

    • david varadi permalink*
      December 7, 2019 10:34 am

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

  3. Ashok permalink
    December 24, 2019 11:39 pm

    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?

  4. Ashok permalink
    December 25, 2019 9:43 am

    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.

  5. Ashok permalink
    December 25, 2019 10:59 am

    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.

  6. Mark permalink
    January 3, 2020 11:28 pm

    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?

  7. yanvas24 permalink
    January 16, 2020 8:49 am

    Hi David! My name is Jan. I’m from Russia. I recently read two books by John Ehlers “Rocket science for traders” and “Cycle Analytics for Traders”. I was very interested in his approach and trading methods. Have you applied the approaches and methods of John Ehlers in practice? What are the results?

    • david varadi permalink*
      February 25, 2020 9:56 pm

      hi Yanvas24, I have tried many of the indicators and taken a look. There are some very practical applications but obviously no magic bullets.
      best regards,

  8. david varadi permalink*
    January 30, 2020 1:12 pm

    Hi Mark, I will attempt to post a spreadsheet at some point. The reason for using the VIX is that the smoothing is a function of expected volatility. If expected volatility is high then we would expect higher noise and thus require more smoothing. If vol is low then we need less smoothing. This is the advantage of a dynamic smoothing process versus a fixed lookback.
    best regards


  1. Quantocracy's Daily Wrap for 12/04/2019 | Quantocracy

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: