Last Updated on 24 November, 2021 by Samuelsson
MACD was created by Gerald Appel in the late seventies. In his book “understanding MACD (Moving average Convergence Divergence), he further clarified his concept. Today it’s a trading indicator that’s relied upon by many traders.
MACD is an oscillating momentum indicator that tries to capture the momentum in the market and point out favorable entries and exits. It does so by turning two trend-following elements – two exponential moving averages – into a momentum oscillator. This is done by subtracting the shorter moving average from the longer moving average. The result can then be used to assess the direction and strength of market movements, as well as to point out potential turning points.
In this guide, we will cover everything you need to know about the MACD indicator and how it’s used. Let’s begin with the basics!
MACD Basics and Definition
In order to be able to use the MACD efficiently, you need to be aware of its different parts, and how they are interpreted.
Let’s dig a little deeper into how MACD works. It consists not only of two previously mentioned moving averages but also a few more components. These are:
1. The MACD Line
The MACD line is what we referred to at the beginning of the article, and is the difference between the longer period and the shorter period exponential moving averages. Later in the article, we will discuss how you should go about picking the best parameters. However, the default parameters for the moving averages are:
- 26 for the long moving average
- 12 for the short moving average
So, for example, if there suddenly is a burst of upwards movement, the shorter-term average would move away to the upside from the longer-term average. Since the MACD line is calculated by subtracting the shorter-term average from the longer average, the MACD line would rise in such a scenario.
2. Signal Line
The signal line simply is a lagging MACD line, and as you will see later, crossovers between the MACD line and the Signal line are often used as reversal signals.
To get the signal line, you apply an exponential moving average to the MACD line. The signal line acts to smooth the MACD line, and is plotted as a red line in the image below. As you will see later, traders may use crossovers between the signal line and MACD line as entry signals.
The default setting for the exponential moving average is 9.
Because the relationship between the signal line and the MACD line is so important, the difference between the two is often calculated with a histogram. The histogram shows the difference between the MACD and the signal line, and is calculated by subtracting the signal line from the MACD line.
4. The Base Line (Zero Line)
The baseline, also called the zero-line, is a line that can be drawn where the MACD reading shifts from positive to negative. In the image below, you can see how the histogram turns from green to red, after having crossed the zero line.
How to Calculate MACD
MACD is the difference between the long term EMA (typically 26 periods) and short term EMA ( typically 12 periods). The formulae representation for MACD is as following.
- EMA is the exponential moving average,
- T denotes a time period
- N represents window bandwidth
- Pt is the price at closing period.
How Do You Interpret MACD?
As you can see above, the signal line, which is red, is below the MACD line when there is a rising trend in the indicator. This is due to the fact the signal line is a moving average, and therefore always will be lagging the MACD line. Once the MACD line turns down, the signal line will follow slightly thereafter and find itself above the MACD line. This is again because of the lagging nature of a moving average.
In the image above, the function of the histogram as a measurement of the distance between the MACD line and the signal line becomes clear. Whenever there is a falling trend in the indicator, the histogram shows negative readings. Conversely, whenever there is a rising trend, the histogram will show positive readings.
Baseline and its impact on the signal
Another aspect of the MACD is the baseline and its impact on the signal. Typically, a bullish signal that is effectuated below the baseline is given more weight than one occurring above. Conversely, a bearish signal is given more weight if it occurs above the baseline.
This is because a trend reversal is thought to be more likely to occur when the security has moved in one direction for some time. Thus, when the MACD line is below zero, price has been trending down for enough time for a trend reversal to be likely, and the other way around.
Basic MACD signals
Let’s now have a closer look at some of the most common signals that traders usually look for, when using the Moving Average Directional Index
MACD Moving Average Crossover
Moving average crossovers is one of the most common concepts in technical analysis. For example, the death cross and golden cross, are two examples of moving average crossovers that are closely watched by many market participants.
When looking for MACD crossovers, you have to pay attention to where they are occurring. A bearish crossover in the positive regions is more significant than one in the negative regions. Contrarily, a bullish crossover in the negative region is more significant than one in positive regions.
This has to do with what we’ve touched on previously, namely mean reversion. For a reversal signal to be significant we want the market to already have traveled a significant distance to become oversold or overbought before we take the signal. For a bearish signal, this means that the higher up in the positive territory that the crossover occurs, the better the odds, and the other way around for a bullish signal.
In the image below you see a bearish crossover high up in the positive territory of the MACD indicator, followed by a bullish crossover in negative territory.
Some traders will choose to take the signal as soon as the MACD line turns around. However, most traders tend to wait for the confirming cross above the signal line before entering a position in order to avoid false positives.
False positives happen when a bearish run in the market is preceded by a small price rise, that in turn also makes the MACD line rise for a short time. In the image below, a false positive is marked with an arrow:
Bearish and Bullish Divergences
A divergence happens when the MACD forms consecutive highs or lows that diverge with the corresponding highs or lows in the price.
Just like crossovers, divergences can also be either bullish or bearish. A bullish divergence, as shown in the image below, appears when the MACD makes two rising lows along with falling lows in the price. Please refer to the image below and compare the price line with the MACD line. You can see that the two higher lows correspond with two falling lows in the price chart.
On the other hand, a bearish divergence happens when the MACD forms two falling highs along with two rising highs in the price chart.
Both bearish and bullish divergences often signal a long-term price reversal. This means that when MACD and price lines are in divergence, then the investor should expect a long term price reversal in the price of an asset.
As is the case with crossovers, a bullish signal below the baseline should traditionally be given more weight than a signal above the baseline.
Distance Between Signal Line and MACD Line
The MACD indicator could be used to determine when a security is oversold or overbought.
Overbought means that security has moved too much to the upside, and oversold that it has fallen excessively.
The goal of identifying oversold and overbought regions is to find out when it’s time to enter a trade, in anticipation of the reversion of the trend. This type of strategy falls under “mean reversion” which is the tendency of the markets to revert to there mean, once having performed exaggerated moves to one side.
MACD could help us define these overbought and oversold regions, and give us clues about when the market is likely to turn around.
One promising way of doing this is to watch the histogram. As we’ve covered previously, the histogram shows the distance from the MACD line to the signal line. If this distance is increasing, it means that the market is increasing its speed of movement. If the histogram grows too long, we might want to consider the market overbought/oversold, and take a position against the short term market trend.
Here is an example:
In the image above you see two examples of how the histogram grew, indicating an increase in momentum, which successfully managed to define oversold and overbought territory.
Timing the Entry
However, as you might realize, it is hard to know when the reversal is coming. A security can remain oversold or overbought for a long time, which might make you want to combine the above readings with additional entry timing techniques, such as candlesticks. In the image you actually see how a doji, which is a reversal candlestick, appeared right at the top, signaling the imminent reversal of the market.
Here you can read more about candlesticks!
Later in the article, we will also discuss some methods of filtering out bad trades and improve the accuracy of trading systems that use MACD.
Breaking the Baseline (Zero Crossover)
When MACD crosses the baseline, it basically means that we have had a moving average crossover. If you still remember, the MACD line is the difference between the short term moving average and the long term moving average. If it’s zero, it means that both moving averages show the same reading.
Even though moving average crossovers probably have played out their role, this remains a key concept for the MACD indicator. Below you see several highlighted zero crossovers.
Now that we have covered the basic MACD signals, let’s move on to MACD strategies!
MACD Trading Strategies
When it comes to trading strategies, there are as many variations of strategies as there are traders. You can come up with endless variations on the same idea that make use of market edges in new, exciting ways. If you’re lucky, you might very well stumble upon a variation that has a real edge to it, meaning that it can be used to make money in the markets.
Now, if you go to other sites that teach about indicators and technical analysis, you will see a lot of “trading strategies”, that actually don’t work at all. Nearly every trading site that you go to, will present concepts that seem theoretically sound and ensure that these are trading strategies that you can use to make money.
If trading was as easy as following their made-up examples, everybody would easily be able to make money. But as you probably understand, that’s not the case! Very few make it, and those who do, struggle to keep up with the ever-changing markets.
Below, we will present a range of the most common trading strategies that exist on the web, not because we believe in them, but for the sake of completeness, and that we won’t rank in Google otherwise!
In case you don’t want to read about strategies that probably don’t work, we suggest that you read our article on how we build a trading strategy. If you ever want to succeed in trading, you must learn how to backtest and create your own trading strategies!
Now, if you know how to create a trading strategy, these strategies below can certainly serve as inspiration for building your own trading strategies!
So let’s have a look at them!
1. Rapid Rise and Fall
Rapid rise and fall could be a good indication of a security being overbought or oversold, and could, therefore, serve as an entry signal against the short term trend.
A rapid rise happens when the MACD rises or falls suddenly, meaning that the short term moving average deviates sharply from the long term moving average. This condition leads us to assume that the security is either oversold or overbought, depending on if the MACD is in positive or negative territory. In other words, this is a form of mean reversion signal.
The image below shows the rapid rise and fall. Two times, you see how the MACD line deviates from the Signal line, and how that is followed by a reversion back to the signal line.
To make the signal easier to spot, we also have included the RSI indicator below the MACD indicator, which shows an overbought reading as well.
As you see, once we spotted that the MACD line is too far from the signal line, there was a reversion of the trend.
However, one of the difficulties with mean reversion strategies is that a security can remain oversold for a long time, and continue into even more extreme readings. This requires quite a large stop loss, since you don’t want to get stopped out of every trade, especially since the edge increases the more the price moves against you.
In order to better time the exits, you could look to use additional conditions, which we will have a closer look at under ” Improving MACD Strategies”
2. MACD and Stochastic Trading Strategy
As you know from this article, MACD crosses are used widely to try to find favorable trading entries. Often they are used to point out a reversal of the trend, which can be quite tricky, and prone to giving false signals.
In the search for entries like this, it might be good to add another indicator to the mix. That way, we might succeed to increase the accuracy of the entry signals, and get a better trading system.
The Stochastic Indicator
One indicator that is quite well known, is the stochastic indicator. Stochastic is an indicator that measures and compares the price of a security to the prices over a selected period of time. Doing so, it outputs the %K-line, from which then a moving average is derived, creating the %D line.
In other words, the stochastic, just like the MACD, has two lines which can create signal crossovers. In other words, we might use the crossover of the Stochastic indicator to confirm a MACD crossover.
However, in addition to this, we might want to add one more condition, to ensure that we have a true edge.
The third component will be a bullish divergence in the stochastic indicator. A bullish stochastic divergence is when the price is making new lows, while the stochastic at the same time performs higher lows.
To sum it up, our strategy now consists of the following parts:
- The MACD bullish crossover
- A stochastic bullish crossover
- A bullish divergence in the Stochastic indicator
So let’s now see what this looks like in a chart.
At the top, we see the price chart, in the middle the MACD, and in the bottom, we have the Stochastic. As you see, the Stochastic performs a higher low, while the price of the security performs a slightly lower or equal low. This is is our bullish divergence.
In the image, we also see the benefit of using two indicators together. While the stochastic got whipsawed with a lot of false crossover signals, the MACD remained unaffected. Once both the indicators gave us an entry signal, that proved to be much more accurate
To exit a trade, you might want to look at getting out of the trade as soon as the stochastic goes over a certain threshold. That way, you remain in the trade until the market has reverted to the mean, and instead is moving into overbought territory.
3. Using MACD with RSI
The typical application of the RSI indicator is to spot oversold and overbought conditions. In other words, we might use the RSI as we did with the Stochastic, to confirm a reversal of the short term trend.
However the RSI lacks a lagging signal line, so that’s why we will have to just rely on the overbought and oversold thresholds for the indicator. Typically, these are 70 for overbought, and 30 for oversold.
However, we have found that the 14 day period doesn’t work very well, so we will use a 5 day RSI instead. That means that we will have to adjust our threshold values to 20 for oversold conditions, and 80 for overbought conditions.
So, now in order to go long on a signal, we want the RSI to come from below 20, before we take a MACD crossover signal. Then, for the exit, we’ll get out of the trade when the RSI crosses 80. This is what a signal could look like:
Above you see how the RSI came from below 20, and how the MACD cross confirmed the imminent swing to the upside! Then when the RSI crosses above 80, we get out of the trade.
4. MACD with EMA
Another way of trying to confirm that a crossover in the MACD indicator is true, could be to use an exponential moving average. Doing so, we ensure that the market already is in an uptrend before we take on any position. And as we know, the “trend is your friend” which means that a rising exponential moving average should play to our advantage.
When taking a trade with this strategy, we want the 100-period EMA to be rising, and the MACD crossover to occur in negative territory. That way we ensure that we have a rising trend, where there has been a pullback worth catching. We may then exit the trade after 10- number of days, regardless of whether we are in profit or not. That way we make sure to not lock in our capital in a trade for too long, since it can make us money better elsewhere.
Now that we have covered a couple of MACD strategies, we will look at how we can improve MACD strategies that we buid.
Improving MACD Strategies
As always when building strategies, with or without MACD, you want to start with the raw idea and improve on it by adding some filters. Since this article is about MACD, this raw idea could, for instance, be any of the basic MACD signals that we’ve covered, such as:
- Bullish or bearish Divergences
- Breaking the zero line
- Distance from signal line to MACD line.
- or any variation thereof
In this part of the article, we thought that we would give some examples of what we experiment with in terms of filters when we build our own strategies.
While the price chart shows you what the market is doing in terms of movements, volume provides more clues about the conviction of the market at any given time.
Adding volume to your trading, like with any other market sentiment data feeds, is like adding a second dimension to your trading. With some strategies, it can help a lot with filtering out bad trades, whereas it might not add any value at all with other strategies.
One of the easiest ways of using volume is to look for bottoms and peaks. For instance, if the market is performing a breakout, you might want to know how much of the market that did support the move. In that case, you could look for spikes in volume, like in the image below.
Continuing on the theme of moving averages, we can conclude that they don’t just work well for volume, but also with normal price data. With their smoothening traits that come from averaging all the price points, they make it easier to point out the trend direction and could help when building MACD strategies.
Here are a couple of ways you could use moving averages to improve a MACD strategy.
- Require the close to be above or below the MA – This approach is commonly used with the 200-day MA, where a close above the MA is considered a sign of a bullish market, and vice versa.
- Require a shorter average to be above or under a longer moving average- This approach is quite similar to the first one, but since it involves a second short term average, the results often are quite different.
- The slope of the moving average- The slope of the MA provides a lot information about the strength of the trend. A steep slope indicates a strong trend, and vice versa. In addition to that, you could choose to take a trade only if the moving average is sloping in the desired direction.
One thing that many traders don’t think of, is that there are many more types of moving averages than the simple moving average. In our testing, we have found that the exponential moving average seems to work better for many strategies
In our article on moving averages, we take a closer look at different types of MA’s and how to use them!
When trading smaller timeframes, you get a lot of noise. To help with this, you might want to apply a second timeframe to separate the noise from the signals. For example, you might choose to add a daily chart to your intraday chart.
Then you just test conditions on the second time frame as you would on the primary timeframe.
Which Are the Best MACD Settings?
Many traders ask for the best settings for a particular indicator or trading strategy. However, trading isn’t so easy that there is a universally applicable answer. Instead, the best settings for a strategy will depend on things like timeframe, strategy type, and which market you are trading.
This means that there is no definite answer to the question. So what should you do?
Well, first we’d recommend that you try some different settings, and try to gauge the impact of parameter changes on the chart, preferably with many years of history. Just looking at the last year or so won’t suffice. The best thing you can do is to backtest the strategy over many years of data!
Backtesting means that you run a historical test, to see what settings or conditions that worked best. In other words, you are making a more informed decision that is more probable to lead to settings that yield better results. However, backtesting isn’t as easy as just clicking a button, and then use whatever comes out as the best value. There are many pitfalls you may run into!
If you want to learn more about backtesting, we recommend that you read or guide to backtesting!
Advantages of MACD
The MACD indicator is easy to read both for new and experienced traders, and could, if used right, add some valuable information to your analysis of the markets. With its MACD line, consisting of the difference between two moving averages, you get an indicator that takes into consideration both the short term and long term trends in the market.
Drawbacks of MACD
Some people argue that the moving average crossover is an old remnant from a time before computerized trading, and much less efficient markets. We agree, and can confirm that this is the case. Moving average crossovers don’t work by themselves anymore.
Since the MACD indicator relies quite heavily on crossovers (zero line crossovers) to give its signal, this could adversely impact its performance. As we know from the beginning of the article, MACD was invented in the late 1970s. This was a time when a moving average crossover could have worked. However, already at that time its effectiveness was suffering from the ever-growing list of institutional and retail traders who were gaining access to computerized systems and trading indicators.
This major drawback of the MACD, of course, applies to other trading indicators as well. But perhaps MACD is hit the hardest, since the moving average crossover is among one of the easiest patterns to spot, and has become so incredibly popular!
MACD Vs RSI
While the Moving Average Convergence indicator measures the divergence of two moving averages, the RSI is a little different. The RSI aims to spot overbought and oversold regions by calculating the average price gains and losses for the given period of time, and then outputs a value between 0 to 100. When the RSI is over 70 it’s traditionally considered to be overbought, and when it’s under 30, the market is considered oversold.
While most people use RSI for mean reversion, it works very well as a momentum indicator too.
As you might understand from their calculation, these indicators measure two different things. The RSI is concerned with the relation between price gains and losses for the given period, while MACD just looks for the divergence between the two moving averages that are part of its calculation. This means that these two indicators might give you different signals. So which should you trust if that’s the case?
Well, we have much better experience with the RSI indicator than with the MACD indicator. There are some simple RSI strategies that work remarkably well, as we lay out in our article on swing trading strategies. However, we have not found many useful edges or market tendencies using the MACD indicator.
MACD is an indicator that uses the difference between two moving averages and outputs it in the form of the MACD line. The second component, which is the signal line, is the moving average of the MACD line. Together, these two lines can form crossovers, which can be used to gain clues about when a market reversal is imminent.
In our testing, we’ve had limited success with the MACD, and believe that there are better indicators, like the RSI, that you probably should focus on instead if you are new to the markets.