Moving averages are a technical indicator that show how the price has moved, on average, over a certain period of time. Moving averages are 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 which can help show which direction the price is moving.

### Simple Moving Average Calculation

The simple moving average (SMA) is an average of the last n prices, where n is the number of periods you want the average of.

- (P1 + P2 + P3 + P4 + ... + Pn) / n

A 4-period simple moving average with prices of 1.2640, 1.2641, 1.2642, and 1.2641 would give a moving average of 1.2641 using the calculation (1.2640 + 1.2641 + 1.2642 + 1.2641) / 4 = 1.2641

Luckily trading and chart platforms calculate all this for us. All a trader needs to do is select the indicator, apply it to their chart and adjust the settings to their liking.

The advantage of a simple moving average is that you know exactly what you are getting. The SMA value is the average price for the number of bars in the SMA calculation.

8, 20, 50, 100 and 200 are commonly used SMA periods. For example, if using a 100-period SMA, the current value of the SMA shown on your chart will be the average price over the last 100 periods (price bars).

The attached chart shows a 50-period SMA, along with the Exponential and Weighted Moving Averages on a 1-minute stock chart.

Notice how the calculations cause the lines to look quite different, even though they are all based on the last 50 periods.

### 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.

- [Close - previous EMA] x (2 / n+1) + previous EMA

A 4-period EMA with prices of 1.5554, 1.5555, 1.5558, and 1.5560 would give an EMA value of 1.5558 using the calculation [1.556 - 1.5558] x (2/5) + 1.5558 = 1.55588

Luckily trading and chart platforms calculate all this for us. All a trader needs to do is select the indicator, apply it to their chart and adjust the settings to their liking.

The EMA adapts quicker to changing prices than the SMA. This is because the EMA applies more weight to recent prices, and less weight to prices that occurred in the past.

### Weighted Moving Average Calculation

The weighted moving average (WMA) is a weighted average of the last n prices, where the weighting decreases with each previous price.

- (Price X weighting factor) + (Price previous period X weighting factor-1)....

WMAs can have different weights assigned based on how many periods are being looking at. If there are four prices you want a weighed moving average of, then the most recent weighting could be 4/10, the period before could have a weight of 3/10, the period prior to that could have a weighting of 2/10, and so on. 10 is a randomly picked number, and a weight of 4/10 means the most recent price will account for 40% of the value of the WMA, while the price four three periods ago only accounts of 10% of the WMA value.

Assume prices of 90, 89, 88, 89:

((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

The weighed moving average is very customizable in that you can assign the weights you want to more recent data. More recent price points are usually given more weight, but it could also work the other way--where historical prices are given more weight.

### Moving Average Trading Uses

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

For analysis, a moving average (whichever type) helps 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 (the n in the moving average). That helps confirm an uptrend. When the price is below its moving average it 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 it shows the price is getting stronger relative to where it was, and if the price crosses below its moving average it shows the price is getting weaker relative to where it was.

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

Moving averages can also be incorporated with other indicators to provide trade signals. For example, an exponential moving average can provide buy signals when combined with Keltner Channels.

### Final Word on Simple, Exponential and Weighted Moving Averages

One type of moving average isn't better than other; they just analyze the price differently. Depending on your strategy, one type of moving average may work better for you. Try out different combinations of moving averages 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 period SMA may provide great signals on one stock, but doesn't on another. Or a 20-period EMA may really help you isolate the trend on one futures contract, but not another. How we personally interpret an indicator is far more important that the settings it uses, because no indicator works well all the time, and in all market conditions.