# How to Trade the MACD: A High-level Analysis of the MACD Line Feature

**Moving Average Convergence Divergence (MACD) is one of the most popular technical indicators used by traders.**

It is a flexible indicator that can be used for determining the strength and direction of a trend. It has three distinct features and in this first post we are going to do a high-level analysis of one of those features, the MACD Line.

We will compare three of the most common MACD Line settings on the EUR/USD using daily bars over the past few years to determine whether or not there is a historical pattern that can be exploited.

### What is the MACD Line?

The MACD Line was the first feature developed in the MACD indicator. It was developed around 1977 by Gerald Appel. The other two features are the MACD Signal Line, a smoothed average of the MACD Line, and the MACD Histogram, which is the difference between the Signal Line and the MACD Line.

The MACD Line is composed of a fast and slow moving average. The value of the MACD Line is the difference between the two moving averages. The default settings for the two moving averages are typically 12-period (fast) and 26-period (slow) exponential moving averages and are generally calculated off of the close price of an asset. Using the MACD Line is the exact same as using a moving average cross. If you subtract the price of a fast-period moving average from the price of a slow-period moving average, you will get the value of the MACD Line. Gerald Appel also commonly uses default periods of 19- and 39-period EMAs while Tom Aspray, who added the histogram feature and studied the MACD in the 1980s commonly uses 10- and 20-period EMAs.

Gerald Appel claims, “As a general rule of thumb, the market climate is most unfavorable when the MACD is falling and below zero.” We’ll take the latter part of his rule of thumb to form our hypothesis; it is unfavorable to go long when the MACD Line is below 0 and it is unfavorable to go short when the MACD Line is above 0.

Using TRAIDE we can test exactly how favorable and unfavorable the market is when the MACD Line is above and below zero; We will try to find values of the MACD Line that lead to bullish and bearish moves the following day by looking at every trading day between August 1st, 2012 and March 24, 2015.

### MACD Line (12, 26-Period EMAs) Analysis

TRAIDE automatically generates a histogram of the empirical data to display the distribution of the MACD Line values over our date range. The histogram will show how many of the next days’ bars closed up and how many closed down for every MACD Line value over our date range.

To create the histogram, we will first select the asset we want to analyze, the timeframe and date range. We then select the MACD Line feature under the MACD indicator group in the middle column of TRAIDE’s Strategy Creation page. We can ignore the “Signal Moving Average Type” and “Signal Period” in the indicator settings because we are not using the MACD Signal feature.

Let’s click analyze and look at the distribution.

**y-axis:**The number of trades, or trading days, between 08/01/2012 and 03/24/2015.**x-axis:**The values of the MACD Line, ranging from -0.026 to 0.018.**Dividing lines on x-axis:**This is the width of a “bin”. There are 10 bins and the edges of the bins are labeled. For example, -0.022 to -0.018 is one bin.**Red bars:**The height of red bars represents the number of trading days where the following day was bearish, or the close was lower than the open, in any particular bin.**Green bars:**The height of green bars represents the number trading days where the following day was bullish, or the close was higher than the open. in any particular bin.**Shading of the bars:**We won’t be using the shading, but this is the strength of signal for that bin. Darker green means that the algorithms found strong signals to go long and darker red bars means that TRAIDE’s algorithms found strong signals for going short.

Using our distribution, let’s test our hypothesis.

The first step is to remove the ambiguous information. The red and green bars in bin -0.002 (-20 pips) to 0.002 (20 pips) straddle the zero line; we don’t know whether the next day closed up or down since we cannot distinguish between the trades that occurred right around zero.

The next step is to click all of the green bars above 0.002 and all of the red bars below -0.002 and see what the accuracy is in our statistics table for each case. When we select the green bars, we are going long for all positive values of the MACD Line above 0.002 and going short for all negative values below -0.002. We want to see if just this simple rule will lead to over 50% of our trades being correct.

What we find is that when the MACD Line is positive, the price on the next day tends to close higher than the previous bar’s close and when the MACD Line is negative, the price on the following day tends to close below the current day’s close. There were 640 trades in our sample.

It turns out that our hypothesis is true. There is a historical pattern; when the MACD Line is negative (less than -0.002), the next day is bearish 52% of the time and presents an unfavorable condition to go long. When the MACD Line is positive (greater than 0.002), the next day is bullish 54% of the time, presenting an unfavorable condition for going short.

Let’s dive in a little bit deeper and see if we can refine our MACD Line values. From the distribution, it looks like the tail ends of the histograms don’t present a clear historical pattern while the histogram bars on either side of the -0.002 to 0.002 bin appear to have a clear pattern.

### Finding the Best Values for Long or Short (MACD Line (12, 26))

On the days where the MACD Line is greater than 0.002, but less than 0.006, the next day was bullish 58% of the time with 183 total trades. In other words, when the 12-period EMA is between 20 and 60 pips above the 26-period EMA the next day closed up 58% of the time. On the days where the MACD Line was less than -0.002 but greater than -0.006, the next day was bearish 52% of the time. We went from a sample size of 640 trades to 380.

You can use this information to not go long when the MACD Line is between 0.002 and 0.006 or if you are going long, check to see if the MACD Line is within that range. The same goes for going short but with the negative MACD Line values. You could also use this information for the basis of a strategy. Waiting for the MACD Line, with 12- and 26-period EMAs, to be between 0.002 and 0.006 would be a good first filter for going long. I would recommend adding a couple other indicators that you like using. Let’s take a look at the other commonly used settings.

### MACD Line (19, 39-Period EMAs) Analysis

Changing the defaults to use 19- and 39-period EMAs in TRAIDE:

Once I hit analyze, the distribution will load on the Dashboard:

The two longer EMAs have caused a slight skew left. Let’s apply the same logic that we did in with the 12- and 26-period EMAs to do our analysis. Let’s remove the ambiguous data where the bin could be positive or negative. This takes out the bin -0.0021 to 0.0021. Then let’s select all the green bars to the right of 0.0021 and all the red bars to the left of -0.0021.

Again what we find is that our hypothesis holds to be true; when the MACD Line is positive (above 0.0021), the following day had a 53% chance of closing higher than the previous day’s close. When the MACD Line is negative, the EUR/USD had a 52% chance of closing lower than the previous day’s close.

Looking at the histogram, there appears to be a very similar pattern to our 12- and 26-period settings so let’s take a look and see if we can refine the MACD Line values.

### Finding the Best Values for Long or Short (MACD Line (19, 39))

If we click just the bars on either side of the -0.0021 to 0.0021 bin, we can see that 53% of the time, the following day closed lower than the previous day’s close when the MACD Line was negative (below -0.0021) while 54% of the time the next day’s close was higher than the previous day’s close when the MACD Line is positive (above 0.0021).

We found similar results, but the 12- and 26-period EMAs found a stronger pattern for going long, while the 19- and 39-period EMAs led to a slightly strong pattern for going short. Now let’s take a look at our final MACD Line settings; the 10 and 20-period EMAs.

### MACD Line (10, 20-Period EMAs) Analysis

We find something very similar when we use 10 and 20-period EMAs. 54% of the time, when the MACD Line is positive (above 0.0017) the following day closed above the previous day’s close. 52% of the time, when the MACD Line is negative (below -0.0017) the following day closed below the previous day’s close. Our sample size is 630.

Applying the same process as the other two MACD Line parameters, we will see if the values that are just positive and just negative lead to a stronger historical pattern.

### Finding the Best Values for Long or Short (MACD Line (10, 20))

It appears so! Once again, selecting the bin to go short where the MACD Line is less than -0.0017 but greater than -0.0051 gave us 177 days where the following day closed lower than the previous day’s close 57% of the time. Selecting the bin to go long, where the MACD Line is greater than 0.0017 but less than 0.0051 gave us 194 days where the following day closed high than the previous day’s close. 54% of the time.

### Summary

The MACD Line, using commonly used settings, is a reliable feature of the MACD indicator for determining whether or not it is favorable to go long or short on the EUR/USD using 1-day bars. I would suggest combining this feature with other indicators, using the MACD Line as a filter, or using it to confirm your trading decision. If you are applying this to other currency pairs or timeframes, make sure you study the MACD Line over those charts. Difference pairs and timeframes are going to behave in their own way.

A table of our results with the percent correct with each of the indicator settings:

We can also conclude that the different period settings that we tested do not have a significant impact on whether or not the MACD Line can be used to determine whether or not the market is favorable or unfavorable for going long or short. What did have a significant impact was removing the tail ends of our histograms. Instead, when the MACD Line was just positive or just negative, our accuracy went of significantly for both long and short.

For all three indicator settings, it was better when we refined our parameters by selecting the bins where the MACD Line was just positive or just negative:

A table of our results with the percent correct with each of the indicator settings:

It appears that the shorter EMAs, 10 and 20-period, returned the highest accuracy.

This high-level analysis on the empirical data of the EUR/USD using 1-day bars provides a good starting point for incorporating the MACD into your trading. The MACD Line is a reliable feature of the MACD indicator where we can find clear historical patterns.

You can generate these histograms in TRAIDE for any major currency on 1-hour, 4-hour, 6-hour, or 1-day bars since January 1st, 2012.

— by Justin Cahoon from Inovancetech Blog.

1:02 pm

Hi! Thanks for the detailed analysis. Quick question: since you’re comparing the close of the following day to the close of the signal day, this would require the trader to know the MACD value before the actual close. Or rather, see a likely set up and then compute a close and buy with a limit order. Is it possible to pre-compute the MACD values and the corresponding close ahead of time? Or is this a “future leak”?

Would it be difficult to instead run the stats for the one-day open/close G/L after the signal day instead? This is probably a more practical way to trade for most people.

Thanks!

8:12 pm

Hi Matt,

The MACD is actually being calculated on the open price of the current day. So we are asking, “Given the MACD value at today’s open price, does the day close higher or lower than the open?”

TRAIDE assumes the only information we know is the information given at the open of the bar, so we make our prediction at the open, wait 24 hours, and see if we are correct at the close. This ensures we are not looking into the future.

To display the same data in MT4 or Tradestation you could change the default MACD Line settings to be calculated off the open rather than the default close price.

11:39 am

I agree with Matt. Don’t matter where the macd is calculated, one cannot act on that particular point. If it is calculated at the open, then the macd value is not available at the open. When do you trade? Statistics isn’t trading. There are multiple issues with this article:

1) No commission discussed or pip spread for forex trades.

2) Do you calculate the macd at the bid or ask?

3) Profit factors are borderline random values (1.1, 1.2)

4) Author thinks descriptive statistics can facilitate prediction without discussing significance levels.

5) The trading strategy is not clear.

6) The author suggests combining this “strategy” with other not realizing that the joined distributions will change.

Overall, I am sorry to say that this is not an article that lives up to standards of this website and it can only hurt its traffic and popularity. This is constructive criticism for the author and the website owner. It doesn’t appear that the author has a clear concept of what a trading system is. What he described is not a trading system but a way to teach histograms to students.

12:00 pm

Hi Bob,

I’ve seen a few comments over the last several months about articles “not living up to the standards of this website.” I haven’t made note of who has been leaving them but I caught you on this one and I think it’s misguided.

It’s good for us to be able to critique an article and point out its flaws. That checks and strengthens our understanding of trading system development methodology. If a guest blogger is selling a system/product that is bogus then the best exposure possible would be from your critical analysis.

I certainly don’t think it is up to Jeff to maintain a definitive standard for this website. If a submission is excessively nonsensical or blatantly wrong in many ways then he should probably reject it but we never read anything like that here so he’s doing a fine job.

Finally, I think it’s absurd for you to talk about hurting website traffic and popularity. I appreciate Jeff for inviting guest bloggers from different backgrounds to share their perspectives here. I also appreciate the pinpoint accuracy of critical analysis when it is most needed.

6:53 am

“Finally, I think it’s absurd for you to talk about hurting website traffic and popularity. ”

Really? Look at the number of comments? Only one excluding yours, mine and the authors. This is because what the author described is not a trading method but some esoteric statistical analysis hardly related to trading. You are denying the facts with your comment. Either you get the message or not. if you attack the messenger, the consequences will become clear soon.

11:20 am

Bob–

Views: 1027.

That’s all you need to know.