The term *technical analysis* refers to a set of mathematical techniques used to analyze the price behavior of stocks and other financial instruments. The moving average is one tool used by technical analysts to help predict future prices. One type of moving average that is commonly used is the exponential moving average. Calculating the exponential moving average from a price history requires an understanding of other types of moving average.

## Simple Moving Average

The simple moving average of a stock price is the average of the end-of-day closing prices of the stock during a set number of recent trading days. A simple moving average is updated at the end of each new day, so the average moves up or down depending on the value of the new closing price. The purpose of a simple moving average is to smooth the often jagged line on a price chart to make the direction of a trend in price easier to see.

## Calculating a Simple Moving Average

You can calculate a moving average over any past period. Ten days is a period commonly used in technical analysis. In general, the longer the period, the smoother the moving average line will look on a price chart and slower the moving average line will be to react to changes in trend direction.

The following data set shows the latest 10 closing prices, in dollars, of Stock A:

{45, 46, 43, 44, 42, 41, 40, 39, 41, 40}

Calculate the first point for the simple moving average by averaging the data -- that is, adding all the values together and dividing by the total number of values.

SMA Point 1 = (45 + 46 + 43 + 44 + 42 + 41 + 40 + 39 + 41 + 40) ÷ 10 = 42.1

On a price chart of days versus closing prices, you would plot this first point of the simple moving average on the same day as the latest data point, which is $40. The simple moving average would again be calculated at the end of the next day. Since this is a 10-day moving average, you would remove the earliest day in the data set, $45, and add the latest closing price to the end. If the latest closing price was $38, the new data set and calculation would look like the following:

{46, 43, 44, 42, 41, 40, 39, 41, 40, **38**}

SMA Point 2 = (46 + 43 + 44 + 42 + 41 + 40 + 39 + 41 + 40 + **38**) ÷ 10 = 41.4

This value would be the second point on the simple moving average line. Since it is lower than the first point, the moving average would begin to suggest a downward trend in price. The calculation of a third point based on a new closing price of $36 dollars would look like this:

SMA Point 3 = (43 + 44 + 42 + 41 + 40 + 39 + 41 + 40 + 38 + **36**) ÷ 10 = 40.4

The moving average would be updated in the same manner at the end of each new trading day.

## Weighted Moving Average

A weighted moving average gives more value to certain data points than to others. An exponential moving average is an example of a weighted moving average. An exponential moving average gives more weight to the latest closing prices and less weight to the least recent prices. The theory is that all the most recent financial information has determined the latest stock prices, so these prices should have more influence on the moving average.

## Calculating an Exponential Moving Average

First, calculate the multiplier that you will use to weight the most recent stock prices. The formula for the multiplier (k) is as follows:

k = 2 ÷ (Period + 1)

For a moving average with a 10-day period, the multiplier would be calculated as follows:

k = 2 ÷ (10 + 1) = 2 ÷ 11 = 0.1818

Now that you have the multiplier for the exponential moving average you wish to calculate, you can use the overall formula to begin the calculation. The formula for an exponential moving average is as follows:

EMA = ((Current price - Previous EMA) × k) + Previous EMA

To get the first point of an exponential moving average, you can use the simple moving average of the same period. Using the first point of the simple moving average for Stock A to calculate the first point of its exponential moving average would look like the following:

EMA Point 1 = ((38 - 42.1) × 0.1818) + 42.1 = 41.35

EMA Point 1, 41.35, and SMA Point 2, 41.4, correspond in time, but notice how the EMA point is lower because the latest data point, $38, is the lowest so far and is more heavily weighted in the EMA calculation. From this point forward, you can start using the previous EMA points in the calculation of new EMA points. For Stock A, the next EMA point calculation would be based on the next day's closing price, $36, and would look like this:

EMA Point 2 = ((36 - 41.35) × 0.1818) + 41.35 = 40.38

The exponential moving average would be updated in the same manner at the end of each new trading day.