Scanning Technically

Scans, Bullish MACD Crossover...

Gord Greer | 

As a scanning example, lets look in detail at one of the predefined scans, the "Bullish MACD Crossover".

You can see the coding for this scan by selecting and inserting it into the Basic Scan page.  Open the Basic Scan page and in the lower right, select the desired scan from the drop down menu and use the insert button.


Now for starters you should familiarize yourself with the definition of the scan and also how the MACD indicator is calculated and used, links are shown below.

From the StockCharts scan definitions page, just click the link below the scan input form.

"Bullish MACD Crossovers - Stocks whose MACD line crossed above the signal line today after being below the signal line for the previous three days. The MACD parameters used are 26 and 12 and the signal line is a 9-day EMA of the MACD line."

To understand the indicator, click the "About Indicators" just below the indicators section of any sharpchart input page.

Now lets look in detail at the actual scan coding, here's what it looks like in the Basic Scan interface.


And if you hit the "Advanced User Interface" button at the bottom of the page you'll see what the coding looks like in the Advanced version.

1 MACD adv

Now to make it easier to read and understand I usually add a few line returns to separate each criteria clause onto a separate line.  Then I save these blocks of code, with explanation notes to a text file (say MS Notepad), then I can easily reuse any coding by just cutting and pasting it into a new scan.

[type = stock]
and [country = us]
and [daily sma(20,daily volume) > 40000]
and [yesterday's daily macd line(12,26,9) < 0]
and [daily macd line(12,26,9) >= daily macd signal(12,26,9)]
and [yesterday's daily macd line(12,26,9) < yesterday's daily macd signal(12,26,9)]
and [2 days ago daily macd line(12,26,9) < 2 days ago daily macd signal(12,26,9)]
and [3 days ago daily macd line(12,26,9) < 3 days ago daily macd signal(12,26,9)]
and [3 days ago daily macd hist(12,26,9) < 3 days ago daily macd signal(12,26,9) * 0.25]

For analysis of the scan I've identified the various criteria sections as 1 thru 9 on the basic scan page above.  So here's the text description of the scan.

1 For the last market close:
2 United States Stocks with...
3 20-day Simple Moving Average of Volume for today is greater than 40000
4 Daily MACD Line(12,26,9) for yesterday is less than 0
5 Daily MACD Line(12,26,9) for today is greater than or equal to Daily MACD Signal(12,26,9) for today
6 Daily MACD Line(12,26,9) for yesterday is less than Daily MACD Signal(12,26,9) for yesterday
7 Daily MACD Line(12,26,9) for 2 days ago is less than Daily MACD Signal(12,26,9) for 2 days ago
8 Daily MACD Line(12,26,9) for 3 days ago is less than Daily MACD Signal(12,26,9) for 3 days ago
9 Daily MACD Histogram(12,26,9) for 3 days ago is less than Daily MACD Signal(12,26,9) for 3 days ago times 0.25

Now here's a little more detail as to what each section means.

1- Sets the scan to use the last EOD market close data

2- Looks for only US Stocks

3- Requires the SMA20 of Volume to be greater than 40,000 shares, thus eliminates all stocks which are thinly traded or haven't traded in some time.

5- This is the cross (or near cross), it requires the MACD today to be greater than or equal to the Signal line.
4 & 6 & 7 & 8
Requires the MACD to be below the 0 line (negative), ie the MACD 12 day EMA is below the 26 day EMA.  Also requires the MACD to have been below the Signal line for each of the previous 3 days.

9- This final criteria is a little trickier, it requires that the value of the MACD Hist (3 days ago) to be less than the Signal line *(times) 0.25,  IE the Hist is the diff between the MACD and the Signal line (9 EMA of MACD), so we want the diff to be greater than 25% of the Signal, that is we want at least some minimum separation 3 days ago , this eliminates stocks that were very close 3 days ago and have now just crossed, (basically flat line MACD).  To see this more readily or to have a greater move, increase the multiplier value to say Signal line *3 and thus we'll have fewer results as the move now has to be much greater.

So here's a chart of ADOBE which was one of the scan results.


Now the above chart might be something you would look at when evaluating stocks but its not much help when evaluating the scan.  Below are the chart settings I defined to more easily evaluate and verify this scan.  First I set the time frame to be equal to or just slightly longer than the duration of the longest criteria of the scan, then I eliminate everything except what the scan is looking for.  In this case the scan is only looking for MACD, MACD HIST and Volume SMA20, note I also made the price invisible and have shown the MACD behind the price, (ignore the values on the right side of the chart as they are the price values of the ADBE stock). 

Another trick is to temporarily save these chart settings as your default, then when you run the scan the results can be saved into a new Favorites list and when you review that list all the charts will already be in this format.  It makes checking the validity of the scan much easier and after you've confirmed the scan is working as desired you can just switch all the charts to whatever settings you use for the stock analysis.

So here's the Adobe chart with the settings I would use to evaluate the scan and I've annotated it with all the criteria we were looking for.  Note with respect to the MACD Line and MACD Signal lines,  they appear as continuous lines but really the chart is just connecting the dots from the EOD data for each day, thus I've drawn square boxes around the data points which the scan is actually looking at.




I hope this gives you a little more background to modify an existing scan or create your own from scratch.

Happy Scanning…

A coveted resource among StockCharts users, the Scan Engine is one of our most powerful tools for investors. Scanning Technically is the ultimate guide to all things scan related, including how-to articles, new feature updates, tips, and solutions for common scanning troubles.
Subscribe to Scanning Technically to be notified whenever a new post is added to this blog!
I just wanted to say thanks for setting up this blog. This is an excellent opportunity to increase our understanding of the Search Engine function.
The first thing I want to say is GREAT description of a scan setup. You really tell it in USER-ESE. The second thing is the scan didn't provide a buy signal. If you notice, the price dropped the next day and is still lower today (5-18). Each of the indicators available could be looked a as a chess piece. And, we need to have a grasp of each chess piece to determine how it might be utilized in a stock analysis. You also have to know how to combine them into a tool set that finds your trading goal, be it a buy signal, sell signal, volatility, etc. I guess you could use the military terms of "strategy" for the big picture of your trading goal and "tactics" for the indicators, . I know you're concentrating on the scan engine right now, and that's got to be quite a handful. But it would be nice to see an analysis flow of: 1. What is my analysis goal? 2. Which indicators are the most applicable? 3. How do I set up my scan? 4. How do I set up my chart? where the scan is the "power" step, but it's number three in the analysis strategy. Cheers, Ron Edit Gord: Thanks for the comments and ideas Ron. Yes the article was really just to dissect one of the predefined scans and show what each section means, rather than to identify a particular buy or sell signal. I'll put your other ideas on the back burner for now, getting people up to speed and comfortable with the scan engine is the primary goal for now. As far as analysis, set-ups, goals and strategies, these are much more difficult topics to discuss in an open forum where we all have different styles, goals, risk tolerance and access to information.
comments powered by Disqus