Exploring the Exponentially Weighted Moving Average

Volatility is the most common measure of risk, but it comes in several flavors. In a previous article, we showed how to calculate simple historical volatility. In this article, we will improve on simple volatility and discuss the exponentially weighted moving average (EWMA).

Historical vs. Implied Volatility

First, let's put this metric into a bit of perspective. There are two broad approaches: historical and implied (or implicit) volatility. The historical approach assumes that the past is prologue; we measure history in the hope that it is predictive. Implied volatility, on the other hand, ignores history; it solves for the volatility implied by market prices. It hopes that the market knows best and that the market price contains, even if implicitly, a consensus estimate of volatility.

Image by Sabrina Jiang © Investopedia 2020

If we focus on just the three historical approaches (on the left above), they have two steps in common:

  1. Calculate the series of periodic returns
  2. Apply a weighting scheme

First, we calculate the periodic return. That's typically a series of daily returns where each return is expressed in continually compounded terms. For each day, we take the natural log of the ratio of stock prices (i.e., the price today divided by price yesterday, and so on).

 u i = l n s i s i 1 where: u i = Return on day  i s i = Stock price on day  i s i 1 = Stock price the day before day  i \begin{aligned} &u_i = ln \frac{ s_i }{ s_{ i - 1 } } \\ &\textbf{where:} \\ &u_i = \text{Return on day } i \\ &s_i = \text{Stock price on day } i \\ &s_{ i - 1 } = \text{Stock price the day before day } i \\ \end{aligned} ui=lnsi1siwhere:ui=Return on day isi=Stock price on day isi1=Stock price the day before day i

This produces a series of daily returns, from ui to ui-m, depending on how many days (m = days) we are measuring.

That gets us to the second step: This is where the three approaches differ. In the previous article, we showed that under a couple of acceptable simplifications, the simple variance is the average of the squared returns:

 Variance = σ n 2 = 1 m i = 1 m u n 1 2 where: m = Number of days measured n = Day  i u = Difference of return from average return \begin{aligned} &\text{Variance} = \sigma ^ 2_n = \frac { 1 }{ m } \sum_{ i = 1 } ^ m u ^ 2_{ n - 1 } \\ &\textbf{where:} \\ &m = \text{Number of days measured} \\ &n = \text{Day } i \\ &u = \text{Difference of return from average return} \\ \end{aligned} Variance=σn2=m1i=1mun12where:m=Number of days measuredn=Day iu=Difference of return from average return

Notice that this sums each of the periodic returns, then divides that total by the number of days or observations (m). So, it's really just an average of the squared periodic returns. Put another way, each squared return is given an equal weight. So if alpha (a) is a weighting factor (specifically, a = 1/m), then a simple variance looks something like this:

Image by Sabrina Jiang © Investopedia 2020

The EWMA Improves on Simple Variance
The weakness of this approach is that all returns earn the same weight. Yesterday's (very recent) return has no more influence on the variance than last month's return. This problem is fixed by using the exponentially weighted moving average (EWMA), in which more recent returns have greater weight on the variance.

The exponentially weighted moving average (EWMA) introduces lambda, which is called the smoothing parameter. Lambda must be less than one. Under that condition, instead of equal weights, each squared return is weighted by a multiplier as follows:

Image by Sabrina Jiang © Investopedia 2020

For example, RiskMetricsTM, a financial risk management company, tends to use a lambda of 0.94, or 94%. In this case, the first (most recent) squared periodic return is weighted by (1-0.94)(.94)0 = 6%. The next squared return is simply a lambda-multiple of the prior weight; in this case 6% multiplied by 94% = 5.64%. And the third prior day's weight equals (1-0.94)(0.94)2 = 5.30%.

That's the meaning of "exponential" in EWMA: each weight is a constant multiplier (i.e. lambda, which must be less than one) of the prior day's weight. This ensures a variance that is weighted or biased toward more recent data. The difference between simply volatility and EWMA for Google is shown below.

Image by Sabrina Jiang © Investopedia 2020

Simple volatility effectively weighs each and every periodic return by 0.196% as shown in Column O (we had two years of daily stock price data. That is 509 daily returns and 1/509 = 0.196%). But notice that Column P assigns a weight of 6%, then 5.64%, then 5.3% and so on. That's the only difference between simple variance and EWMA.

Remember: after we sum the entire series (in Column Q) we have the variance, which is the square of the standard deviation. If we want volatility, we need to remember to take the square root of that variance.

What's the difference in daily volatility between the variance and EWMA in Google's case? It's significant: The simple variance gave us a daily volatility of 2.4% but the EWMA gave a daily volatility of only 1.4% (see the spreadsheet for details). Apparently, Google's volatility settled down more recently; therefore, a simple variance might be artificially high.

Today's Variance Is a Function of Prior Day's Variance

You'll notice we needed to compute a long series of exponentially declining weights. We won't do the math here, but one of the best features of the EWMA is that the entire series conveniently reduces to a recursive formula:

 σ n 2 ( EWMA ) = λ σ n 1 2 + ( 1 λ ) u n 1 2 where: EWMA = Exponentially weighted moving average σ n 2 = Variance today λ = Degree of weighting σ n 1 2 = Variance yesterday u n 1 2 = Squared return yesterday \begin{aligned} &\sigma ^ 2_n (\text{EWMA}) = \lambda \sigma^2_{n - 1} + (1 - \lambda) u ^ 2_{ n - 1 } \\ &\textbf{where:} \\ &\text{EWMA} = \text{Exponentially weighted moving average} \\ &\sigma ^ 2_n = \text{Variance today} \\ &\lambda = \text{Degree of weighting} \\ &\sigma ^ 2_{n - 1} = \text{Variance yesterday} \\ &u ^ 2_{n - 1} = \text{Squared return yesterday} \\ \end{aligned} σn2(EWMA)=λσn12+(1λ)un12where:EWMA=Exponentially weighted moving averageσn2=Variance todayλ=Degree of weightingσn12=Variance yesterdayun12=Squared return yesterday

Recursive means that today's variance references (i.e. is a function of) the prior day's variance. You can find this formula in the spreadsheet also, and it produces the exact same result as the longhand calculation! It says: today's variance (under EWMA) equals yesterday's variance (weighted by lambda) plus yesterday's squared return (weighted by one minus lambda). Notice how we are just adding two terms together: yesterday's weighted variance and yesterdays' weighted, squared return.

Even so, lambda is our smoothing parameter. A higher lambda (e.g., like RiskMetric's 94%) indicates slower decay in the series – in relative terms, we are going to have more data points in the series and they are going to "fall off" more slowly. On the other hand, if we reduce the lambda, we indicate higher decay: the weights fall off more quickly and, as a direct result of the rapid decay, fewer data points are used. (In the spreadsheet, lambda is an input, so you can experiment with its sensitivity).


Volatility is the instantaneous standard deviation of a stock and the most common risk metric. It is also the square root of variance. We can measure variance historically or implicitly (implied volatility). When measuring historically, the easiest method is a simple variance. But the weakness with simple variance is all returns get the same weight. So we face a classic trade-off: we always want more data but the more data we have the more our calculation is diluted by distant (less relevant) data. The exponentially weighted moving average (EWMA) improves on simple variance by assigning weights to the periodic returns. By doing this, we can both use a large sample size but also give greater weight to more recent returns.

Article Sources
Investopedia requires writers to use primary sources to support their work. These include white papers, government data, original reporting, and interviews with industry experts. We also reference original research from other reputable publishers where appropriate. You can learn more about the standards we follow in producing accurate, unbiased content in our editorial policy.
  1. MSCI. "RiskMetrics—Technical Document," Page 97.

Take the Next Step to Invest
The offers that appear in this table are from partnerships from which Investopedia receives compensation. This compensation may impact how and where listings appear. Investopedia does not include all offers available in the marketplace.