This chart was created using TradingView (affiliate link)
Moving averages are a commonly used tool for technical analysis. They are one of the simplest indicators to use and understand. They smooth out the price data making it easier to identify the trend. Simple Moving Average (SMA) and the Exponential Moving Average (EMA) are the two most popular types of moving averages.
They are not intended to predict price movements but rather outline the current direction. Since they’re based on past prices, there is some expected lag.
Nevertheless, moving averages help cut through the noise, allowing traders to spot developing trends or possible support and resistance levels.
Calculation of the Simple Moving Average
A simple moving average is created by adding up price data from a specific period of time and dividing it by the number of days used.
Moving averages are most commonly based on closing prices. A 20-day moving average is the sum of the closing prices divided by 20. The moving average changes or “moves” with each new closing price.
As each day passes it drops the closing price data from the oldest day and adds the newly available closing price. The example below illustrates how a 5-day moving average is calculated.
Closing prices: 15, 16, 15, 13, 12
15+16+15+13+12 = 71 ÷ 5 = 14.2
As each day passes the last closing price is dropped and
the most recent closing price is added.
New closing prices: 16, 15, 13, 12, 11
16+15+13+12+11 = 67 ÷ 5 = 13.4
You can see in this example that the moving average goes down after dropping the old closing price and implementing the new price. The closing prices on the previous days are higher causing the moving average to lag.
Calculation of the Exponential Moving Average
Exponential moving averages place more weight on the most recent data. This helps to reduce lag and makes it follow prices closer than a simple moving average. The EMA will require more data in order to be accurate.
To calculate the exponential moving average, you will need to first calculate the simple moving average. The SMA is used as the initial EMA value. The next step is to calculate the weighting multiplier also known as the smoothing constant.
The smoothing constant formula is 2 ÷ (time periods +1). Once you have that information, you will input the data in the EMA formula. The EMA formula is (closing price – previous day’s) x weighted multiplier + previous day’s EMA.
Below is an example showing how a 5-day EMA is calculated, which uses the most recent closing price and the 5-day SMA from the last example.
Initial SMA: 13.4
Weighted Multiplier: 2÷(5+1) = 0.3333
EMA Formula: (11-13.4) x 0.3333 + 13.4
EMA = 12.60
The more data used, the more accurate the EMA. Luckily, we have computers that can calculate years’ worth of data for us. So no, you probably won’t have to manually calculate a moving average.
However, it is important to understand how it’s calculated. Otherwise, you won’t exactly know what’s influencing the direction.
Time Frames and Lag
Long moving averages are slow
A 100-day moving average requires much longer and larger price movements to change direction.
The chart above shows just how close a 5-day EMA will follow price movements. You can also see the difference in lag when you look at longer time frames like the 50-day and 100-day EMA.
- 5 to 10-Day Moving Average (5MA & 10MA) – This time frame is extremely short and mostly used for very short-term day trading.
- 20-Day Moving Average (20MA) – Still a short-term outlook usually used for day trading or short-term trades.
- 50-Day Moving Average (50MA) – Shows a short- to medium-term outlook.
- 100-day Moving Average (100MA) – used for analyzing more intermediate to long-term trends.
- 200-day Moving Average (200MA) – this time frame is commonly used for a long-term outlook.
The most frequently used time frames are the 50, 100 and 200-day. Simply put, short-term moving averages are used for short-term trading and long-term moving averages are used for long-term trading.
Simple vs Exponential Moving
The exponential moving average is more reactive to price movements because it places more emphasis on recent data. This makes the EMA quicker to reflect price action and can provide more accurate results than the SMA.
Due to these differences, the exponential moving average is usually preferred over the simple moving average.
When choosing which one to use it comes down to your trading style, personal preference, and objectives. There are cases where a simple moving average may be a better choice, like if you are trying to identify support and resistance levels.
Using an SMA can also protect you from getting caught in a fake movement because it’s a bit slower to react.
Trading With Moving Averages
The main use of moving averages is to identify trends. When a moving average is consistently rising along with prices, that is an indication of an uptrend. In a strong long-term uptrend, the 20MA will be below the price and above the 50MA, the 50MA will be above the 200MA.
When a security is in a downtrend the moving average will steadily fall along with prices. In a strong long-term downtrend, the price will be below the 20MA, the 20MA will be below the 50MA and the 50MA will be below the 200MA.
When the different moving averages are out of place it could mean a pullback is coming or prices are consolidating.
Price and moving average crossovers can be used to produce signals. A bullish signal is created when the price goes above the moving average. A bearish signal is created when the price goes below the moving average.
Two famous moving average crossovers are the “Golden Cross” and the “Death Cross.” A bullish signal is created when a shorter moving average like the 50MA crosses above a longer moving average like the 200MA. This is sometimes referred to as a “Golden Cross.”
A bearish signal is created when a shorter moving average like the 50MA crosses below a longer moving average like the 200MA. That is usually referred to as a “Death Cross.”
These indicators are somewhat rare and you can generally expect the signal to hold true, however just like most technical indicators they’re not always correct.
Support and Resistance:
Another way to trade with moving averages is to use them for support and resistance lines. In a downtrend, a moving average can become a line of resistance.
In an uptrend, a moving average can be a line of support. For example, a 20- or 50-day average may act as support in a short-term uptrend and can turn into resistance in a downtrend.
Moving averages are most useful during strongly defined up or down trends and can be rendered ineffective during consolidation or a sideways movement.
You can sometimes receive conflicting signals and will need to use your best judgment when deciding to act on them or not. Moving averages are best used in conjunction with other technical/fundamental indicators and data.
Many chartists use both simple and exponential moving averages to identify long- and short-term trends. They are an essential part of technical analysis and trend trading strategies.