### Description

Moving averages are usually used to show the mean price over a certain number of previous prices. For example, a 10 bar simple moving average of the close would show the mean closing price from the most recent 10 bars. Moving averages can also be applied to other data such as volume or other indicators, but are most commonly used with prices. There are several different types of moving averages, and they are all calculated slightly differently, but they all have a similar smoothing effect on the data, so that any unexpected price changes are removed, and the overall direction is shown more clearly.

### Calculations

Some of the most popular moving averages are:

**Simple Moving Average**

**Description:**The simple moving average is simply the average of the last n prices.

**Calculation:**(P1 + P2 + P3 + P4 + ... + Pn) / n

**Example:**A 4 bar 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

**Exponential Moving Average**

**Description:**The exponential moving average is a weighted average of the last n prices, where the weighting decreases exponentially with each previous price.

**Calculation:**EMAn-1 + ((2 / (n + 1)) * (Pn - EMAn-1))

**Example:**A 4 bar exponential moving average with prices of 1.5554, 1.5555, 1.5558, and 1.5560 would give a moving average of 1.5558 using the calculation 1.5556 + ((2 / (4 + 1)) * (1.5560 - 1.5556)) = 1.5558

**Weighted Moving Average**

**Description:**The weighted moving average is a weighted average of the last n prices, where the weighting decreases by 1 with each previous price.

**Calculation:**((n * Pn) + ((n - 1) * Pn-1) + ((n - 2) * Pn-2) + ... ((n - (n - 1)) * Pn-(n-1)) / (n + (n - 1) + ... + (n - (n - 1)))

**Example:**A 4 bar weighted moving average with prices of 1.2900, 1.2900, 1.2903, and 1.2904 would give a moving average of 1.2903 using the calculation ((4 * 1.2904) + (3 * 1.2903) + (2 * 1.2900) + (1 * 1.2900)) / (4 + 3 + 2+ 1) = 1.2903

### Trading Use

Moving averages can be used to identify a trend by using the slope of the average (or lack of slope in a ranging market). They can also be used in trend trading systems to enter and exit trades by waiting for price and moving average crossovers, or for multiple moving average crossovers. Moving averages are also used in the calculations of many other indicators, such as the Moving Average Convergence Divergence (MACD), and the Commodity Channel Index (CCI).