What Is Moving Average?

Monday, December 12, 2011
One type of indicator which you'll see time and again as you are learning about Forex is the moving average (MA). Moving averages are lagging indicators—this means they don't predict price direction, but rather are calculated from past prices. There are four popularly used types of moving averages: Simple, Exponential, Weighted, and Smoothed. You will rarely see Weighted moving averages used in Forex, but we'll go over them anyway. Most traders prefer to stick with Simple and Exponential moving averages. The default is to calculate moving averages using closing prices, but you can also choose to calculate using High, Low, Open, Median, Typical, and Weighted prices. You'll be able to choose how to calculate your moving averages in your charting platform, unless you wish to calculate them manually.

Let's start with simple moving averages (SMA). A simple moving average is calculated by adding up the most recent N number of prices and then dividing that sum by N. What is "N"? It's called a period of moving average and you can set it in your charting software. It can take any positive integer value from 1 to infinity. It indicates how many days (or hours, or weeks, or any other chosen periods of time) you’ll be adding up. The general formula for calculating the simple moving average for a given moment of time is:

SMA = (P0 + P1 + ... + PN-1) / N

For example, you chose 5 as the number of days (period), and the Close prices for those are (from oldest to most recent): 1.3345, 1.3348, 1.3350, 1.3374 and 1.3325. Then the simple moving average can be calculated as:

SMA = (1.3325 + 1.3374 + 1.3350 + 1.3348 + 1.3345) / 5 = 1.33484

With an exponential moving average (EMA), the calculation is more or less the same, but the difference is that exponentially less weight is given to the older data. This is done to reduce lag. Here's a general formula to calculate the EMA:

EMA = EMAprev + alpha * (price - EMAprev)

Which means that the EMA for today is calculated based on the EMA value yesterday, today's price and the special multiplier α, which can be anything from 0 to 1 (the higher it is, the sharper is the exponential decline of the weight of the older data). In Forex, α for exponential moving averages is usually calculated as 2 / (N + 1), where N is the period of the MA.

For example, we have the same data and period as in the above example for SMA. Let's calculate α:

α = 2 / (5 + 1) = ~0.33

The EMA of the first day is considered equal to the price of that day:

EMA1 = 1.3345

EMA2 = 1.3345 + 0.33 × (1.3348 - 1.3345) = 1.3346

EMA3 = 1.3346 + 0.33 × (1.3350 - 1.3346) = 1.33473

EMA4 = 1.33473 + 0.33 × (1.3374 - 1.33473) = 1.33561

EMA5 = 1.33561 + 0.33 × (1.3325 - 1.33561) = 1.33458

As you see, it's quite different from the result obtained using the simple moving average calculation.

A weighted moving average (WMA) is similar, except that in the case of an EMA, the weight given to each older point of data decreases exponentially. In the case of a weighted moving average, the weight decreases incrementally. In general case the WMA is calculated as follows:

WMA = (n * P0 - (n - 1) * P1 + ... + PN-1) / (n + (n - 1) + ... + 1)

If, for example, we choose the same data and period as in the examples above, we'll get the following result for the weighted moving average:

WMA = (5 × 1.3325 + 4 × 1.3374 + 3 × 1.3350 + 2 × 1.3348 + 1 × 1.3345) / (5 + 4 + 3 + 2 + 1) = 1.33475

Once again, the result is somewhat different from both SMA and EMA.

A smoothed moving average (SMMA) is like a mix of a simple moving average and an exponential moving average. In general, it's calculated the same way as the EMA except that the multiplier α = 1 / N:

SMMA = SMMAprev + alpha * (price - SMMAprev)

Consider the same example with the same 5 pieces of data. Let's calculate the multiplier:

α = 1 / 5 = 0.2

The SMMA of the first day is taken as the price of that day:

SMMA1 = 1.3345

SMMA2 = 1.3345 + 0.2 × (1.3348 - 1.3345) = 1.33456

SMMA3 = 1.33456 + 0.2 × (1.3350 - 1.33456) = 1.33465

SMMA4 = 1.33465 + 0.2 × (1.3374 - 1.33465) = 1.3352

SMMA5 = 1.3352 + 0.2 × (1.3325 - 1.3352) = 1.33466

Although it's different from all of three previous variants of the MA, as you see, it's closer to the result obtained with the EMA calculation.

The nice thing about charting software is that you don't have to learn all these formulas; your charting platform will do your calculations for you. All you have to do is choose the periods you want to calculate the moving averages across and let the software display them for you. Here is a MetaTrader chart of the daily GBP/USD showing all four types of moving averages applied to the close for a period of 14:

4 Moving Averages: Simple, Exponential, Weighted, Smoothed

Simple Moving Average: Red
Exponential Moving Average: Blue
Weighted Moving Average: Green
Smoothed Moving Average: Orange

As you can see in the chart, exponential and weighted moving averages are faster than simple moving averages, and smoothed moving averages are the slowest of all. The longer the period of any moving average, the greater the lag will be.

What can you do with moving averages? Most people who trade moving averages use them either to provide context for other systems or on their own in crossover systems. Moving averages tend to act as support and resistance levels; a lot of people like to place a slower moving average and a faster moving average on their chart, and then wait for the faster moving average to cross under or over the slower one. This can indicate an opportunity to sell or buy respectively. But one should also remember that moving average is not some magic trading tool and it will often fail.

If you have any questions or want to share some useful info regarding various types of moving averages, please feel free to reply using the commentary link below.