Gord Greer's Scan Building Blocks

Here are a few Advanced scan coding sections I use to build up a new scan. 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.

Happy scanning!
Gord Greer


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

[country = us]
[country = canada]

// 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 [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
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 (your numbers will be different),
// then define several criteria for today, yesterday, day before, etc., based
// on close, high, low, volume, etc., and then group them with "OR" so any
// individual criteria will select a stock.  Example:
[ [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]]