Home

How to Calculate Exponential Moving Average in Trading

|
|  Updated:  
2016-03-26 13:53:24
|   From The Book:  
No items found.
AI Investing For Dummies
Explore Book
Buy On Amazon

A commonly used trading indicator is the exponential moving average (EMA), which can be superimposed on a bar chart in the same manner as an SMA. The EMA is also used as the basis for other indicators, such as the MACD (moving average convergence divergence) indicator.

Although the calculation for an EMA looks a bit daunting, in practice it’s simple. In fact, it’s easier to calculate than an SMA, and besides, your charting package will do it for you. Here are the calculations:

EMA [today] = (Price [today] x K) + (EMA [yesterday] x (1 – K))

Where:

K = 2 ÷(N + 1)
N = the length of the EMA
Price [today] = the current closing price
EMA [yesterday] = the previous EMA value
EMA [today] = the current EMA value

The start of the calculation is handled in one of two ways. You can either begin by creating a simple average of the first fixed number (N) of periods and use that value to seed the EMA calculation, or you can use the first data point (typically the closing price) as the seed and then calculate the EMA from that point forward. Traders handle it both ways.

It’s the method used in calculating the EMA amounts, which shows a nine-day EMA calculation for Intel throughout May 2008. The EMA value for May 1 is seeded with that day’s closing price of $22.81. The actual EMA calculation begins with the May 2 closing price.

For comparison, here is an SMA calculation to illustrate the difference between an EMA and an SMA.

Date Close EMA SMA
5/1/2008 22.81 22.81
5/2/2008 23.09 22.87
5/5/2008 22.91 22.87
5/6/2008 23.23 22.95
5/7/2008 22.83 22.92
5/8/2008 23.05 22.95
5/9/2008 23.02 22.96
5/12/2008 23.29 23.03
5/13/2008 23.41 23.10 23.07
5/14/2008 23.49 23.18 23.15
5/15/2008 24.60 23.47 23.31
5/16/2008 24.63 23.70 23.51
5/19/2008 24.51 23.86 23.65
5/20/2008 23.73 23.83 23.75
5/21/2008 23.31 23.73 23.78
5/22/2008 23.53 23.69 23.83
5/23/2008 23.06 23.56 23.81
5/27/2008 23.25 23.50 23.79
5/28/2008 23.12 23.42 23.75
5/29/2008 22.80 23.30 23.55
5/30/2008 22.84 23.21 23.35

In this example, the EMA doesn’t show the same nine-day lag at the beginning of the chart as the SMA. Notice that the results of the moving-average calculations also differ. The EMA data is shown as a solid dark line. For comparison, the SMA data is also plotted using a lighter line.

[Credit: Chart courtesy of StockCharts.com]
Credit: Chart courtesy of StockCharts.com

Good news! You don’t have to do this calculation yourself. StockCharts.com can automatically calculate it for you. You’ll find the exponential moving average as one of the overlays in Chart Attributes. You select the type of overlay you want, such as Moving Avg (exp), and then you put in the number of periods. The exponential moving average line is automatically generated on your chart.

About This Article

This article is from the book: 

No items found.

About the book author:

Michael Griffis became an active trader in the mid 1980s. He first traded commodities and precious metals after taking a commodities trading class as part of his MBA program at Rollins College. He became a stockbroker in 1992, where he helped businesses and individuals manage investments in stocks, bonds, mutual funds, retirement plans, 401(k) employee-savings plans, and asset management programs. Michael is an author and business owner and has written about stock trading for online audiences.

Lita Epstein, who earned her MBA from Emory University's Goizueta Business School, enjoys helping people develop good financial, investing, and tax planning skills. She designs and teaches online courses and has written more than 20 books, including Bookkeeping For Dummies and Reading Financial Reports For Dummies, both published by Wiley.