New Members: Be sure to confirm your email address by clicking on the link that was sent to your email inbox. You will not be able to post messages until you click that link.

Help for MACD Divergence Scan


I’m hoping someone here can help me. I’ve searched Support but can’t find a solution. I’m trying to scan for a particular form of a divergence but I can’t figure out how to express it in the scan engine. Here’s what I’m trying to do:

1. Scan for declining price over a given time period, say 44 days (2 months). This is, of course, easy using EMA. No help needed here.
2. During that same time period I’m looking for the MACD Histogram to have reached a trough/bottom and then later within that same time period while the price continues to reach new, deeper lows the MACD Histogram develops a second trough which is shallower/higher (i.e., a positive divergence).

Any guidance you can provide would very much appreciated.


  • markdmarkd mod
    edited June 2017
    I think you would need to divide the 44 days into two periods, then compare the min MACD Hist value in each period. So, something like

    and [min(21, MACD Hist(12,26,9)) > 21 days ago min(21, MACD Hist(12,26,9))]

    So the left side looks at the most recent 21 day period, and the right side looks at the 21 day period ending 21 days ago. Assuming both min Hists will be below zero, the left side should be greater (less negative).

    I don't know if you may need to require that the first or both mins are below zero. If so, one statement for each. But you can decide whether that's necessary after looking at the results for a few different dates.

  • This appears to be a very nice solution. Thank you, Mark!
Sign In or Register to comment.