December 17, 2011

Scanning for 'Scooters'

By Ben Shelton

Over the past week or so you've probably seen announcements introducing the new StockCharts Technical Rank.  The StockCharts Technical Rank is a way to rate the technical strength of a stock.  The short-hand form is the SCTR, or 'Scooters' as they have been quickly dubbed.  The StockCharts.com home page now has a section for the Top 10 rankings of three different SCTR groups.  SCTRs are still in test mode and we invite your feedback.

You can click here to see the announcement posting.

We won't dive into the technical details about how the score is created in this posting.  If you would like more information on how the SCTRs are calculated, you can read the ChartSchool article here.

One of the first things to know about SCTRs is that a stock could potentially have many of them.  SCTRs are a ranking within a grouping of stocks.  A group could be the S&P 500, NYSE stocks, ETFs,  all Canadian stocks or even stocks that start with the letter 'A'.  The possibilities are limitless. 

For example Apple could have a SCTR score for the S&P 500, Nasdaq and US stocks.  Each score would be different because the members it is being ranked against is different. 

When using SCTRs one must keep in mind what the overall group that SCTR is ranking.  A stock with a high score in the S&P 500 group may not have a corresponding high score in another grouping if the rest of the group has stocks out performing the S&P 500.

Within a group, each stock is given a score based on a number of technical parameters.  The entries are then ranked by score and given a StockCharts Technical Rank from 0 to 99.9.  Scores > 90 represent the best of the group and scores near 0 represent the worst.

This brings up another aspect to remember: the SCTR is a relative score.  If the group as a whole goes down 2% but one stock manages to simply stay at the same price that day, it's score will go up even though it hasn't necessarily had an upward price move.  It went up by virtue of the fact that everyone else went down.  One must bear this in mind when you see a stock with a large move in it's SCTR but the price change doesn't appear to support it.

Initially there are five SCTRs covering the S&P 500, S&P 400, S&P 600, US ETFs and stocks listed on the Toronto exchange.  Currently no stock will have more than one SCTR score as the above group memberships happen to be mutually exclusive. 

This will likely change as more SCTR groups are created in the future.  Thus only stocks in these 5 groups will have SCTR values initially.  Stocks outside these groups will have no SCTR value.

In the case of the ETFs and Toronto exchanges, we're choosing only stocks that trade above $1 and have volume greater than 40,000 shares using a 20 day simple moving average.

 

Standard User Interface

In the Standard interface there is now a new section for SCTRs right below the Group list.  This list contains pre-defined ranges for the five SCTR groups mentioned above (note, the picture below only shows the S&P 500 entries.  The other SCTRs have the same ranges available).

Screen shot 2011-12-15 at 1.37.01 PM

 

Here's a tip for Standard UI users (I know because I did this myself!), if you're looking for TSX SCTRs, don't forget to change the Group setting.  By default you'll be scanning for Toronto SCTRs in the United States.  That will give you zero results every time!  Change the Group to Any, or Canada or TSX, or TSX 300 to ensure you don't create a mutually exclusive set of parameters.

 

Advanced User Interface

The Advanced interface also has a new section: Price, Vol and Sctrs.   The technical indicators are now in their own list called Technical Indicators:

Screen shot 2011-12-15 at 2.46.08 PM

 

In the Price, Volume and SCTRs list are the 5 SCTRs:

S&P 500 = SCTR.sp5
S&P 400 = SCTR.sp4
S&P 600 = SCTR.sp6
US ETFs  = SCTR.us.etf
Toronto = SCTR.tsx

To scan for S&P 500 stocks that are technically strong you could use the following:

[SCTR.sp5 >=90] 

to find weak small-cap stocks, look for lower SCTR values in the S&P 600:

[SCTR.sp6 < 10]

 

More on SCTRs

We hope that, in conjunction with your existing scans, SCTRs will offer a new way to help find great performing stocks.  Be sure to keep an eye on the StockCharts blog postings to see where else SCTRs will be turning up on the site.

Happy Holidays!

August 13, 2011

Scan coding sample blocks

By Gord Greer

Hi all from the 3rd floor of the Red Lion in Seatle, ChartCon has been wonderful and educational.  I hope all who are in attendance are enjoying it as much as I am, many many thanks to Chip and the whole team for putting on this exceptional event.  I'm sure the next one will be even better, but I'm not sure how you're going to do that Chip.

This mornings sessions covered the scanning engine and there were many questions on how to set up scans and whether there were any libraries of standard scan coding.  There are many predefined scans on the website which you can look at and learn from, I recommend you study them closely.

However in order to help get you started here are a few Advanced scan coding sections, these are provided just to get you thinking of different things you can do and how the general format of the coding is set up.

These sections of coding can be modified and grouped into an advanced scan as you see fit, these are only examples they are not necessarily scans which would be applicable to your investment / trading style.  Just cut and paste into the scan engine and start creating your own library.  (all info provided is subject to change without notice, use at your own risk)

Happy scanning
Gord Greer


Advanced Scan Code Sections,
Just a Few Examples
( // indicates comment lines)


// Sample scan layout, generic
[type = stock]
and [1st criteria]
and [2nd criteria]
and [ [3rd criteria] or [4th criteria] ]


[country = us]
[country = canada]
[country = uk]


// Type
[type = stock]
[type = index]
[type = fund]

// Exchange
and [exchange = NASDAQ]
and [exchange = NYSE]
and [exchange = AMEX]
and [exchange = PINK]
and [exchange = TSE]
and [exchange = CDNX]
and [exchange = LSE]


and [group is SP500]
// or for S&P 1500, large, mid and small cap
and [ [group is SP500] or [group is SP400] or [group is SP600] ]


// Fav lists, numbers will be different for each user, note extra brackets grouping the "OR" clauses together
//
[[favorites list = 13]
or [favorites list = 24]
or [favorites list = 63]
or [favorites list = 64]
or [favorites list = 67]
or [favorites list = 68]
or [favorites list = 70]
or [favorites list = 71]]


// Liquidity  SMA of average dollars traded per day > $500,000
[type = stock]
and [SMA(50,close) * SMA(50,volume) > 500000]


// Price bracket, used to restrict the output when developing scans, also min close used to eliminate stocks which are not marginable and not likely to have options, or stocks which have a price which would require a board lot trade to be above your position size. (ie if your max position size is say $10K then 100 shares of a $100 stock would be at your limit of $10K,  100 shares of Google would be $60K,  this is important if you broker requires you to trade in board lots when inputting conditional orders)
//


and [Close >=10] and [Close <=20]


// Uptrend: for 75 days the min RSI(14) value >= 40
and [Min(75,RSI(14)) >= 40.0]


// Downtrend:  for 75 days max RSI(14) value <= 60
and [Max(75,RSI(14)) <= 60.0]


// Uptrend: MACD positive for 130 days (~ 6 months)
and [Min (130, MACD Line (12,26,9)) > 0.0]


// MA Price convergence long term,
// SMA-20, 100 & 200 all within +/-1% of the SMA-50
and [daily sma(20,daily close) >= daily sma(50,daily close) * 0.99]
and [daily sma(20,daily close) <= daily sma(50,daily close) * 1.01]
and [daily sma(100,daily close) >= daily sma(50,daily close) * 0.99]
and [daily sma(100,daily close) <= daily sma(50,daily close) * 1.01]
and [daily sma(200,daily close) >= daily sma(50,daily close) * 0.99]
and [daily sma(200,daily close) <= daily sma(50,daily close) * 1.01]


// MA Price convergence short term,
// SMA-3, 10 & 40 all within +/-1% of the SMA-20
and [daily sma(3,daily close) >= daily sma(20,daily close) * 0.99]
and [daily sma(3,daily close) <= daily sma(20,daily close) * 1.01]
and [daily sma(10,daily close) >= daily sma(20,daily close) * 0.99]
and [daily sma(10,daily close) <= daily sma(20,daily close) * 1.01]
and [daily sma(40,daily close) >= daily sma(20,daily close) * 0.99]
and [daily sma(40,daily close) <= daily sma(20,daily close) * 1.01]


// Price convergence consolidation mid term,
// Max / Min daily close for last 20 days,
// contained within +/-2% of the current SMA-20
and [max (20, daily close) <= daily sma(20,daily close) * 1.02]
and [min  (20, daily close) >= daily sma(20,daily close) * 0.98]


// Price convergence consolidation short term,
// Max high / Min low, for last 10 days,
// contained within +/-2% of the current SMA-10
and [max (10, daily high) <= daily sma(10,daily close) * 1.02]
and [min  (10, daily low) >= daily sma(10,daily close) * 0.98]


// Price channel convergence,
// Max / Min daily close for last 20 days,
// contained within +/-3% of the current close
and [min(20, daily close) > close * 0.97]
and [max(20, daily close) < close * 1.03]


// Consolidation then breakout,
// 30 days prior to yesterday Max/Min close within +/-3% of yesterdays SMA-20,
// then breakout, close today 5% above yesterdays SMA-20
and [1 day ago max (30,  close ) <= 1 day ago sma(20, close) * 1.03]
and [1 day ago min (30,  close ) >= 1 day ago sma(20, close) * .97]
and [close > 1 day ago sma(20, close) *1.05]

//Note last line could be modified to look for a break in either direction,
and [[close > 1 day ago sma(20, close) *1.05] or [close < 1 day ago sma(20, close) *0.95]]


// Fav lists scan for unusual activity, select Fav lists grouped with "OR" clause; watch, hold and sector lists. 
//Then define several criteria for today, yesterday, day before etc, based on close, high, low, volume etc etc,
// and then group them with "OR" so any individual criteria will select a stock.
//
[ [favorites list = 1]
or [favorites list = 3]
or [favorites list = 5]
or [favorites list = 6]
or [favorites list = 10]
or [favorites list = 13]
or [favorites list = 61]
or [favorites list = 70] ]
and [[0 days ago volume > 1 day ago sma (60, volume)*1.25]
or [1 days ago volume > 2 days ago sma(60, volume)*1.25]
or [2 days ago volume > 3 days ago sma(60, volume)*1.25]
or [0 days ago close > 1 day ago close * 1.05]
or [1 days ago close > 2 day ago close * 1.05]
or [0 days ago high > 1 days ago close * 1.05]
or [1 days ago high > 2 days ago close * 1.05]]

end

Gord Greer

August 12, 2011

Scanning for an overlay of an indicator

By Gord Greer

Question:

Is it possible to use an EMA of an indicator in a scan? For example, If I wanted to know when RSI(5) is above a 3-period EMA of RSI(5)?
I know you can use sma(60,volume), for example, but volume doesn't have a parameter. When I try to introduce an indicator parameter to similar phrasing, I get syntax errors. It doesn't "get" RSI(5,5) or EMA(5,RSI(5)).
Any help would be appreciated.

 

Answer:

Yes it is possible and its one of the scan coding items that many people have trouble with.  I assume the following chart explains the type of thing you are looking for.  Note for this example I've just choosen a stock and adjusted the EMA and RSI time frames to get a crossover in the last few days in order to check my scan coding, you can change the parameters to your own needs.


Scan ema of rsi

Now here is the coding I set up to look for this cross.

[type = stock] and [country = us]
and [Close >=48] and [Close <=49]
and [RSI(7) X EMA(14,RSI(7))]

Note in order to check the scan I know this cross happened 3 days ago for GG (Goldcorp), so when I run the scan with a start date of 3 days I should get GG which will verify that the scan is working. (note I narrowed the price range specifically to home in on GG)

Scan gg

Note we did pick up GG, you might notice that the price range for GG on the above list is outside the price range in the scan, however the list above is todays price range, the scan was for 3 days ago.

I hope this helps, happy scanning.

 

 

August 11, 2011

Building a Scan, Q&A

By Gord Greer

Question

"...I'm hoping someone can help me with some criteria for setting up a scan.... I came up with a description in words, but other than item 1 and 2, not sure how to input things into stockcharts.com.

1. Stock must trade over 500,000 shares average for last 20 days
2. Greater than $5
3. Stock must have traded above the 200 DEMA for 20 days or more
4. Stock must be in decline
5. Stock must trade at less than 105% of the 200 DEMA

I define the pivot as the following, using candlesticks:
A down bar, followed by a bar that opens lower and closes higher, and the final bar opens down or equal to the previous bar’s close, and closes higher on the day.

I'm probably asking a lot for the pivot part and I'm cool with eye balling that part if necessary...."

Answer

Great question,
I've been away for a few weeks unplugged, (ie without internet).  Back now,  currently at the Chartcon conference out in Seattle.  The short answer is yes you can scan for all of what you are looking for.

Let’s break it up into sections and review each in a little more detail.

- 1. Stock must trade over 500,000 shares average for last 20 days

and [daily sma(20, daily volume) > 500000]

- 2. Greater than $5

and [Close > 5]

This requires today’s close to be greater than $5, but we could also expand this to require that the average close for the last 20 days be greater than $5.

and [daily sma(20, daily close) > 5]

We could also require the min close for the last 20 days to be greater than $5.

and [Min(20, daily close) > 5]

Or we could require that the min daily low be greater than $5.


and [Min(20, daily low) > 5]


- 3. Stock must have traded above the 200 DEMA for 20 days or more

This one is a little tricky, lets look first at some of the things which won't work.

and [close > ema(20, close)]
This requires only today’s close to be above today’s value of the ema20.

and [min(20,close) > ema(20,close)]
This requires the min close over the last 20 days to be above today’s value of the ema20.

and [min(20,close) > max(20, ema(20,close))]
This requires the min close over the last 20 days to be above the max value over the last 20 days of the ema20, however not necessarily on the same day.

In summary the above criteria are close to what we are looking for but none of them require the close on every individual day to be above the ema20 for that same individual day.

One way to accurately check for a few days is to just write the criteria for each day, as follows.

and [close > ema(20,close)]
and [1 day ago close > 1 day ago ema(20, close)]
and [2 day ago close > 2 day ago ema(20, close)]
and [3 day ago close > 3 day ago ema(20, close)]
etc,
etc,
etc,
and [20 day ago close > 20 day ago ema(20, close)]

While the above method is OK for a few days it can become lengthy for longer time frames and luckily there is another method.  We need to start by becoming familiar with the formulas for all the indicators we use on our daily charts.  In this case the MACD indicator is of interest, Moving Average Convergence Divergence.  The MACD line which is plotted is the raw difference between two exp moving averages, the typical default values are 12, 26.  Normally there is also a signal line plotted which is typically a 9 ema of the MACD line.

In our case we are looking at the close being above the 200ema, the trick to remember is that a 1 day ema or sma is actually the closing price for each day.  Thus if we plot the Macd 1,200 we are actually plotting the difference between the daily close and the daily value of the ema200 for each individual day.  The value is positive when the close is above the ema200 and negative when the close is below the ema200.  Thus we only need to scan for the min  value to be positive, (greater than 0), for the last 20 days, as follows.

and [Min (20, MACD Line (1,200)) > 0.0]


-4. Stock must be in decline

Lots of ways to this so lets just say in the medium term the 20SMA is below the 50SMA.

and [sma(20, close) < sma(50, close)]



- 5. Stock must trade at less than 105% of the 200 DEMA
Here we simply have to require the close to be less than the ema200 times 1.05

and [Close < ema(200, close)*1.05]

- 6. "I define the pivot as the following, using candlesticks:
A down bar, followed by a bar that opens lower and closes higher, and the final bar opens down or equal to the previous bar’s close, and closes higher on the day".

In this case we just need to look at each day and define the criteria for the open and close each day, note as far as the scan engine is concerned today is day zero "0" and counts back in time.  See the following chart which identifies the criteria for each day.

Pivot


and [2 days ago close < 2 days ago open]
and [1 day ago open < 2 days ago close]
and [1 day ago close > 1 day ago open]
and [open <= 1 day ago close]
and [close > 1 day ago close]

 

hope this gives you some new scanning ideas

good luck

July 20, 2011

Futures Contracts Added

By Ben Shelton

Following on the tails of Chip's announcement about the addition of futures contracts (click here), the Scan Engine now supports futures as well.  There are two new indexes and a new instrument type to choose from.

Futures symbols will start with the “^” character.  For example: ^GCG12 for the Gold – Feb 2012 (EOD) contract.

In the Advanced UI you can find futures via:

[type = future]

The new exchanges are the CME and ICE.  To target specific exchanges use the following:

[exchange = CME]
[exchange = ICE]

The 'type' and 'exchange' fields can be selected from the Ticker Properties list in the Scan Builder section:

Screen shot 2011-07-19 at 3.21.18 PM

 

To scan for futures contracts In the Standard UI, first change the drop down list to display 'Futures':

Screen shot 2011-07-19 at 9.47.58 AM
If you wish to look at a particular exchange, the Group list in the Global Filters section has entries
for both the ICE and CME exchanges:

Screen shot 2011-07-19 at 9.49.38 AM

Note that if 'Futures' is not selected first, as shown in the previous image, searching for ICE and CME symbols will yield no results.

As Chip mentioned in his posting, StockCharts will continue to add even more futures symbols over the coming weeks!

July 06, 2011

Deutsche Börse Exchange Added

By Ben Shelton

This week we've added symbols from the Deutsche Börse exchange to the Scan Engine.  All of the German symbols will end with .DE.  Like stocks on the Euronext exchange, the Deutsche Börse stocks are priced in Euro.

The new exchange name is DEUT.  One can also scan based on the country. 
 
Either of the following clauses will yield the German symbols in the Advanced Scan UI:

[exchange is DEUT]
[country is Germany]

And of course since Germany is part of Europe, the new symbols will also display (along with London and Euronext stocks) if the region is set to 'Europe':

[region is Europe]

All of these options are available under the Ticker Properties menu:

Screen shot 2011-07-01 at 3.24.58 PM

In addition, a new group has been added for the DAX 30 index:

[group is DAX30]

In the Advanced Scan UI this can be found in the Indicies and ETFs menu:

Screen shot 2011-07-01 at 3.22.22 PM

 

In the Standard Scan UI all of these options can be found under the Group menu in the Global Filters section:

Screen shot 2011-07-01 at 3.19.03 PM

 

The Predefined Scans have also been updated to add the DEUT exchange.

May 17, 2011

Welcome Euronext Stocks

By Ben Shelton

This week we've announced the addition of the Euronext stocks.  To read the announcement, click here. The Euronext stocks are also accessible via the scan engine.  We have added the .EU suffix to symbols that reside on the Euronext exchange.  For example Anheuser-Busch InBev is ABI.EU.  All of the stocks on the Euronext exchange are priced in Euro.

The new exchange for Euronext will be 'ENXT'.  The Euronext symbols have also been added to the 'Europe' region. 

In the Advanced UI the syntax is:

[exchange = ENXT]  // gives all Euronext symbols
[region is Europe]   //  gives all symbols on the London Stock Exchange and Euronext

In the Standard UI, these options are under the Global Filters list:

Screen shot 2011-05-10 at 2.46.14 PM

 

The country parameter is where things get a little tricky.  Euronext is the first exchange the scan engine has encountered that comprises multiple countries, not the other way around.  It's not possible to search for the constituent counties on the Euronext exchange, so we decided to simply add support for the country as 'Euronext'.  Thus the following are equivalent:

[country = Euronext]
[exchange = ENXT]

Along with these changes are two new indexes: FTSE 100 and Euronext 100.  In the Advanced UI these are located in the Indices and ETFs list:

Screen shot 2011-05-17 at 10.40.01 AM

In the Standard UI they are located in the Group list in the Global Filters section:

  Screen shot 2011-05-17 at 10.37.10 AM

And last, but not least, the Predefined scans have been updated with a new column for Euronext results.

 

May 12, 2011

Percentage Change Function Added To ScanEngine

By Ben Shelton

Knowing the percentage change of an indicator can be a very powerful tool in finding stocks which are outperforming other stocks or indices.  In an effort to make finding these stocks easier, the PctChange function has been created.

In the Advanced UI, the function can be found in the Price, Volume and Indicators list:

Screen shot 2011-05-11 at 1.39.25 PM

PctChange takes two parameters, a time period and an expression.  For example:

PctChange(10,close)

which calculates the percentage change over the last 10 trading periods using the closing price.  To find stocks which have gained more than 15% in the last 10 days we would have:

[PctChange(10,close) > 15]

and for stocks that have gone down more than 15%:

[PctChange(10,close) < -15]

PctChange can be used to find stocks which are outperforming or underperforming various indicators.  If we know the S&P has gained, say 8% in the last 3 months, we can now quickly find stocks outperforming the benchmark.

Another application would be to scan a favorites list to find items in that list which have a higher or lower percentage change than others.  For example, if you have a favorites list which contains the Dow-Jones sectors and industries, Fidelity sector funds,  International ETFs, etc.  PctChange can show which of those are doing better or worse than the others over a given time period.  Your scan may look something like:

[favorites list is 50] and [PctChange(10,close) > 30]

But the PctChange function is not limited to only price data.  It will also accept other expressions such as MACD lines, moving averages, channel values; virtually any expression that can be found in the Price, Volume and Indicators list when using the Advanced UI.  Here are a few examples:

PctChange(10,MACD Line (12,26,9))
PctChange(10,Fast Stoch %K (14,3))
PctChange(10,Aroon Up (25))
PctChange(10,SMA (50,volume))
PctChange(10,BB Width (20,2))
PctChange(10,Volume)

Keep in mind that oscillators will tend to have larger swings on a percentage basis and in cases where values are near 0, the percentage change can go quite high.  As with all scans, you may need to adjust your parameters to get a result set that is manageable.

In the Standard UI, there are 2 options for PctChange listed under the Additional Technical Expressions area - PctChange Close and PctChange Vol:

  Screen shot 2011-05-11 at 1.44.30 PM

Both default to a period of 10.  So in the Standard UI to find stocks that have a 15% or better gain in the last 10 days, the parameters would like like this:

  Screen shot 2011-05-11 at 8.59.23 AM

Happy Scanning!

April 26, 2011

Modify, Develop and Test a Custom Scan

By Gord Greer
ExampleTechnique

Some of you might recognize this example from a CSTA webinar I did last Dec, but I thought it was a good time to update and share it with all StockCharts users.  The example starts with a simple predefined scan and shows how it can be modified, step by step.

(Note the techniques described use the advanced scan interface for writing custom scans, thus you will require at least a Basic membership to create these scans).

When reviewing the charts for the S&P500 index we see that the index closed above the Feb and April levels.  Now individual stocks don't always follow the index exactly but we can use the scan engine to find which are leading or lagging the index.  Also we have to be aware that the $SPX is the S&P 500 market cap weighted index, ie Exxon and Apple account for 6% of the index.  We could also look at the $SPXEW which is the equal weighted S&P-500 index where each of the 500 stocks accounts for 0.2%, this index exceeded the Feb highs in April and exceeded the April highs today.

SPX SPXEW

So lets find out how the individual stocks in the index are doing.  We'll limit our initial scan to the S&P-500 and insert one of the predefined scans "New 52 week high".

1 input

Now running this scan yields 98 hits, but I'm more interested in closing values than the daily highs and really only interested in looking back into Jan.  Now we could change only todays high to a close above the previous intra-day high but in this case I'll change both the "highs" to "close" and just look for the previous maximum back say 90 days instead of 260 trading days.

[type = stock]
and [group is SP500]
and [today's close > yesterday's daily max(90,close)]

This gives us 113 hits. 
But I know some stocks in the index may not have had a new high close today, they may have had a new high a few days ago and pulled back a few cents today.  So lets look for a new high close anytime during say the last 5 days which is higher than the highest close for the previous 90 days (starting 6 days ago).

[type = stock]
and [group is SP500]
and [max(5, close) > 6 days ago daily max(90,close)]

This gives us 163 hits, which corresponds to 32% of the stocks in the S&P-500 hitting a recent new high close in the last 5 days.  But I'm also interested in what the Small and Mid cap stocks are doing so I'll add them to the list and by using the comment prefix of // or #, we can turn these individual clauses ON and OFF.  (any line prefixed with // or # is considered a comment and not evaluated)

[type = stock]
// and [group is SP500]
and [group is SP400]
// and [group is SP600]
and [max(5, close) > 6 days ago daily max(90,close)] 

This yields the following hits;
SP500,  163
SP400,  113
SP600,  111
Total =  387

Now we also have another option if we wanted to look at the Large, Mid and Small caps simultaneously, we could create a grouped "OR" clause, enclosed by an extra set of square brackets.  Note this function is only available in the advanced scan engine interface and I have turned OFF the individual clauses.  (Note the S&P-1500 is currently not available in the scan engine as a predefined group, but you can chart it under the symbol $SPSUPX)

[type = stock]
// and [group is SP500]
// and [group is SP400]
// and [group is SP600]
and [ [group is SP500] or [group is SP400] or [group is SP600] ] 
and [max(5, close) > 6 days ago daily max(90,close)] 

This gives us the same 387 hits as the individual scans.

Now if we look at the $SPXEW-500 Equal Weight index, we see that it is about 1% above its recent highs, so lets limit our scan to only stocks which significantly exceed that.  Lets try 5% above the past highs and lets use the S&P-1500 group, (use the multiplier function).

[type = stock]
//and [group is SP500]
//and [group is SP400]
//and [group is SP600]
and [[group is SP500] or [group is SP400] or [group is SP600]]
and [max(5, close) > 6 days ago daily max(90,close) * 1.05

This gives us 45 hits.

In summary I verify each section (clause) before proceeding to the next clause.  I find the quickest way is to review 10-20 charts to see if they meet the scan criteria and I try to make this as visual as possible, (its just quicker).  So before I run the scan I set up a simple chart for only the time frame of the scan and only plot what the scan is looking for.  In this case the chart covers Feb till now and is a performance type chart which makes the min 5% gain easy to see.  I save this chart as my default style and after I run my scan I can easily dump the output into my "00 Temp" fav list (it’s the first list so its already in the drop down box, just hit go) and all the charts will be created with this chart style. 

Note; if for some reason you need to keep your default chart style you can also change the chart style after you have dumped the group to a new fav list, just set up a new style on one of the charts and then use the "Apply Style to All" button, but this will take a few more steps and you will have to redo those steps every time you run and dump new scan results.

1 output

At this point you can also click on the table headers and sort by "Sector" or "Industry" to see where most of the hits are coming from.


Then select the 10 per page view and quickly scroll thru 10-20 charts to verify the scan is finding what you asked for, or what you thought you asked for.   If necessary go back and modify the coding.  Then select differnt indexes or add more specific technical criteria.

2 output

The following is a graphical representation of the scan which is often helpful when developing and laying out scans, especially the more complicated ones.

Scan graphic

I hope this discussion has given you some new ideas on creating, modifying and testing your own customs scans.

Happy scanning,

Gord

(note: I don't work for StockCharts, I'm just a long time user always trying to learn more and willing to share what I've already learned.  If you have comments related to this article I'll try to answer them here, if you have other comments or suggestions send them directly to StockCharts thru the support page).

 

April 24, 2011

Scans, Where is the "Crosses Below" function ??

By Gord Greer
ExampleTechnique

Q:  I've used the crosses above function but I can't find the crosses below function, where is it ??

A: Don't feel frustrated, this is just part of the learning curve and it's one of the most frequently asked questions on scanning.  Many articles have been written on the subject but as it keeps coming up I'll try to put a little different slant on the subject.

Actually the crosses below function is reduntant, we just have to think of the crosses above function from the other point of view.  It all just depends on what your mind likes to think of as the reference point.  When "A" crosses ABOVE "B" we have to remember that from the other point of view "B" is crossing BELOW "A".

Here's an example to help get you thinking of different ways to read the coding:

and [Close > 10.00]

- Read from left to right, this clause looks for stocks where the close is greater than $10.00
- Read from right to left, this clause looks for stocks where $10.00 is less than the close.

We could also find the same stocks by writing the clause as follows, it just depends on how your mind likes to think of it, both clauses achieve the same result.

and [ 10.00 < Close ]

Now lets look for stocks where the 20 SMA has crossed ABOVE the 50 SMA

and [ SMA(20, close) X SMA(50, close) ]
or we could write it as
and [ SMA(20, close) Crosses SMA(50, close) ]

- Read from left to right, this clause looks for stocks where the 20 day SMA of the close has crossed ABOVE the 50 day SMA
- Read from right to left, this clause looks for stocks where the 50 day SMA of the close has crossed BELOW the 20 day SMA

Thus to find stocks where the 20 SMA crosses BELOW the 50 SMA, just write it as the 50 SMA crossing ABOVE the 20 SMA, as follows;

and [ SMA(50, close) X SMA(20, close) ]
or we could write it as
and [ SMA(50, close) Crosses SMA(20, close) ]

1spx crosses


Sometimes we need to think outside the box and sometimes we just need to look at the box from the other side.

Final note on the crossing function,  when scanning for "A" crossing "B" we need to remember this is actually the short form of the following two clauses, (less than or equal to yesterday, and greater than today).

and [ "A" one day ago < = "B" one day ago ]
and [ "A" today > "B" today ]

Now the scanning engine calculates and compares these values to several decimal points, so in order to avoid picking up very small crosses I often use the two line method and I require the cross to be greater than say 1%  (use the multipier function on the second parameter).

and [ "A" one day ago < = "B" one day ago ]
and [ "A" today > "B" today * 1.01 ]

Happy scanning

Gord

Note: Free members have access to hundreds of pre-defined scans, but in order to create and modify your own custom scans as above, you will need at least a Basic StockCharts.com membership.