# Moving Average

Moving average indicators show the average value of another indicator, such as price, over a period of time. Because they are averages, they don’t react as quickly as the indicator itself. This allows you to spot trends, and smooth out short-term anomalies.

Moving averages can be applied to any time-series data, including the following:

• Opening and closing prices
• Highest and lowest prices
• Other forex indicators
• Moving averages – giving a double moving average
There are four types of moving average:
• SMA – the simple or arithmetic moving average
• EMA – the exponential moving average
• SMMA – the smoothed moving average
• LWMA – the linear weighted moving average

Generally, all moving averages give similar results. However, exponential moving averages and linear weighted moving averages give more weight to recent data intervals.

The most common way of using a moving average is to compare it to the actual price of an instrument:

• Buy when the price rises above its moving average
• Sell when the price drops below its moving average

This approach doesn’t let you buy and sell at market lows and highs; the buy and sell signals lag behind the price peaks and troughs.

When a moving average is applied to other indicators, the interpretation is similar to that for price:

• The indicator is likely to go up if it rises above its moving average
• It’s likely to go down if it falls below its moving average

#### Simple moving average (SMA) calculation

The SMA is the average of a value over a number of time intervals. The example below shows how the SMA is calculated for a closing price.

SMA = SUM( CLOSE( J ), N ) / N

CLOSE is the closing price in an interval

J is the interval number

N is the number of intervals used for averaging

#### Exponential moving average (EMA) calculation

The EMA for an interval is calculated by combining the current interval value with the EMA of the previous interval. For example, the EMA could be 20% of the current interval value plus 80% of the previous EMA. This approach gives more weight to recent values; the EMA is made up of 20% of the current value, 16% of the previous value, 12.8% of the one before that, and so on.

The example below shows how the SMA is calculated for a closing price.

EMA( J ) = ( CLOSE( J ) * P ) + ( EMA( J – 1 ) * ( 100% – P ) )

CLOSE is the closing price in an interval

J is the current interval

P is the percentage of the current interval value that is used to calculate the EMA

#### Smoothed simple moving average (SMMA) calculation

The SMMA is based on the SMA, but gives a smoother plot. The first interval value is simply the SMA for that interval. Subsequent SMMA values are calculated using the previous SMMA and the current indicator value. If there are N intervals, the current value is added to N times the previous SMA, and the total is divided by N.

The following example shows the SMMA calculation for a closing price.

SMMA( 1 ) = SMA( CLOSE( J ), N )

SMMA( J ) = ( ( SMMA( J – 1 ) * ( N – 1 ) ) + CLOSE( J ) ) / N

CLOSE is the closing price in an interval

J is the current interval

N is the number of intervals used for averaging

#### Linear weighted moving average (LWMA) calculation

The LWMA allows additional weight to be given to more recent data. It does this by giving a specific weight to each interval. For example, the current interval could have a weight of 20, the previous interval a weight of 14 and so on. The value is calculated by multiplying each interval value by its corresponding weight, adding up the results and dividing by the sum of all the weights.

The example below shows how the SMA is calculated for a closing price.

LWMA = SUM( CLOSE ( J ) * W ( J ), N ) / SUM ( W( J ), N )

CLOSE is the closing price in an interval

J is the interval number

N is the number of intervals used

W is the weighting factor for an interval

You can find more information about technical indicators in the MetaTrader 4 User Guide. Select Help > Help Topics > Analytics > Technical Indicators.