In his book "The Visual Investor," John Murphy points out that a positive divergence between the MACD and the MACD Histogram is one of the first signs that a stock is starting to move higher. Here's an Advanced Scan that looks for these divergences:
[type = stock] and [country = us] and [daily sma(20,daily volume) > 40000] and
[macd line(12,26,9) < 0] and
[macd line(12,26,9) < [10 days ago macd line(12,26,9) * 1.05]] and
[macd hist(12,26,9) > 0] and [10 days ago macd hist(12,26,9) < 0] and
[macd hist(12,26,9) > [10 days ago macd hist(12,26,9) * 1.05]]
The first line of this scan limits this scan to US stocks with healthy average daily volumes.
The second line makes sure that the MACD has been moving lower for some time - i.e., it is below the zero line.
The third line looks for stocks whose MACD is at least 5% lower than it was 10 days ago.
The fourth line makes sure that the MACD Histogram has been rising recently - i.e., it's above zero - and that it has crossed over the zero line sometime within the past 10 days.
The last line makes sure that the MACD Histogram is at least 5% higher than it was 10 days ago.
Running this scan today returns a bunch of results including:
Note: The time period (10 days) and the percent increase/decrease (5%) should be adjusted to fit your own personal trading style and goals.
Thank you, Thank you, I've been struggling trying to get scans that show divergents.
Don Talbott, A very satisfied subscriber to StockCharts.Com
This blog page is great.
Posted by: Don Talbott | March 12, 2009 at 10:24 AM
great Chip,
How do i do for cdn stocks ?please.
Posted by: denis lemieux | March 12, 2009 at 01:00 PM
This is a great subjext... however I wish you would show a picture of the input panel and the settings.
Posted by: Richard H Demshar | March 12, 2009 at 05:42 PM
Richard D, that is entered in the Advanced user Interface--it is entered in the text as shown, not in the input panel. The Advanced Interface has some helps, but it is ultimately in a kind of query language that the user would want to learn. There are some resources on StockCharts.com that can help.
Posted by: Tim Farrar | March 12, 2009 at 10:36 PM
Chip, thanks for the help. I only trade the NDX 100 stocks... how do I set the scan up for that?
Posted by: Richard H Demshar | March 13, 2009 at 10:36 AM
Is it okay if I reverse the criteria for Negative Divergence?
Posted by: Neil Chan | March 15, 2009 at 06:30 AM
How can I do macd scan in a weekly chart? It seems that the period in the function "macd line(12,26,9)" is day. How can I change it to week? Thanks.
Posted by: clement chen | March 16, 2009 at 02:07 AM
Thanks for this tutorial. I hope you will continue this thread of illustrating advanced scanning code with the useful techniques. This would help increase our proficiency in the use of the advanced scanner option. Thanks a million.
Posted by: Dr. Wale Ogunye | March 17, 2009 at 12:39 PM
Great Blog Chip.
D. Lemieux, ".. Scanning for cdn stocks ?"
Just eliminate the criteria for [country = US] or change it to [country = Canada], or you can also specify specific exchanges if you desire.
R. Demshar, "I only trade the NDX 100 stocks... how do I set the scan up for that?"
Similar to above, just set a criteria for [group is NASDAQ100].
C. Chen, "How can I do macd scan in a weekly chart?"
The default is daily, but you can specify weekly just by adding the prefix "weekly" in front of each criteria along with changing the "days ago" to "weeks ago".
Posted by: Gord Greer | March 17, 2009 at 10:36 PM