A moving average is an indicator of the average change in the price of an asset over a certain period. On a chart, a moving average is a curve that has intersection points with the price chart. This indicator is widely used in technical analysis of trading operations on Forex and stock exchanges.
Today we will learn how to calculate points to construct a moving average, what formula is used for this, and how the obtained values are used in practice.
What is a moving average
I think everyone has an idea of what a price chart looks like. This is a chart built, as a rule, in the form of Japanese candlesticks like this:
Green color indicates rising prices (bullish trend). The opening level of such a candle is located at the bottom, and the closing level, accordingly, is at the top.
Red color indicates a fall in quotes (bearish trend). With levels, everything is the other way around - opening at the top, closing at the bottom.
The tails above and below the candles are indicators of the price rebound at the opening or closing of the trading session. The longer the tail, the greater the deviation. If a green candlestick has a long tail on top, it means that the bullish trend is at risk of changing to a bearish one as the price closed close to the low.
Chart reading skills come with experience. To begin with, it is enough to roughly imagine the main parameters that I outlined above.
So, another line is added to such a chart, which we are talking about today. It might look something like this:
This curve is needed to display average price deviations and smooth out the so-called “noise” caused by short-term fluctuations.
To make it more clear how moving average construction points are calculated in technical analysis, I will give a simple example.
Let's say we have 10 candles for a one-day chart. Prices have the following meanings:
20 18 16 18 15 21 17 25 23 21
We find their arithmetic mean and get the first point:
(20+18+16+18+15+21+17+25+23+21)/10=19,4.
Next, a new trading day comes and a new candle appears with mark 14. Thus, the first number from the series is discarded, and a new value is added in its place. Let's do the calculation:
(18+16+18+15+21+17+25+23+21+14)/10=18.8. This will be the second point on the graph.
Curves are built automatically. They show how the price deviation corresponds to the trend and serve as a signal to buy or sell. If the moving average price line is directed upward, you need to buy; if it is downward, this is a signal to sell.
Settings in the MT4 terminal (smoothing, method - construction algorithm)
MT4 (MetaTrader4) is a terminal that offers users a choice of not only moving average indicators, but also other services.
You need to open the settings window in the Insert/Indicators/Trend/Moving Averages tab. The system will prompt you to select the period and type of curve. It is possible to shift the curve to the right of the price chart by the number of candles set by the client.
The price type is also selected.
There are several options for this:
- main values: opening price (Open), closing price (Close), highest (High) and lowest (Low);
- arithmetic averages: Median Price (from 2 extreme values), Typical Price (High, Low and closing price), Weighted Close (calculated from 4 options).
The default settings are Close. It is recommended for a novice trader to leave them unchanged so as not to complicate the construction of the chart.
The style (color, thickness, etc.) is selected at the user's discretion.
Chart intervals (which one to choose: daily, hourly, minute)
When choosing a period, you need to take into account that the longer it is, the less sensitive the moving averages will be. On the other hand, the established parameters will have a greater impact than the time period. Therefore, it is recommended to stick to the default settings from the program developer.
The calculation of the time period (timeframe) is also based on how detailed the moving average picture should be.
If the TF is M5 (5 minutes) or M15, period 21 is considered effective. In this case, the reaction to changes in candles will be quick. In a strong trend, resistance and support lines will work.
For the average TF (H1, i.e. hourly), choose a value of 50. For daily and weekly (D1 and W1), a period of 100 is recommended. 200 and 250 are suitable for TFs starting from D1. This indicator works as a moving chart filter, removing too fast changes in candles in the market.
Sliding speed - how to use it (example)
To assess the true state of things, they use more than just one chart of the average - this indicator gives signals with a delay. Therefore, support, resistance, etc. lines are sometimes connected as a confirmation of instrument signals.
A speed less than 20 increases the speed of response to changes in candles. However, this leads to many false signals.
If you use the method of constructing a moving chart at a higher speed, the series will smooth out. In this case, few entry opportunities are formed.
For example, a trader plots a short-term and long-term curve and waits for a signal when a crossover occurs. However, without the use of other confirmatory tools, there is no guarantee that the system will respond on time, and not after the price changes.
Basic signals given by the indicator
I will list the main points that you should pay attention to when initially analyzing a chart using the moving average method:
The following line directions serve as a signal to buy:
- the curve goes up;
- the curve crosses the trend line from bottom to top (rapid growth of quotes);
- MA turned from bottom to top with a growing trend.
And for sellers the signals are:
- the line goes down;
- MA crosses the trend line from top to bottom (quick drop in quotes);
- The MA turned from top to bottom in a downward trend.
Types and parameters
MA lines are also classified into types depending on their use in technical trading analysis:
- MA to determine momentum (direction and rate of change in quotes). Usually, several curves constructed based on calculations for different periods are plotted on a graph and how similar they behave is compared. With strong momentum (rapid price growth), the lines on the chart are located one below the other and have the same direction. If the curves intersect with each other and the trend line, the price changes slightly.
- MA lined up as a support level. We remember that the support level is the minimum below which the price should not fall in a certain time period (time frame). The curve is drawn based on historical lows. When it is located below the trend line, a perpendicular is drawn from the minimum acceptable value. At the point of its intersection with the MA, a stop loss is set.
- MA, built as a resistance level for setting a stop loss in an uptrend.
Trading Strategies Based on Moving Averages
Now let’s figure out how to use the indicator in practice. I will give several popular trading strategies developed using Moving Average.
Strategy based on the direction of movement of the MA
The main purpose of the MA curve is to smooth the chart and eliminate noise caused by random market fluctuations.
This simplest strategy was already mentioned when we talked about basic indicator signals. If the quote chart is above the MA, which is directed upward, this indicates an upward (bullish) trend.
If, on the contrary, the price chart is located below the MA going down, this indicates a downward (bearish) trend.
Strategy based on moving average crossovers
For greater calculation accuracy, use a strategy based on the intersection of fast and slow MA. A fast curve is one with a shorter period. She reacts sensitively to the slightest changes. A slow line, on the contrary, is less sensitive to random fluctuations.
When these lines intersect, the trader makes a decision depending on the direction of movement of the curves:
- the fast MA crosses the slow MA from bottom to top - you need to buy. If both lines are directed upward, this is additional confirmation of an uptrend;
- the fast line crosses the slow one from top to bottom - a downward trend, a signal to sell. Both downward lines enhance this signal.
Strategy based on the intersection of the MA with the price chart
The intersection location determines the direction of the trend. If the price chart crosses the MA, as a rule, this means that the trend has changed.
Calculation methods: formulas
Moving averages are constructed using different formulas.
SMA
To calculate, the sum of the closing prices of each bar for the selected periods is taken and divided by their number.
SMA = SUM (CLOSE(i), N) / N, where:
- SUM - sum;
- CLOSE (i) — price at the time of closing of the current period;
- N is the number of periods.
If the price has changed significantly several times within the period, this is not taken into account. All fluctuations in quotes are equivalent, regardless of amplitude.
SMA is quite easy to plot, which is why most traders use this indicator.
EMA
This indicator is calculated by adding to the previous value the average share of the closing price in effect at the time the calculation is made.
EMA = (CLOSE (i) x P) + (EMA (i - 1) x (1 - P)), where:
- EMA (i - 1) - indicator value for the previous period;
- P is the share of the price value.
EMA more accurately characterizes the current state of the market compared to SMA.
The EMA indicator reacts faster to market changes.
SMMA
The formula for a smoothed curve is two-part. To get the final value, you must first perform the calculation on the previous bar, and then sum this result with the data for the current period.
SMMA (i) = (SMMA (i - 1) x (N - 1) + CLOSE (i)) / N, where:
- SMMA (i - 1) - smoothed curve of the previous bar;
- N is the smoothing period.
The SMMA reflects the prevailing trend in the market and complements the trading strategy using support and resistance levels.
LWMA
The principle on which the LWMA formula is based is similar to SMA. But the most important in the calculation are recent quotes.
LWMA = SUM (CLOSE (i) x i, N) / SUM (i, N), where:
- SUM (i, N) - sum of specific gravity coefficients;
- N is the period.
The LWMA indicator is smoothed to a lesser extent than the SMA and SMMA.
To calculate LWMA, the order of calculation from last to first is important.
Flaws
I will list the main disadvantages of the moving average method in trading that need to be taken into account:
- Signal lag from real time. If the period of time during which a trader can earn money is short, then you may simply not have time to complete the desired transaction.
- With significant fluctuations in closing prices, the SMA and WMA values are distorted. Here's an example. We have a 20 week moving average chart. At the same time, closing prices differ on average by 20–30 points, but there are a couple of weeks when the spread is 60–80 points. By the end of the period, quotes will return to normal and the SMA will decrease, but this will not reflect the real situation. In this regard, the use of EMA provides more relevant information, because this curve is based on more recent data.
- The intersection of the MA with the price chart occurs when the event has already happened. Forecasts of changes in quotes using this method are not reliable.
- When there are a large number of intraday trading transactions, the moving average method is not suitable because it is impossible to apply one result to different categories of transactions.
Nuances that need to be taken into account when working with MA
In order to get the maximum benefit from this indicator and at the same time not expect the impossible from it, when working with it you need to take into account a number of nuances:
- First of all, you should always be aware that moving averages do not lead the market, but follow it. Accordingly, the signals received on their basis always lag relative to the moment the market begins to move (and the longer the MA period, the greater this lag);
- If during the trading process you see that the indicator has come into contact with the price chart, then do not draw hasty conclusions from this. The fact is that although the indicator itself cannot be redrawn, its “tip” is constantly in motion, acquiring its final form only after the next candle closes;
- The MA indicator itself does not represent a ready-made trading strategy; you should not trade based only on its signals. But in combination with other tools (including other technical analysis indicators), it can become a reliable trader’s assistant;
- Moving averages can be used as a dynamic support/resistance level. To do this, depending on the current price volatility, select a MA period such that most of it is below the price (for a support line) or above the price (when used as a resistance line);
The last point implies the possibility of using the MA to set STOP LOSS levels as a good alternative to a trailing stop. To automate this process, you can use a script or trading robot. Stops can be moved following the price at a short distance from the moving average, thus ensuring that they are triggered only in cases where the price really radically changes the vector of its development.
Examples
This is what moving averages look like on a 5-minute chart of the S&P500 futures.
The lines are indicated by colors:
- SMA – red;
- EMA – blue;
- WMA – green.
Now let’s look at a chart that shows two MA lines – fast (indicated in blue) and slow (indicated in red):
Signal to open a short position: the fast MA crosses the slow one from top to bottom.
Signal to open a long position: the fast MA crosses the slow MA from bottom to top.
And this is an example of placing a stop order for a long position, where the MA is used as a support level. As you can see, the stop loss is placed under the moving average (indicated by the red dotted line with the number 3). And the blue line with the number 2 is the entry into the transaction after the rebound from the support level.