March 18, 2011

Candlestick Building Blocks

By Ben Shelton

Scanning for candlestick patterns has been a staple of the scan engine for quite some time.  The current selection of candlestick scans contains single day patterns as well as multi-day patterns.  Multi-day patterns are generally built up from a sequence of smaller patterns.  In effect these smaller duration patterns act as building blocks for larger patterns.

In an effort to allow more control over scanning for your own patterns, nine new 'building block' patterns have been added:

Doji
Uptrend
Downtrend
Long Body
Short Body
Marubozu
Star
Spinning Top
Engulfed

These scans are more generic than their familiar counterparts.  For example Engulfed will be true for a Bullish or Bearish engulfing pattern.  A Doji will be true for a Gravestone Doji, a Dragonfly Doji or any other Doji pattern.

If you'd like a refresher on what some of these candlestick patterns are, click here.  If you really want to dive into candlestick patterns, we suggest Gregory Morris' Candlestick Charting Explained which you can find in the bookstore here.

In the Standard UI these are listed under the Predefined Chart Patterns section.   The Advanced UI's list is under the Candlestick Patterns menu and is in the same order.

Screen shot 2011-03-16 at 8.51.51 AM

In the Advanced UI these patterns are evaluated as true or false values like the rest of the candlestick scans, so the syntax in the Advanced UI will look similar to the following:

[Star is true]
[Long Body is false]

Happy Scanning!

February 25, 2011

Welcome the London Stock Exchange

By Ben Shelton

Last week we announced the addition of the London Stock Exchange and with that comes changes in the Scan Engine to allow for targeting of those stocks.

In both the Standard and Advanced Scan UI specifying the exchange as 'LSE' will yield stocks listed on the London Stock Exchange. 

In the Advanced UI, the syntax is:
[exchange is LSE]

Conversely the LSE can be excluded using the Advanced UI via:
[exchange is not LSE]

Additionally there are updated country specifications available.  In the Standard UI the country is listed as “United Kingdom”. 

The Advanced Scan UI will accept either “UK” or “England”:

[country is UK]
[country is England]
or
[country is not UK]
[country is not England]


Regions debut
As is often the case, new additions bring new complications!  Previously, scanning 'all' stocks yielded just US and Canadian stocks.  Now the London stocks are also present and over time other exchanges may be added.  We realize that many would rather not see all stocks and creating scans which (dis)qualify a set of exchanges can begin to get quite verbose as more are added.

To accommodate this, the notion of regions has been created.  Currently there are two valid values: North America and Europe.  Specifying the region as North America will give a combination of US and Canadian stocks (as it was before the addition of the LSE). 

Users who wish to only look at European stocks can specify a region of Europe.  Currently the 'Europe' region only contains the LSE so in effect it gives the same result as 'exchange = LSE' or 'Country = UK'.  However, using a region of Europe will allow for inclusion of any additional European exchanges that may get added in the future.

Like exchanges and countries, regions allow for an additional level of filtering.

In the Standard UI, all the additions are in the Group menu in the Group Filters area:

 

Screen shot 2011-02-23 at 12.24.27 PM

The 'regions' option in the Advanced UI is under the Ticker Properties list in the Scan Builder area (along with exchange and country options we have been discussing):

 

Screen shot 2011-02-23 at 12.27.27 PM

 

In the Advanced Scan UI, the syntax is as follows:

[region is NorthAmerica]  // Note: there is no space between 'North' and 'America'
[region is Europe]

Predefined Scans
The Predefined scan page has also been updated to include stocks from the LSE.  You can find the predefined scans here.

 

January 20, 2011

Middle Price Channel Scans Now Available

By Ben Shelton

In addition to scanning for upper and lower Price Channels, it is now possible to scan for the middle Price Channel.  The middle Price Channel is simply the midpoint between the upper and lower Price Channels.

In the chart below, the middle Price Channel is represented by the blue dotted line:

Screen shot 2011-01-20 at 8.56.35 AM

In the Standard UI you can choose the middle Price Channel from the Indicators drop down list in the Additional Technical Expressions area:

Screen shot 2011-01-20 at 9.46.40 AM

In the Advanced UI, look under the Price, Volume, and Indicators drop down list:

Screen shot 2011-01-20 at 9.44.31 AM

For more information on Price Channels, see the article in ChartSchool here.

January 11, 2011

Welcome Pink Sheets to the Scan Engine

By Ben Shelton

The scan engine has been updated so that Pink Sheet symbols are now included in scan results.

To scan specifically for Pink Sheets in the Standard Scan user interface, simply choose PINK from the Group menu in the Global Filters area:

Screen shot 2011-01-10 at 2.54.22 PM

In the Advanced user interface, specify the exchange as 'PINK' (without quotes) in your scan expression:

[exchange is PINK]

Conversely, if you'd rather not see those stocks, you can choose to omit them by using the 'not' keyword:

[exchange is not PINK]

We are also working on splitting off the OTC (Over the Counter) and BB (Bulletin Board) stocks.  That work should be finished soon.  When complete, one can specifically scan for, or eliminate, that subset of stocks as well.  Stay tuned to the Scanning Stocks blog for updates!

Happy New Year!

October 30, 2010

Laying Out a Scan

By Gord Greer
ExampleTechnique

Q:  Can I scan for a stock that has 5 consecutive days down, then an inside day on the 6th day.

A:  Yes, its its a little longer than most scans but its really not difficult, just break it up into sections.  First think about the criteria which must be met today and what criteria must be met in the previous several days. It often helps in the beginning to blow up and print out a chart which has the characteristics you are looking for.  If you can't find such a chart just draw one, it doesn't have to be pretty or accurate, it just has to show the concept you are looking for.  The drawing can then be annotated with the required data formulas.

Here's your basic scan in an annotated drawing. (Note we will keep it simple at this point and just use the open and close data, ie ignoring the candle tails, highs and lows).

Vscan3m

It does takes a few minutes but just start from the beginning and enter each criteria element one at a time. Here's what it would look like in the basic scan engine.

1 scanm

Click here to open the above scan in a new window

Once the above scan is loaded into the Basic scan page you can use the "Advanced User Interface" button at the bottom to see the coding in the Advanced scan engine.  Note I've added a few line returns to break up each section onto its own line, makes it a little easier to follow.

[type = stock]
and [daily sma(20,daily volume) > 40000]
and [daily close > daily open]
and [daily close < yesterday's daily open]
and [daily open > yesterday's daily close]
and [yesterday's daily close < yesterday's daily open]
and [yesterday's daily close < 2 days ago daily close]
and [2 days ago daily close < 2 days ago daily open]
and [2 days ago daily close < 3 days ago daily close]
and [3 days ago daily close < 3 days ago daily open]
and [3 days ago daily close < 4 days ago daily close]
and [4 days ago daily close < 4 days ago daily open]
and [4 days ago daily close < 5 days ago daily close]
and [5 days ago daily close < 5 days ago daily open]

Now if I was to create this scan directly I would use the Advanced scan interface which allows you to copy and paste, this makes it much quicker for any scans which have alot of repetition and similar clauses.  I would also not use the term "daily" in any of the clauses, its the default time frame so really isn't necessary in this scan.  Also I prefer to use the term "1 day ago" rather then "yesterday", just makes it a little easier to follow the flow of the scan.

[type = stock]
and [sma(20, volume) > 40000]
and [ close >  open]
and [ close < 1 day ago open]
and [ open > 1 day ago close]
and [1 day ago close < 1 day ago  open]
and [1 day ago close < 2 days ago close]
and [2 days ago close < 2 days ago open]
and [2 days ago close < 3 days ago close]
etc,  etc.

Hope this gives you some ideas to get started scanning.

cheers

 

October 29, 2010

Calendar Helps With Scan Offset Dates

By Ben Shelton

One of the features available in both the standard and advanced scan engines is the ability to run your search relative to a specific number of days in the past.  But sometimes trying to map the offset to a specific day can be a bit tricky.  We've all probably spent time looking at calendars and counting backwards trying to get the date we wanted.

To help with this process we've added a calendar control which will appear when you click in the offset edit field.  The control has two features which will aid in making sure your scan is using the date you think it is. 

First, when you click on the calendar control it will take the offset number you have in the edit field and initialize the offset date of the calendar to the appropriate date based on the current date.  It will also adjust for whether or not you have the Last Intraday option vs Last Market Close option selected.

In the example below, we have an offset of 3 days relative to the Last Market Close (Oct 21).  As  you can see in the calendar, the offset day maps to October 18th.  If we choose Last Intraday Update (and the market is still open), then the offset date is October 19th.  The offset date in the calendar has a white background and orange text.

  Example2

The second feature allows you to pick a date and the offset value will be provided for you.  Assuming we run this on October 22nd and you choose October 6th relative to the Last Market Close, the offset field will be set to 11.

To exit the calendar control without making a change, simply click anywhere on the page outside the control.  If you do not wish to use the calendar, you can still manually type in your date offset and
press Enter, click on the Done button, or click anywhere outside the calendar control to override the calendar's value.

The range of the calendar is set to as many dates as are available for daily scans, which is generally about 780 days and in this case stretches back to September 19, 2007.  Note of course that setting your offset back that far may not be practical in some cases as you will need a certain amount of data to accurately calculate common indicators such as moving averages.

October 14, 2010

Scanning the Clouds

By Ben Shelton

The Ichimoku clouds that is!  We've just added the ability to search on the Ichimoku cloud parameters.  We won't go into great detail here about the specifics of the Ichimoku cloud calculatoins as it can be quite involved.  If you'd like to investigate more, check out our ChartSchool article here.

You can now search for any of the 4 following Ichimoku parameters:

Base line (Kijun-sen )
Conversion Line (Tenkan-sen)
Leading Span A (Senkou Span A)
Leading Span B (Senkou Span B)


In the standard user interface the Ichimoku indicators appear in the Additional Technical Expressions pane:

StdIndicator

In the advanced user interface they can be found in the Price, Volume, and Indicators list:

AdvIndicator

You can also scan for these patterns:

'In Ichimoku Cloud'
'Above Ichimoku Cloud'
'Below Ichimoku Cloud'
'Green Ichimoku Cloud'
'Red Ichimoku Cloud'

which can be found in the following locations:

StdPattern

 

AdvPattern

Let's do the Time Warp...
One of the interesting aspects of the Ichimoku cloud is that some of the indicators are plotted in either the future or the past.  The Leading span lines, which form the 'cloud', are plotted 26 days in the future and the Lagging line 26 days in the past.  Since the Lagging line is in the past, we don't scan for this value as there is no corresponding effect on today's price.

So what does that mean if we do a search for these 'today'?  The scan engine has no idea about prices 26 days in advance (wouldn't you love to have that feature!), so scanning the cloud 'today' looks at the cloud lines 26 days in the past, which in turn are plotted 26 days in the future, or....today!  This matches what you would see when doing a SharpChart:

Screen shot 2010-10-11 at 10.50.37 AM

In this example, the values for the Leading A and Leading B lines (which define the cloud) are from Sept 1, plotted forward to Oct 8.  Trying to scan for the values of these parameters as they exist on Oct 8th isn't possible as they are plotted into the future where we don't know any price data.  This is visually reflected in the SharpChart where the cloud extends off the chart to the right, 26 days past current price data. 

So the values shown for the Ichimoku indicator on Oct 8th  in the SharpChart of DIA for the Leading A&B lines won't be what the scan engine uses.  On Oct 8th the A and B lines are 107.58 and 104.8 respectively, but the scan engine uses the values from Sept 1 which are 102.01 and 101.17.
This can become a bit mind-bending and I encourage you to read more about it in ChartSchool.

Good luck!

September 09, 2010

Scanning Options

By Ben Shelton

Today we've added the ability to scan for stocks that trade options.  In the advanced scan engine under the Ticker Properties menu you will now find the 'optionable' property.  The values for this property can be 'true' or 'false'.

Screen shot 2010-09-09 at 7.42.54 AM

Here is a sample scan that will find stocks trading options within the Biotech group:

Screen shot 2010-09-09 at 7.19.59 AM

Enjoy!

August 30, 2010

Documenting Advanced Scans with our new Comment Feature

By Ben Shelton

One of the latest features added to the Advanced Scan Engine is the ability to add comments to your scans.  You can use either the '#' character or the '//' characters to add comments in your scan expression.  When the scan engine sees one of these markers it will ignore the rest of the text on the current line all the way to the end of that line.  Necessarily, the scan engine now allows you to break scan parameters across new lines and preserves white space so that scans don't have to be single long lines any more.

Comments are a great way to help you remember what that tricky scan is actually doing as well as making the scan more readable.

Some scans might be pretty obvious such as this one:


Screen shot 2010-08-30 at 11.03.38 AM

But others can get quite complex...just what does that last part do? (Bullish MACD Crossover & Breakaway Gap Up)

Screen shot 2010-08-30 at 11.03.12 AM

Wouldn't it be much easier to read if it looked more like this:

Screen shot 2010-08-30 at 11.07.02 AM

You can also quickly adjust your scans by adding or removing parameters by making them comments:

Screen shot 2010-08-30 at 11.08.46 AM

The next scan is the same as the previous one, but in this case we decide to remove the Bullish Engulfing parameter by adding a comment marker at the beginning of the line:

Screen shot 2010-08-30 at 11.12.24 AM

That is much easier and faster than removing the line completely and having to add it back again.


Be aware that if your scan expression goes across multiple lines you may need multiple comment markers to remove it from a scan:

If we break the Bullish 50/200 MA Cross string into two lines vs one big, long one, we need to add more comments to make sure we don't get unintended parameters in the scan:

Screen shot 2010-08-30 at 11.42.55 AM

This works:

Screen shot 2010-08-30 at 11.43.42 AM

Oops!  This might not give you what you intended as only half the term is commented:

Screen shot 2010-08-30 at 11.44.16 AM

Pay attention to long lines to distinguish between a long line that wraps vs a line that is broken across multiple lines.

And remember to watch those 'and' / 'or' clauses.  Sometime a comment in the wrong place will give you syntax errors like we have in this example.  Here the scan engine sees the 'and' at the end of the first line and expects another search clause, but in this case there is none and you'll get an error.

Screen shot 2010-08-30 at 11.36.07 AM

Note that in the scan results, your comments do not display:

Screen shot 2010-08-30 at 12.34.27 PM


May 14, 2010

Scans, Bullish MACD Crossover...

By Gord Greer
ExampleTechnique

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.

1 MACDa

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.

http://stockcharts.com/help/doku.php?id=support:predefined_scans

"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.
http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:moving_average_conve

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

1 MACD

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.

1 MACD ADBE

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.

  1 MACD ADBE g


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

Happy Scanning…