MACD Divergence: Fully Automatic

Identifying a MACD divergence has never been easier. Get the ONLY indicator for ThinkorSwim that actually draws a MACD divergence.

WOW !! You have done it again !! Great job on MACD Divergence. Thanks.

Gary Elson

Identifying a MACD Divergence
Has Never Been Easier

Get the ONLY indicator for ThinkorSwim that actually SHOWS a MACD divergence

really enjoying your macd divergence indicator! in times past there has been times i got frustrated expecting a divergence and it not yet play out (ie march ’16). but using yours based off Elder’s definition of breaking the zero line really has made a difference for me when trying to base my posture expectations. money well spent for my type of trading! thanks again for your excellent indicators.

Mike

Note: While not mentioned in the review above, the screenshot provided includes both the Mechanical MACD Divergence (yellow lines) and the Automatic Trend Lines (gray lines).

Hi Robert,

Very pleased with the above script [Mechanical MACD Divergence], looks great for my type of trading. I have been using it on the TOS platform on my P.C. [and] on the TOS mobile platform for my IPad. Once again thank your for a great script, I to, know of no one else who has this script so it is a huge achievement.

The scan on the desktop P.C. TOS platform is also working well, I have it set up so it runs the scan on a watch list live, I.e. Daily, Hourly and 15min. so I can visually see if an alert is triggered even if I’m not watching a symbol on my default watchlist of symbols on the charts.

Kind Regards,

Ted

This indicator is one that I have wanted to create since I very first began learning ThinkScript. Different divergence indicators do exist, but NONE of them have lines drawn on them in the manner that is always shown in technical analysis books. Those are always left up to the user to manually spot and draw in by hand.

I did a LOT of searching for a script that did it automatically and have never found anything. I even looked for help on how to draw the trend-lines, but, again, never came up with anything useful. It wasn’t until I created my Basic Market Structure script that I really figured out what I needed to know to draw the lines. The knowledge that I gained from writing that script allowed me to figure out how to do my auto-trend lines. That one was really complicated, but I was able to build from that one to the near-term divergence lines in the advanced market forecast indicator.

As soon as I finished that one, I knew that I, finally, had the required skills to create a proper MACD divergence study. One that NO ONE else has.

Without further ado, I present the Mechanical MACD Divergence indicator.

In researching divergences online, I came across several different methodologies for determining them. In the end, I settled on the classic MACD divergence as detailed by Alexander Elder in “The New Trading For a Living.” According to him, divergences between MACD-Histogram and prices are infrequent, but they give some of the most powerful signals.

A classical bullish divergence occurs in a down-trend when prices and the oscillator both fall to a new low, rally, with the oscillator rising above its zero line, then both fall again. This time, prices drop to a lower low, but an oscillator traces a higher bottom during its previous decline.

According to Alexander, the breaking of the centerline between two indicator bottoms is an absolute must for a true divergence. MACD-Histogram has to cross above the zero line before skidding to its second bottom. If there is no crossover, there is no divergence.

A classical bearish divergence occurs in an up-trend when prices reach a new high and then pull back, with an oscillator dropping below its zero line. Prices stabilize and rally to a higher high, but an oscillator reaches a lower peak than it did on a previous rally.

ThinkScript: Mechanical MACD Divergence

ThinkScript: Mechanical MACD Divergence video demonstration

ThinkScript: Mechanical MACD Divergence video demonstration

Bullish and bearish divergences are automatically plotted following the rules outlined by Alexander Elder. Bullish divergences are shown in yellow while bearish divergences are shown in orange. The colors may be changed from within the script settings panel along with the MACD parameters and whether or not to show signal arrows.

ThinkScript: Mechanical MACD Divergence settings

ThinkScript: Mechanical MACD Divergence settings

The indicator will work on any time frame.

ThinkScript: Mechanical MACD Divergence

ThinkScript: Mechanical MACD Divergence

ThinkScript: Mechanical MACD Divergence

ThinkScript: Mechanical MACD Divergence

Since divergences may occur infrequently, I am including two scripts to scan for both bullish and bearish divergences. The script may be customized to work with any time period.

Questions

Could u send me a /ES 2 min screenshot last monday and friday of this indicator?

ThinkScript: Mechanical MACD Divergence

ThinkScript: Mechanical MACD Divergence

Can I use Basic Market Structure with Automatic Fibonacci Levels, Auto-Trendlines, and MACD Divergence at the same time?

Yes, you can absolutely run all three on the same chart. Below is a screen-shot showing all three indicators on different time frames (weekly, daily, hourly, and 10 min). I have labeled a few items, but the others are easy to spot on the other time frames.

ThinkScript: Mechanical MACD Divergence

ThinkScript: Basic Market Structure, Auto-TrendLines, and Mechanical MACD Divergence

Does this work on currency pairs?

Yes it does.

ThinkScript: Mechanical MACD Divergence on 15 min AUD/USD

ThinkScript: Mechanical MACD Divergence on 15 min AUD/USD

Hi Robert,

Great work your doing on your Forum, you’ve attracted a lot of like minded people. Can the Mechanical MACD Divergance script be used on the TOS Mobile Papermoney Platform?

I have never used the mobile platform before, but I installed it today to see if it would work, and…it does.

ThinkScript: Mechanical MACD Divergence

ThinkScript: Mechanical MACD Divergence running on mobile phone

I have updated the indicator to include both standard and volume-weighted methods of calculating MACD. The user may select which method to use from within the script settings pane.

ThinkScript: Mechanical MACD Divergence (standard vs. volume-weighted)