Moving Averages: The Secret Weapon of Technical Analysis

A moving average is an average of the price of an asset over a certain number of periods. The moving feature means that the average takes in the new data and discards the oldest data.

The moving average is a good indicator of trends. In stock analysis, there are 3 most commonly used moving averages: simple moving average, exponential moving average or EMA, and weighted moving average (We will explain the difference between them later with an example).

Charts showing moving averages

Moving Averages

Moving averages are used as trend indicators, as well as support and resistances. They also offer us entry and exit signals when the price crosses the moving average.

Moving averages of different time frames are usually combined:

  • Short term: between 3 and 25 periods
  • Mediumterm: between 30 and 75 periods
  • Longterm: between 100 and 250 periods

Among the most important moving averages, we find the 50 and 200-session moving averages as a reference among most investors.

By default, moving averages are calculated on the closing price, although some strategies can also be based on calculating moving averages on the opening price, maximum or minimum of the selected period (day, hour, minute…).

moving averages in forex trading

In the graph, we see a comparison of the 50-period moving average, but with 3 different approximations, and the weighted one is the one that best fits the price, being the simple one the one that is furthest away when the price fluctuates.

Simple Moving Average

The simple moving average adds the price of a certain number of periods and divides it by the number of periods chosen so that it calculates the average.

most popular moving averages

A simple 20-day moving average adds the price (closing) of an asset over the last 20 days and the result is divided by 20. This operation is updated with the incoming new data, discarding the old data, so that we will always get the simple moving average of the last 20 sessions.

Exponential Moving Average

The exponential moving average seeks to give greater importance to the most recent quotations by means of weighting or exponential smoothing. The smoothing factor is 2/(Period+1). In this way, the price series is smoothed, being able to detect the trend of the asset more clearly.

The exponential moving average, by weighting the most recent prices more, is more sensitive to changes in trend, anticipating the simple moving average and the weighted moving average.

Weighted Moving Average

Weighted moving average tries to assign progressive importance to the most recent prices compared to the oldest prices that are calculated. The goal is to smooth the price series, just like the exponential moving average, although with different weights.

This average is calculated by offering a series of weights that decrease as the price becomes older so that the last price will be the one that weighs the most and the oldest price is the one that weighs the least. The weights of the most recent data are higher than in the case of the exponential moving average.

In this way, a similar effect to the exponential moving average is achieved, since it allows us to observe the direction of its trend more clearly.

Strategies with moving averages

We can develop the following strategies with moving averages:

  • You can calculate moving averages of different periods to see if they cross each other. For example, if I have a short-term average of 25 days, and it crosses from below to above the moving average of the longest period (let's imagine 100 days), we are facing a buy signal. If the direction of the crossing were opposite, that is, from top to bottom or downward, the signal would be to sell.
  • You can also design strategies with the price chart and the moving average chart. If the price crosses the moving average upwards, it is a buy signal. On the contrary, if the crossing is downward, it is a sell signal.
  • You can use three moving averages. The one that includes more periods serves as a filter, that is, to open a buy position (bullish), this long-term average must be below the other two. Similarly, to open a sell position (bearish), the long-term average must be above the rest.

Cases of application of the strategies

Now, let's see cases where we apply two of the explained strategies: the crossing of the price over the average and the crossing of averages. It should be noted that moving averages can be optimized to calculate which number of sessions is better to obtain a higher return.

1. Price crosses the moving average (the red line is the moving average and the black line is the price)

Charts showing as Price crosses the moving average

In the graph, we can see an example of what operations would be carried out in the case of following a strategy of “price crosses the simple moving average of 20 periods“. In green, we observe the buy signals, and in red the sell signals or opening of shorts. We can see that when the market is in a lateral trend many wrong signals are offered, but when it is in a clear trend, the operation goes well.

It is important to note that, when the moving average starts to lose slope and become flat, it indicates that the trend is running out.

2. Moving average crossover

Charts showing moving average crossover

In the example, we see the crossing of an exponential moving average of 13 periods (blue) and a moving average of 70 periods (red). We can see how a long-term strategy can work well with the moving average crossover since it avoids many wrong signals. This trading system would be to buy when the blue moving average crosses from below to above the red moving average and sell when the blue crosses in descending mode the red.

3. Supports and resistances with moving averages

Graphical representation of supports and resistances with moving averages

In the graph, we can observe how the 200-session simple moving average also indicates some supports (green arrow) and resistances (red arrow).

Advantages and disadvantages of moving averages

Advantages

  • They are relatively easy to calculate (in its three types, it is about averages).
  • They allow us to identify moments of purchase and sale.
  • It allows the analyst to choose the number of observations that will be used to calculate the average.
  • It allows to combination different strategies of trading.

Disadvantages

  • They show a trend, but not the origin of it, we do not know the reasons why the asset moves.
  • Although it can be useful for trading in the short term, in the long term, the investor may be interested in analysing the fundamentals of the asset, that is, the variables that influence the movement of this. In that sense, he will probably resort to fundamental analysis.
  • It is a lagged indicator, that is, it shows the beginning or change in a trend, but does not anticipate it.
  • Moving averages are good trend indicators, but in sideways trends (which are not clearly bullish or bearish) they offer a lot of wrong and contradictory signals.

Example of moving average

Let's see a simple example of calculating the three types of moving averages:

Price of the stock XExponential moving averageSimple moving averageWeighted moving average
6,97   
5,94   
5,73   
5,73   
5,616,006,005,80
5,615,875,725,67
6,786,175,896,02
5,215,855,795,79
5,175,625,675,59
5,225,495,605,44
6,835,945,845,85
5,965,945,685,89
6,446,115,926,14
5,135,785,925,88
6,916,166,256,21
6,246,196,146,20
6,806,396,316,43
5,065,956,036,01
6,916,276,386,31
5,065,876,015,86

We then have data on the price of an asset over twenty periods. For practical reasons, we will calculate the moving averages using five periods.

The simple moving average is an arithmetic average, that is, the sum of the values between the number of data. Example:

period 5 average= (6.97+5.94+5.73+5.73+5.61)/5=5.996=6.00

Likewise, to calculate the EMA (exponential moving average) we use the simple moving average as the first data. From there, we use a smoothing factor called k.

k=2/(1+p)=2/6=0.3333

*p is the number of periods, that is, 5 in the example.

Then, we resort to the formula:

EMA of period 6= price of period 6 * k + EMA of period 5 * (1-k)

EMA of period 6= 5.61*0.3333+6*(1-0.3333)=5.87

Finally, for the weighted moving average, each data is multiplied by a number between 1 and 5, multiplying the farthest period by 1 and the closest by 5. Then, it is divided by 15 (the sum of the numbers from 1 to 5).

Example:

(1*6.97+2*5.94+3*5.73+4*5.73+5*5.61)/15=5.80

👉 Other technical indicators

FAQs

How are moving averages used in trading?

Moving averages are used to detect trends, identify support and resistance levels, and generate entry and exit signals when the price crosses the moving average. They can be combined with different time frames for better analysis.

What are the advantages of moving averages?

Moving averages help identify trends by smoothing short-term fluctuations, generating trading signals in financial markets, reducing noise in the data and offering simplicity and flexibility in analysis across different time frames.

What are the disadvantages of moving averages?

Moving averages can lag behind real-time data, which can delay responses in rapidly changing markets. They can also oversimplify market trends, overlooking short-term fluctuations and nuances.

Related Articles