I've compiled a comprehensive breakdown table of the MACD chart patterns. This covers every conceivable pattern on a bar to bar move MACD patterns are listed from strongest price strength on top to weakest price strength at the bottom. You'll find this is true regardless of interval length (5, 15, 30, 60, D, W, etc.). I've also listed entry strategies and expected trade duration based on the daily bar.

Note that I've listed more bullish patterns than bearish, and the relative strength when compared to the Primary Trend which I've based on the 50/200EMAs.

For automated trading, you need a mathematical model and a strategy in mathematical terms. This next table provides basis for defining the mathematical terms for the conditions of entry and exit. So, there are only two rules that govern the entries and exits.

For the entry, rather than check each bullish pattern (A-I) one at a time, I've colorized the tests that would give the same result. Same for the exits.

So, in StrategyDesk, the Boolean logic formula for this entry strategy would look like this.

( { MACD Strength Long Entry} MACD[Diff,Close,12,26,9,D,0,$COMPX] >= MACD[Diff,Close,12,26,9,D,1,$COMPX] OR ( MACD[Diff,Close,12,26,9,D,0,$COMPX] >= 0 AND MACD[Signal,Close,12,26,9,D,0,$COMPX] >= 0 AND ExpMovingAverage[EMA,Close,50,0,D,1,$COMPX] >= ExpMovingAverage[EMA,Close,200,0,D,1,$COMPX] ) )

For the exit, you'd might think you could just reverse ">=" operators, but it's not that simple, and if you had, you'd miss some patterns

As a side note: StrategyDesk only has two logical operators, AND and OR. It would be nice if it had the NOT logical operator. If it had, you could just place the NOT in front of the entry formula, like this…

NOT (entry formula)

In StrategyDesk, you can build a logical NOT like this..

(entry formula + 1) = 1

because, if conditions of the entry formula are met, 1+ 1 = 1 is false, otherwise 0 + 1 = 1. Sorry, here's the exit formula I came up with:

( { MACD Weakness Long Exit} MACD[Diff,Close,12,26,9,D,0,$COMPX] < MACD[Diff,Close,12,26,9,D,1,$COMPX] AND ( MACD[Diff,Close,12,26,9,D,0,$COMPX] < 0 OR MACD[Signal,Close,12,26,9,D,0,$COMPX] < 0 OR ExpMovingAverage[EMA,Close,50,0,D,1,$COMPX] < ExpMovingAverage[EMA,Close,200,0,D,1,$COMPX] ) )

Now, plugging these two entry and exit rules into StrategyDesk and applying them on the 60 minute interval gives this backtesting result, with the buy and sell markers shown.

Looks pretty good doesn't it?

Click here for full chart

Well don't get too excited. Unfortunately, the results are misleading. StrategyDesk uses closing Daily bars for the trades, so the actual conditions for a buy and sell are tested at the daily close, while the bullish and bearish conditions reversed at some time during trading day. Perhaps you're making the same mistake by trading intraday based a Daily chart, only to find what looked bullish turned bearish by the close?

This is one very good reason why backtesting and forward testing can provide different results.

There is a way to rewrite these formulas so they show when the reversals actually happened; a topic for another day.