August 10, 2009

Indicators are Rarely "Equal" in the Eyes of the Scan Engine

By Chip Anderson

A member wrote in today asking why a stock was not returned in his scan results when, according to the chart he was looking at, it should have been.

In this case, the chart clearly showed that for this stock, the 12,26,9 version of the MACD had the same value (12.02) as the 20,36,9 version of the MACD. And yet, his advanced scan didn't return the stock in question.  He's the scan he was using:

[type = stock] and [close > 10] and [MACD Line(12,26,9) = MACD Line(20,36,9)]

So what was going on?

When we looked into the issue, we quickly discovered that the user was correct - despite the fact that the chart showed identical values for both MACD Lines, the Scan Engine did not return the stock in question.  But why?

It turns out that the values displayed on the chart are rounded to a certain number of decimal points (typically 2 or 3) for display purposes.  The values used by the Scan Engine are not rounded and are therefore usually not exactly equal.  In this case, one MACD had a actual value of 12.020345 and the other had a value of 12.023424 and therefore, in the eyes of the Scan Engine, the two values were not "equal."

So, how can we "fix" this?

We fix this problem buy replacing the "equals" clause with two other clauses like so:

[type = stock] and [close > 10] and [MACD Line(12,26,9) > [MACD Line(20,36,9) - 0.01]] and [MACD Line(12,26,9) <= [MACD Line(20,36,9) + 0.01]]

That gives us a "buffer" around the values of 0.02.  As long as the MACD values are within that buffer, they are "close enough" to be considered "equal" by our scan.

August 03, 2009

Careful of Date Offsets that Change Indicator Periods

By Chip Anderson

We had a question come into our support area the other day that underscores one of the confusing areas of our Advanced Scans.  The user was sure that our Scan Engine was giving incorrect results for the expression:

Last Week's RSI(14) > Today's RSI(14)

They looked at the chart of some of the results and saw that for many of them, last week's RSI(14) was definitely NOT greater than today's RSI(14).  And they were right!  But the Scan Engine WAS working properly.

How could that be?

Sometimes with Advanced Scans, what you think you are asking for is not really the case.  (Can you spot the problem?)

The confusion comes from the meaning of "RSI(14)".  By itself, "RSI(14)" means today's value for the RSI calculated using the most recent 14 bars of daily data.  The expression "Today's RSI(14)" means the same thing.  Both expressions use DAILY bars for their RSI calculations.

On the other hand, "This Week's RSI(14)" means todays's value for the RSI calculated using the most recent 14 bars of weekly data.  And thus, "Last Week's RSI(14)" means last Friday's value for the RSI calculated using the previous 14 bars of weekly data.

That was not at all what the user was expecting.  They wanted to use the daily RSI(14) from last week.  They really should have used the following instead:

5 Days Ago RSI(14) > Today's RSI(14)

Bottom Line: Mixing weekly and daily expressions can cause problems so be careful when adding offsets to Advanced Scan criteria.

This is yet another reason why we strongly recommend that people first try to create their scan in the Standard Scan Workbench and only move over to the Advanced Scan Workbench if they really need to.

March 26, 2009

Scanning for P&F Chart Patterns

By Chip Anderson
Example

Chart patterns on regular bar/candestick charts are very subjective which makes them very hard for a computer to find.  Because of that, our Scan Engine does not support scanning for chart patterns on bar/candlestick charts.

On the other hand, P&F Chart Patterns are pretty easy for a computer program to detect because the relationship between the X's and the O's for each pattern is very well defined.  And thus our Scan Engine supports scanning for those.  There is a "gotcha" however...

Continue reading "Scanning for P&F Chart Patterns" »

March 17, 2009

The Max() Conundrum

By Chip Anderson
Pitfall

Quick!  Without thinking about it very long - how would you write an advanced scan to find all stocks that are closed at a new 200-day high?  Wouldn't you write something like this?

[type = stock] and [today's high > max(200, high)]


That looks pretty good.  Let's run it and see what we get...

Picture 1  
Curses!  The dreaded "Count: 0" scan result has foiled me again.  But where did I go wrong?

The first possibility is that no stocks are hitting new 200-day highs.  While possible (especially in today's economy), that's not the situation today (March 16, 2009).  There's a functional problem with the way I defined the scan - can you spot it?

The problem is that "today's high" is included in the calculation of "max(200, high)".

Imagine a stock that really is hitting a new 200-day high of, let's say 100, right now.  In that case "today's high" equals 100 and "max(200,high)" also equals 100.  Substituting those values into the scan criteria, we're left with "100 > 100" which will always be false.  That's why we're getting zero results back all the time.

There are two ways to fix the problem:

1.) Change the ">" to "=":

[type = stock] and [today's high = max(200, high)]

2.) Modify the max() clause to start "yesterday":

[type = stock] and [today's high > yesterday's max(200, high)]

(Really observant people will notice that #2 needs a minor adjustment to fully match #1.  I'll leave that adjustment up to the reader as an exercise.)

March 12, 2009

Finding Turnarounds with MACD Divergences

By Chip Anderson
Example

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:

Continue reading "Finding Turnarounds with MACD Divergences" »

March 02, 2009

The "Within" Problem

By Chip Anderson
Limits

Scan Engines are designed to find charts with a specific set of technical criteria on a specific date. Occasionally, we get a question from someone who is trying to use the scan engine to find stocks with a specific set of technical criteria over a range of dates. We call this the "within" problem since they are looking for something that happened "within" a certain time period. For example, "Show me all the stocks that had a MACD crossover within the past month."

The reason our scan engine doesn't support these "within" scans is because you cannot use them in a real-world trading environment. From a high-level perspective, the purpose of scanning is to develop scans that can help you decide which stocks to buy or sell "soon" - i.e. before the data used in the scan changes significantly. The standard scenario is to run your scans after the market closes in preparation for placing orders early the next day. While some of the results from a "within" scan may still be valid, others results may have become invalid by the time the scan is run and, what's worse, you cannot easily tell which is which.

We strongly recommend refining a "within" scan so that it refers instead to "today". For example, take the scan above and turn it into "Show me all the stocks that had a MACD crossover today." You can then use the "Starting" field (at the top of our scan interface pages) to see the results of the scan on any previous day you choose.

February 09, 2009

Learning from Our Predefined Scans

By Chip Anderson
Example

On our Predefined Stock Scans page, we have over 60 scans that we run each day after the market closes. We publish the results here and while that page is useful, what many people don't realize is that you can load any of these scans into our Standard Scan Interface for examination and modification. In this tutorial, we'll see how the "Strong Volume Gainers" scan works and then customize it to meet our needs better.

Continue reading "Learning from Our Predefined Scans" »

February 08, 2009

Scanning for Cross-Overs

By Chip Anderson
Technique

Scanning for cross-overs is a simple concept that all Scan Engine users need to master before moving on to the more difficult techniques. There are four different kinds of cross-overs.  Let's look at each of them:

(Note: Unless otherwise noted, all of the examples in this article are meant for use with the Standard Scan Workbench.)

1.) The Price Cross-over

A price cross-over happens when a stock's price moves from one side of a price overlay line to the other. A great example of this kind of scan signal is when a stock's price moves above its 200-day moving average. Other examples include prices crossing above the upper Bollinger Band or one moving average crossing above a different moving average. The same technique can be used to scan for Parabolic SAR signals too. As with all cross-over scans, the key is to realize that the scan actually contains two different conditions. For a cross-over to happen, the stock's price must be below the overlay line on one day and above the overlay line on the next day. Breaking that down into statements that the Scan Engine can understand results in something like this:

Continue reading "Scanning for Cross-Overs" »

February 04, 2009

Michael Daumer's Momentum Buy Signal Scan

By Chip Anderson
Example

Definition

Here's our first "Advanced" scan. You'll need to use the "Advanced Scan Interface" to create it. The scan looks for consensus among a stocks Moving Averages, its RSI, and its MACD indicators. Basically, if four different signals have just become true for a given stock, that stock is returned by the scan as a potential buy candidate. The four signals are:

  • The 5-day moving average is above the 15-day moving average
  • The 14-day RSI is above 50
  • The standard MACD line is above its signal line
  • The standard MACD line is above zero

Continue reading "Michael Daumer's Momentum Buy Signal Scan" »

February 04, 2009

Anargyros Economou's Stochastic Pop Scan

By Chip Anderson
Example

Definition

This scan identifies stocks ready for a possible short-term upward move. It uses Slow Stochastic's to help identify pivot points at which bulls are gaining strength. I use a 9-bar Slow Stochastic (smoothed over a 3-day period) with Nasdaq stocks with 60-day average volume greater than 200K, and average share price greater than $5.00 for the past 60 days. Additionally, the close for today is greater than the close of yesterday to further identify stocks gaining strength. This scan identifies bullish strength when closing prices continue to be at the high of a particular days trading range. I use Slow Stochastic's because it does a better job of screening out noise associated from market volatility.

Continue reading "Anargyros Economou's Stochastic Pop Scan" »