Moving averages are one of the most widely used technical indicators.In fact, this indicator is often shown by default on many trading charts. The Drixx exchange, for example, includes moving averages in its default layout. Moving averages are not only used for smoothing out trading data, but also for identifying potential trends (or trend changes). In this article, we will take an in-depth look at moving averages, how they are calculated, and some simple strategies that might be employed.
First and foremost, the moving average indicator is considered a "lagged" filter in statistics. This means that it considers previous values (in addition to the current one) to smooth out the data. Because price data can be very volatile, moving averages can be used to look at the underlying trend.
20, 100 and 200-day-moving averages for BTCUSD - Source: Trading View
We draw the 20-, 100-, and 200-day moving averages for BTC/USD. Daily moving averages are often referred to the DMA
We see that while the price series of crypto like BTC can be highly volatile, the moving average lines are much smoother. Longer time-period moving averages tend to lag more and might not detect changes in overall trend quickly. Shorter time-period moving averages lag less and detect sudden trend changes. However, they are prone to giving false positives.
We see this effect better in the below chart, which is a snapshot of BTCUSD in 2019:
20-DMA, 100-DMA and 200 DMA comparison for BTCUSD - Source: TradingView
We see that the slower, longer-term 200 DMA (in yellow) only bottomed in mid-May 2019 (after the rally was in full force). It topped out in December 2019 (after the market had already dropped).
We see that the 100 DMA (teal) detected the upwards trend earlier (bottoming out in March 2019) before topping out in October 2019 (after the first substantial drop).
Finally, we see that the 20 DMA is much more volatile,making multiple peaks and troughs between June and September of 2019 (resulting in many false positives!).
Note that while we are using daily closes to generate the moving averages, any time interval can be used. For example, you could generate100 data-point moving averages on hourly data.
In a later section, we will look at some simple moving-average based strategies that a long-term trader can employ. But before that, let us go over how moving averages are calculated.
The moving average technical indicator essentially takes a rolling "average" of some data points over some fixed period. There are two main moving averages that market practitioners normally look at: the simple moving average (also known as the SMA) and the exponential moving average(known as the EMA).
Example -- 5-Period SMA
The 5-Period SMA on Feb 28 is (45,137 + 46,188 + 46,339 + 47,093 + 49,705)/ 5 = 46,892.4
EMA Smoothing Factor formula
For the first data point, we can just use the closing price P0.
Unlike the SMA, the weights of the EMA are exponential. If we expand out the recursive relation, we see that the weight on each term is α (1-α)^n, where n = the number of periods before the current period at t.
For example, we can see that with an α = 0.5. The weighting at t (current period)is 0.5 * (1-0.5)^0 = 0.5. The weight of the 5th data point 0.5 *(1-0.5)^5 = 0.015625 (approximately 1.6%)
Using the formula above, we have α = 1/3.
Example -- 5-Period EMA
Because our short data-series starts from Feb 14, the first EMA (5) is just the closing price on Feb 14. The last EMA (5) on Feb 28 is 1/3 * 45,138 + 2/3 * 46,188 = 47034.86
We illustrate the differences between the EMA and SMA in the chart below. Specifically, we see that for a SMA (100) in red versus a EMA (100) in blue, the EMA adjusted to the increases in price much quicker as the price went up (and vice versa).
Differences between the EMA and SMA Illustration - Source: Trading View
Overall, though, depending on the time frame and period you are using, either the SMA or MA can be used. There is no "best" moving average or period parameter. A trader should experiment with the period and type of moving average that is best suited for their trading style.
Often, combinations of moving averages are used as indicators for entering and exiting trades. One such indicator is the moving average crossover.
Essentially, the moving average crossover indicator can be built from two moving averages with different periods.
Let A = the period of a shorter moving average (smaller N)
Let B = the period of a longer moving average (larger N)
SMA Crossover (A, B) = SMA (A) -- SMA (B),which we will call SMAC (A, B)
EMA Crossover (A, B) = EMA (A) -- EMA (B), which we will call EMAC (A, B)
Effectively, we are taking the results of a shorter period moving average and subtracting out the longer period moving average. Let us say, for example, that the current SMA (5) is 40,000 and the SMA (20) is 53,000. Then the SMA Crossover (5, 20) is -13,000
We can interpret this indicator as checking whether the short-term MA is above or below the longer-term MA. If the shorter-term MA is above the longer-term one, then that indicates a potential upwards reversal in the trend. On the other hand, if the short-term MA is below (or crosses below)the long-term MA, that indicates a negative trend. This indicator is a decent way to detect bottoms or tops in the trends systemically (without needing to look at the chart visually).
One simple strategy with this indicator is to be long when the trend is positive and short when the trend is negative. To determine if a trend is positive or negative, we can look at the SMA Crossover Indicator.
For example, if we use a SMAC (7, 20), we will choose to belong when SMA (7) is above SMA (20).
How have different combinations of SMAC parameters performed over time? We test 6 different variations (using BTC data starting from April 2015).
Returns - Buy and Hold and SMAC Strategy
Drixx Example - Returns - Buy and Hold and SMAC Strategy
We see that relative to simply buying and holding, most SMAC-based strategies using a 7 DMA as the shorter moving average out-performed buy and hold. Specifically, the SMAC (7, 100) not only returned nearly 52% more over 6 years than buy and hold, but it also suffered significantly smaller draw downs. The smaller drawdowns could mean that a trader of this strategy could slightly lever up their position without being wiped out.
Moving averages are a powerful tool for both discretionary and systematic traders. They filter incoming noisy data and can be used to determine trends. The two most common forms of moving averages are the simple moving average and the exponential moving average. These averages (with different period parameters) can be used to build the crossover indicator.