New Members: Be sure to confirm your email address by clicking on the link that was sent to your email inbox. You will not be able to post messages until you click that link.

Scan results seem to be incorrect

edited February 2019 in Scanning
I ran a very simple scan for Bollinger Bands and set it with "Starting 14 trading days before the Last Market Close (8 Feb). But what I get are some stocks that do NOT meet the scan's conditions 14 days ago (Jan 18th). I also changed the number of 'trading days ago' (like 5, 7, etc) and again it seems the engine produces incorrect results. Here is the scan:

[type = stock]
and [country = us]
and [group is not ETF]
and [Close > 10] and
and [Volume > 100000]
and [Min(1,BB Width(20,2)) < 5]
and [%B(20,2) < .8]
and [%B(20,2) > .2]

Specifically, the [Min(1,BB Width(20,2)) < 5] is not met in many of the scan results for Jan 18th (it shows the BB Width value to be > 5.
Any idea why? Am I missing something?
Thx, George

Best Answers

  • gordgord admin
    Answer ✓
    Hi George,
    Just tried your scan, I had to remove the extra "and" at the end of the forth line, to avoid a syntax error.

    and [Close > 10] and

    I got 31 hits for Jan 18th and upon checking the charts all met the bollinger band width and percent criteria.

    Just a guess, but if you didn't notice the error message, then each time you re-run the scan with changes you would be looking at some previous version of the scan output. IE if the scan doesn't run the output page is not updated with any new results.

    This is one of my hits shown in the chart setup I used for verification.

    Let us know if you are still having problems.
    cheers Gord

  • markdmarkd mod
    Answer ✓
    Well, if you add this line to the end of the scan

    rank by Min(1,BB Width(20,2))

    you will see what the scan engine gets for BB Width values on the results page. They are all under 5.

    It appears that all the charts are correct, too.

    If you ran the scan during the market day, you have to be sure the scan and the charts are set to the same last update.

    If you run the scan as of the previous close, but you look at the chart as of the latest update (e.g., 2:07 pm) during market hours, the results may not match because prices have changed since the last close, which was the data used for the scan. End of day is around 6 pm eastern, so if you run scans after 4pm but before 6, you can get different results also.

    So, to check your results, set the scan to the previous close, and set the chart to the previous close as well using start/end for the chart time period.
  • lmkwinlmkwin ✭✭
    Answer ✓
    I get 31 results. All appear to have a BB% between 0.2 and 0.8, and the BB Width < 5 on the 18th.


  • Did you try it without the min(1,...) ?

    Min(1,..) would be the indicator value itself for the curent period, so it's not necessary to use min( ). It may be that the min() condition is programmed to expect min(2, ) or greater, so that line, even though it doesn't trigger a syntax error, may not be executing as expected. Just a thought.
  • Tried it without the min(1...), that is: [BB Width(20,2) < 5] instead of: [Min(1,BB Width(20,2)) < 5].
    No difference! same stocks, same # of hits and still many violate the BB Width(20,2) < 5 (some also violate the %BB range).
  • Examples of stocks not meeting the scan?

  • Issue resolved.
    gord - many thanks! ... lesson learned: ALWAYS RUN THE "Check Syntax", which I missed so many times (:

    markd - thanks for the insight on making sure that " ... the scan and the charts are set to the same last update"; I sure learned that lesson long ago (one being set to Intraday and the other to EOD).

    Imkwin - thanks to you too for responding and trying to help.

    Appreciate ALL OF YOU !!!
  • I put Horizontal Line overlays on the BB% (0.2,0.8) and the BB Width (5.0) window for clarity
Sign In or Register to comment.