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.

Contributing authors are active participants in the financial markets and fully engrossed in technical or quantitative analysis. They desire to share their stories, insights and discovers on System Trader Success and hope to make you a better system trader. Contact us if you would like to be a contributing author and share your message with the world.

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.

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.

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.

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.

“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.

I would greatly appreciate if you comment upon following strategy– THIS METHOD INVOLVES TRADING WITH THE TREND WITH ENTRY ON INTRADAY MEAN REVERSION REVERSALS ONLY WHEN THERE IS INTRADAY SPIKES IN VOLATILITY.TRADES LAST NO MORE THAN FEW DAYS.HIGH TURNOVER HELPS WITH STATISTICAL EDGE WITH IN BROWNIAN MOVEMENTS. Daily charts are used to determine market direction. There are days when volatility increases intraday— but we just do not know when. Those are the days when mean reversion has higher chance of making $$. This method works better in cross currencies which have better & longer trends compared to pairs which have U.S. Dollar in the pair. To control draw downs we only trade in the direction of the trend. Let us say for discussion that british pound cross currencies are trading up (GBP/JPY, GBP/AUD, GBP/CHF ect) Daily pip range for GBP/AUD presently is 140 pips(as of April 14,2018) Over thousands of runs one can state that GBP/AUD has daily range of 140 pips—70 pips up & 70 pips down from opening price. But on any given day anything can happen. Since trend is up. We only trade long. Everyday around 5PM EST ,we put order to buy GBP/AUD as limit order 100 pips below opening price with take profit 50 pips & stop loss of 50 pips on the same ticket. We let the market close the position either at profit or at a loss—no human intervention. Only one open order in each cross currency at any given time. This distance of 100 pips can be adjusted up/down based on volatility, balance in the account & number of open positions already in account. Next day again new orders are entered based on the then current prices in different cross pairs. Unfilled orders get cancelled at the end of every day. Similar orders are put in daily in several cross pairs to spread the risk. Since daily pip range for GBP/Aud is 70 pips up or down, volatility has to increase before buy order gets executed—and that is the day when mean reversion has higher chance of making money. Since buy limit order & stop loss are on the same side of market price, chances are higher for buy order to get executed compared to stop loss getting hit. Every thing is on the same ticket—so when take profit is hit, stop loss order no longer exists. How much more often market would travel distance of 100 pips (D1)compared to distance of 150 pips(D2) in the same time interval(t) , can be roughly computed as follows based on random motion( distance travelled is proportional to square root of time intervals— option formulas) 150 X 150/100 X 100 which is— 3×3/2×2 =2.25 . This means out of 3.25 runs we win 2.25 times & lose one time & THAT IS THE MATHEMAICAL EDGE. Trading with the trend gives additional mathematical edge above & beyond this number which cannot be computed but is common sense.. We already know that in up market, corrective moves are shallow & that controls draw downs during that day—risk control is there on every ticket order with stop loss. No playing around with any ticket—win or lose. Trading with the trend gives additional mathematical edge above & beyond this number. Each position lasts only couple of days.There is also built in stability if trader mixes up good number of cross currencies. If Australian dollar goes up, pairs where Australian dollar is second entity(GBP/AUD,EUR/AUD) go down but pairs where Australian dollar is first Item go up(AUD/CAD,AUD/CHF,AUD/NZD).This balances fluctuations in equity/draw downs. Similar other orders are entered in other cross currencies in the direction of the trend of that pair. If trend is not clear, no order in that pair & select another pair with trend. No orders in pairs with U.S. dollar in the pair. I thank you for all your help. Respectfully Submitted, Prem Nath M.D. Email INDUS68@GMAIL.COM