The exponential moving average (EMA) is a weighted moving average (WMA) that gives more weighting, or importance, to recent price data than the simple moving average (SMA) does. The EMA responds more quickly to recent price changes than the SMA. The formula for calculating the EMA just involves using a multiplier and starting with the SMA.

## Calculating SMA and EMA

The three steps to calculating the EMA are:

- Calculate the SMA
- Calculate the multiplier for weighting the EMA
- Calculate the current EMA

The calculation for the SMA is very straightforward. The SMA for any given number of time periods is simply the sum of the stock's closing prices for that number of time periods, divided by that same number. So, for example, a 10-day SMA is just the sum of the closing prices for the past 10 days, divided by 10.

The mathematical formula looks like this:

$\begin{aligned} &\text{Simple moving average} = \frac{(N - \text{period sum})}{N}\\ &\textbf{where:}\\ &N=\text{number of days in a given period}\\ &\text{period sum}=\text{sum of stock closing prices in that period}\\ \end{aligned}$

The formula for calculating the weighting multiplier looks like this:

$\begin{aligned} \text{Weighted multiplier} &= 2 \div (\text{selected time period} + 1) \\ &= 2 \div (10 + 1) \\ &= 0.1818 \\ &= 18.18\% \\ \end{aligned}$

(In both cases, we're assuming a 10-day SMA.)

So, when it comes to calculating the EMA of a stock:

$\begin{aligned} &EMA = \text{Price}(t) \times k + EMA(y) \times (1-k) \\ &\textbf{where:}\\ &t=\text{today}\\ &y=\text{yesterday}\\ &N=\text{number of days in EMA}\\ &k=2 \div (N + 1)\\ \end{aligned}$

The weighting given to the most recent price is greater for a shorter-period EMA than for a longer-period EMA. For example, an 18.18% multiplier is applied to the most recent price data for a 10-day EMA, as we did above, whereas for a 20-day EMA, only a 9.52% multiplier weighting is used. There are also slight variations of the EMA arrived at by using the open, high, low, or median price instead of using the closing price.

## Using the EMA: Moving Average Ribbons

Traders use moving averages in devising their trading strategies. They do this via moving average ribbons, which plot a large number of moving averages onto a price chart. Though seemingly complex based on the sheer volume of concurrent lines, ribbons create an effective and simple way of visualizing the dynamic relationship between short-, intermediate- and long-term trends. Traders and analysts rely on ribbons to identify turning points, continuations, overbought/oversold conditions, to define areas of support and resistance, and to measure price trend strengths.

Defined by their characteristic three-dimensional shape that seems to flow and twist across a price chart, moving average ribbons are very simple to create and interpret. They generate buy and sell signals whenever the moving average lines all converge at one point. Traders look to buy on occasions when shorter-term moving averages cross above the longer-term moving averages from below and look to sell when shorter moving averages cross below from above.

## How to Create a Moving Average Ribbon

To construct a moving average ribbon, simply plot a large number of moving averages of varying time period lengths on a price chart at the same time. Common parameters include eight or more moving averages and intervals that range from a two-day moving average to a 200- or 400-day moving average. For ease of analysis, keep the type of moving average consistent across the ribbon—all EMAs, for example.

When the ribbon folds—all of the moving averages converge into one close point on the chart—trend strength is likely weakening and possibly pointing to a reversal. The opposite is true if the moving averages are fanning and moving apart from each other, suggesting that prices are ranging and that a trend is strong or strengthening.

Downtrends are constructed by shorter moving averages crossing below longer moving averages. Uptrends, conversely, show shorter moving averages crossing above longer moving averages. In these circumstances, the short-term moving averages act as leading indicators that are confirmed as longer-term averages trend towards them.

## The Bottom Line

The number and type of moving averages vary considerably between traders, based on investment strategies and the underlying security or index. But EMAs are especially popular because they give more weight to recent prices, lagging less than other averages. Some common moving average ribbon examples involve eight separate EMA lines, ranging in length from a few days to multiple months.