Simple, Exponential, and Weighted Moving Averages

Day Trading Uses and Applications of Moving Averages

example of sma, ema, and wma on price chart

Moving averages act as a technical indicator to show you how a security’s price has moved, on average, over a certain period of time. Moving averages are often used to help highlight trends, spot trend reversals, and provide trade signals. There are several different types of moving averages, but they all create a single smooth line that can help show you which direction a price is moving.

Simple Moving Average Calculation

The simple moving average (SMA) calculates an average of the last n prices, where n represents the number of periods for which you want the average:

Simple moving average = (P1 + P2 + P3 + P4 + ... + Pn) / n

For example, a four-period SMA with prices of 1.2640, 1.2641, 1.2642, and 1.2641 gives a moving average of 1.2641 using the calculation (1.2640 + 1.2641 + 1.2642 + 1.2641) / 4 = 1.2641.

While knowing how to calculate a simple average is a good skill to have, trading and chart platforms calculate this for you. Simply select the SMA indicator from the list of charting indicators, apply it to the chart, and adjust the number of periods you want to use.

You typically make adjustments to the indicators in the Settings menu section of a trading platform. On many platforms, you can locate the settings by double-clicking on the indicator itself.

The advantage of an SMA is that you know exactly what you are getting. The SMA value equals the average price for the number of periods in the SMA calculation.

Common SMA values are eight, 20, 50, 100, and 200. For example, if using a 100-period SMA, the current value of the SMA on the chart is the average price over the last 100 periods or price bars.

This chart shows a 50-period SMA, along with an exponential moving average (EMA) and a weighted moving average (WMA) on a one-minute stock chart. Due to their different calculations, the indicators appear at different price levels on the chart.

Exponential Moving Average Calculation

The exponential moving average (EMA) is a weighted average of the last n prices, where the weighting decreases exponentially with each previous price/period. In other words, the formula gives recent prices more weight than past prices.

Exponential moving average = (Close - previous EMA) * (2 / n+1) + previous EMA

For example, a four-period EMA with prices of 1.5554, 1.5555, 1.5558, and 1.5560, with the last value being the most recent, gives a current EMA value of 1.5558 using the calculation (1.5560 - 1.5558) x (2/5) + 1.5558 = 1.55588.

As with the SMA, charting platforms do all the EMA calculations for you. Select the EMA from the indicator list on a charting platform and apply it to your chart. Go into the settings and adjust how many periods the indicator should calculate, such as 15, 50, or 100 periods.

The EMA adapts more quickly to price changes than the SMA. For example, when a price reverses direction, the EMA will reverse direction quicker than the SMA. This takes place because the EMA formula gives more weight to recent prices, and less weight to prices that occurred in the past.

Weighted Moving Average Calculation

The weighted moving average (WMA) gives you a weighted average of the last n prices, where the weighting decreases with each previous price. This works similarly to the EMA, but you calculate the WMA differently.

Weighted moving average calculation = (Price * weighting factor) + (Price previous period * weighting factor-1)

WMAs can have different weights assigned based on the number of periods used in the calculation. If you want a weighted moving average of four different prices, then the most recent weighting could be 4/10, the period before could have a weight of 3/10, the period before that could have a weighting of 2/10, and so on.

The "10" in that scenario is a randomly chosen number. A weight of 4/10, for example, means the most recent price will account for 40% of the value of the WMA. The price three periods ago only accounts for 10% of the WMA value.

For the following example, assume prices of 90, 89, 88, 89, with the most recent price first. You would calculate this as [90 x (4/10)] + [89 x (3/10)] + [88 x (2/10)] + [89 x (1/10)] = 36 + 26.7 + 17.6 + 8.9 = 89.2

You can customize the weighted moving average more than the SMA and EMA. The most recent price points are usually given more weight, but it could also work the other way, where you give historical prices more weight.

Moving Average Trading Uses and Interpretation

Moving averages can be used for both analysis and trading signals.

For analysis, all the moving averages help highlight the trend. When the price is above its moving average, it shows that the price is trading higher than it has, on average, over the period being analyzed. That helps confirm an uptrend. When the price sits below its moving average, this shows that the price is trading lower than it has, on average, over the period being analyzed. That helps confirm a downtrend.

When the price crosses above its moving average, this shows the price is getting stronger relative to where it was in the past because the most recent price now sits higher than the average. If the price crosses below its moving average, it shows the price is getting weaker relative to where it was in the past.

One longer-term and one shorter-term moving average—for example, 20 and 50 periods—can be added to a chart simultaneously. When the 20-period moving average crosses above the 50, it indicates that short-term price momentum is moving to the upside. When the 20-period moving average crosses below the 50, it indicates that the short-term price momentum is moving to the downside.

Moving averages can also be incorporated with other indicators to provide trade signals. An EMA can provide buy signals when combined with Keltner Channels. A strategy may include buying near the EMA when the trend is up and the price is pulling back from the top of the Keltner Channel.

One type of moving average isn't inherently better than others; they just calculate the average price differently. Depending on the strategy you’re using, one type of moving average may work better than another. Try out different moving average combinations and see which provides you with the best results.

You may find that, for each market, you need to adjust your settings slightly. A 50-period SMA may provide great signals on one stock, for example, but it doesn't work well on another. Or a 20-period EMA may help isolate the trend on one futures contract, but not another. All the moving averages are just tools, and interpreting them is up to the trader because no indicator works well all the time or in all market conditions.

The Balance does not provide tax, investment, or financial services and advice. The information is being presented without consideration of the investment objectives, risk tolerance or financial circumstances of any specific investor and might not be suitable for all investors. Past performance is not indicative of future results. Investing involves risk including the possible loss of principal.