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 only a basic knowledge of common technical indicators and chart patterns. This tutorial may build on skills learned in prior scanning tutorials (links are provided where appropriate).

By the end of this tutorial, you will be able to troubleshoot a scan that does not return any results, determine which specific clause is causing the problem and use 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 or opening it in another tab so that 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 Editor 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 has been 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, as we would normally 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). This will turn 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 2000 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 2000 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; consequently, 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. Examples of such issues include: 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), contradictory clauses (where two clauses are searching for two things that are unlikely to ever occur together), etc.

Step 10:

Click the “Check Syntax” button to check for typos.

You should understand that passing the syntax check doesn't necessarily mean there aren't any 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 will 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. Alternatively, it may not about that clause at all; perhaps we meant for the close to be below the upper Bollinger band instead of above it. Another possibility is that we might have 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, as shown below:

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 that 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 to 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.