Troubleshooting Scans Tutorial 1

Troubleshooting Scans Tutorial 1

This tutorial will walk you step-by-step through troubleshooting a scan that is unexpectedly returning zero results. Our scanning tutorials assume just a basic knowledge of common technical indicators and chart patterns. This tutorial may build on skills learned in prior scanning tutorials. Links to these prior tutorials are provided where appropriate.

By the end of this tutorial, you will be able to troubleshoot a scan that does not return any results, determining which specific clause is causing the problem, and using different strategies to fix the problem. Once you've mastered these skills, be sure to check out our other scanning tutorials to learn about and practice other aspects of scanning.

Tip: We recommend printing out this page so you can refer to it as you follow along on your computer.

Running the Scan

Step 1:

Open the Advanced Scan Workbench and add the following scan clauses in the Scan Criteria Box:

[type = stock]
and [daily sma(20,daily volume) > 40000]
and [Upper BB (20,2) < close]
and [RSI (14) > 50.0]
and [%B (20,2) < 0]
and [close > 12]

This is a relatively simple scan, searching for stocks that meet basic price and volume requirements and have desirable values for three different technical indicators.

Step 2:

Click the Check Syntax button to make sure everything was typed in correctly, then click Run Scan.

If you are not familiar with the process for running a scan in the Advanced Scan Workbench, we recommend accessing our tutorial on this topic, which will help you build and run the scans like the one listed above.

Step 3:

Check out the scan results in the new browser window (or new tab in your current browser window) that opens up. Notice that zero results are returned. Even though there were no errors when you clicked the Check Syntax button, something is clearly wrong. We would expect a simple scan like this to get several results.

Determining the Problem Clause

When you have a long scan with multiple clauses, it can be difficult to narrow it down to the specific clause that is causing problems. The best way to do this is to use comments to temporarily disable/remove clauses from your scan. Start by commenting out all but the first clause, then add clauses back one at a time until you no longer receive any results for the scan. The clause that you just added back in is the problem clause.

Step 4:

Put two forward slashes in front of each clause (except the first one), turning those clauses into comments that will be ignored by the scan engine:

[type = stock]
// and [daily sma(20,daily volume) > 40000]
// and [Upper BB (20,2) < close]
// and [RSI (14) > 50.0]
// and [%B (20,2) < 0]
// and [close > 12]

Step 5:

Click the Check Syntax button, then click Run Scan and check out the scan results. With all clauses disabled except for the first one, you should see 999 results. This scan is essentially just searching for all stocks in our database.

Step 6:

Uncomment the clause about the SMA (simple moving average) of volume, then run the scan again. You should still get 999 results.

Step 7:

Uncomment the clause about the Upper BB indicator, then run the scan again. You should still get hundreds of results.

Step 8:

Uncomment the clause about the RSI indicator, then run the scan again. You should still get many results.

Step 9:

Uncomment the clause about the %B indicator, then run the scan again.

At this point, you should suddenly get zero results. This %B clause is likely our problem clause, and that is where we want to concentrate our troubleshooting efforts.

Investigating the Problem Clause

Getting zero results for your scan can be caused by any number of issues. Typos in your clause, not using the intended values or operators, scanning for something that will never be true (e.g. scanning for stocks where the close is greater than the high for the day), and contradictory clauses (where two clauses are searching for two things that are unlikely to ever occur together).

Step 10:

Click the Check Syntax button to check for typos.

Understand that just because you pass the syntax check, it doesn't mean there aren't typos in your scan. The check can determine if you've spelled the name of an indicator incorrectly, for example, but it can't tell that you meant to search for an RSI value greater than 70 instead of 90. For those kinds of issues, you just have to scrutinize the problem clause closely to make sure it really matches up with your scan requirements.

The trickiest kind of issue is a contradictory clause. In that situation, you need to look beyond your problem clause and look at how it might interact with other clauses in the scan. In our example above, what we have is a contradictory clause: the %B clause, as written, requires the closing price to be below the lower Bollinger band, but the Upper BB clause says that the price is above the upper Bollinger band. No stocks can be both above the upper and below the lower band at the same time.

Correcting the Problem Clause

Once you've found the problem, you need to correct the scan syntax. Of course, the way to correct it may vary from person to person. In this case, perhaps we meant for %B to be greater than zero. Or maybe it wasn't about that clause at all: instead, perhaps we meant for the close to be below the upper Bollinger band instead of above it. Or maybe we meant to have a date modifier on the %B clause, so we would look for stocks that were below the lower band last week, but are above the upper band today. Only you know what your scan is supposed to be scanning for, so only you can fix it.

Step 11:

Correct the example scan so that the clauses are no longer contradictory, in whatever way you would like. For example, you can correct it to scan for %B to be greater than zero:

and [%B (20,2) > 0]

Step 12:

Run the corrected scan to confirm that you now get results.

Step 13:

Once you are happy with your scan, be sure to save it, so you can easily run it again at a later date.

If you are not familiar with the process for saving your scan in the Advanced Scan Workbench, we recommend accessing our first Writing Scans Tutorial, which will walk you step by step through saving your scan.

Learn More

Now that you've learned some techniques for troubleshooting scans that get no results, check out our second Troubleshooting Scans Tutorial and learn more about how to fix your scan when it returns too many results.

For more in-depth information on writing and troubleshooting scans, please check out our Writing Scans and Troubleshooting Scans articles in the Support Center.