What Is a Moving Average?
A moving average (MA) is a widely used indicator in technical analysis that helps smooth out price action by filtering out the “noise” from random short-term price fluctuations. It is a trend-following, or lagging, indicator because it is based on past prices.
The two basic and commonly used moving averages are the simple moving average (SMA), which is the simple average of a security over a defined number of time periods, and the exponential moving average (EMA), which gives greater weight to more recent prices. The most common applications of moving averages are to identify the trend direction, and to determine support and resistance levels. While moving averages are useful enough on their own, they also form the basis for other technical indicators such as the Moving Average Convergence Divergence (MACD).
Because we have extensive definitions and articles around specific types of moving averages, we will only define the term "moving average" generally here.
The Formulas For Moving Averages Are
Simple Moving Average:
SMA=nA1+A2+…+Anwhere:A=average in period nn=number of time periods
The simple moving average calculates the arithmetic mean of a security over a number (n) of time periods, A.
Exponential Moving Average:
EMAt=[Vt×(1+ds)]+EMAy×[1−(1+ds)]where:EMAt=EMA todayVt=Value todayEMAt=EMA todays=smoothingd=number of days
To calculate an EMA, you must first compute the simple moving average (SMA) over a particular time period. Next, you must calculate the multiplier for weighting the EMA (the smoothing), which typically follows the formula: [2 ÷ (selected time period + 1)]. So, for a 20-day moving average, the multiplier would be [2/(20+1)]= 0.0952. Then you use the smoothing factor combined with the previous EMA to arrive at the current value. The EMA therefore gives a higher weighting to recent prices, while the SMA assigns equal weighting to all values.
What Do Moving Averages Tell You?
Moving averages lag current price action because they are based on past prices; the longer the time period for the moving average, the greater the lag. Thus, a 200-day MA will have a much greater degree of lag than a 20-day MA because it contains prices for the past 200 days. The length of the moving average to use depends on the trading objectives, with shorter moving averages used for short-term trading and longer-term moving averages more suited for long-term investors. The 50-day and 200-day MAs are widely followed by investors and traders, with breaks above and below this moving average considered to be important trading signals.
Moving averages also impart important trading signals on their own, or when two averages cross over. A rising moving average indicates that the security is in an uptrend, while a declining moving average indicates that it is in a downtrend. Similarly, upward momentum is confirmed with a bullish crossover, which occurs when a short-term moving average crosses above a longer-term moving average. Downward momentum is confirmed with a bearish crossover, which occurs when a short-term moving average crosses below a longer-term moving average.
Predicting trends in the stock market is no simple process. While you can not predict what will happen exactly, you can give yourself better odds using technical analysis and research. Putting your research and technical analysis to the test in the market would require a brokerage account. Picking a broker can be frustrating due to the variety among them, but you can pick one of the best online stockbrokers to find the right platform for your needs.
Moving averages are a totally customizable indicator, which means that the user can freely choose whatever time frame they want when creating the average. The most common time periods used in moving averages are 15, 20, 30, 50, 100 and 200 days. The shorter the time span used to create the average, the more sensitive it will be to price changes. The longer the time span, the less sensitive, or more smoothed out, the average will be. There is no "right" time frame to use when setting up your moving averages. The best way to figure out which one works best for you is to experiment with a number of different time periods until you find one that fits your strategy.
- A moving average is a technique often used in technical analysis that smooths price histories by averaging daily prices over some period of time.
- Simple moving averages (SMA) takes the arithmetic mean of a given set of prices over the past number of days, for example over the previous 15, 30, 100, or 200 days.
- Exponential moving averages (EMA) uses a weighted average that gives greater weight to more recent days to make it more responsive to new information.
- When asset prices cross their moving averages, it may generate a trading signal for technical traders.
Simple vs. Exponential Moving Average
The simplest form of a moving average, appropriately known as a simple moving average (SMA), is calculated by taking the arithmetic mean of a given set of values. In other words, a set of numbers, or prices in the case of financial instruments, are added together and then divided by the number of prices in the set. The exponential moving average is a type of moving average that gives more weight to recent prices in an attempt to make it more responsive to new information. Learning the somewhat complicated equation for calculating an EMA may be unnecessary for many traders, since nearly all charting packages do the calculations for you.
Now that you have a better understanding of how the SMA and the EMA are calculated, let's take a look at how these averages differ. By looking at the calculation of the EMA, you will notice that more emphasis is placed on the recent data points, making it a type of weighted average. In the figure below, the numbers of time periods used in each average is identical (15), but the EMA responds more quickly to the changing prices. Notice how the EMA has a higher value when the price is rising, and falls faster than the SMA when the price is declining. This responsiveness is the main reason why many traders prefer to use the EMA over the SMA. (For further reading, see: Simple Vs. Exponential Moving Averages)
Example Of Calculating A Moving Average
A moving average (MA) is calculated in different ways depending on its type.
Let's look at a simple moving average (SMA) of a security with the following closing prices over 15 days:
Week 1 (5 days) – 20, 22, 24, 25, 23
Week 2 (5 days) – 26, 28, 26, 29, 27
Week 3 (5 days) – 28, 30, 27, 29, 28
A 10-day moving average would average out the closing prices for the first 10 days as the first data point. The next data point would drop the earliest price, add the price on day 11 and take the average, and so on as shown below.
Examples of Moving Average Indicators
Moving Average Convergence Divergence (MACD)
The moving average convergence divergence (MACD) is used by traders to monitor the relationship between two moving averages. It is generally calculated by subtracting a 26-day exponential moving average from a 12-day exponential moving average. (For more, see: A Primer On The MACD)
When the MACD is positive, the short-term average is located above the long-term average. This an indication of upward momentum. When the short-term average is below the long-term average, this is a sign that the momentum is downward. Many traders will also watch for a move above or below the zero line. A move above zero is a signal to buy, while a cross below zero is a signal to sell. (For more on this, read Moving Average Convergence Divergence - Part 1 and Part 2.)
Moving averages can be created for any form of data that changes frequently. It is even possible to take a moving average of a technical indicator such as the MACD. For example, a nine-period exponential moving average of the MACD values is added to the chart in Figure 1. Buy signals are generated when the value of the indicator crosses above the signal line (dotted line), while short signals are generated from a cross below the signal line. (For more, see: How are moving averages used in trading?)
A Bollinger Band® technical indicator has bands generally placed two standard deviations away from a simple moving average. In general, a move toward the upper band suggests the asset is becoming overbought, while a move close to the lower band suggests the asset is becoming oversold. Since standard deviation is used as a statistical measure of volatility, this indicator adjusts itself to market conditions. (For further reading, check out The Basics Of Bollinger Bands® and our Technical Analysis tutorial.)