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.

Trying to scan for a large one-day move in Bollinger Band Width

The Bollinger Band 'Width' indicator seems to subtract the Lower Bollinger Band @ default setting of (20,2) from the Upper Bollinger Band @ default setting of (20,2). It appears to just return that integer number value. For instance, if the Upper Band = 25 and the Lower Band = 16 then with Width for that day = 9.

I'm trying to write a scan to find this condition:

1.5 * today's Bollinger Band Width > Yesterday's Bollinger Band Width

AND

1.49 * today's Bollinger Band Width < Yesterday's Bollinger Band Width.

I'm trying to scan for a LARGE one-day change in the Width number. I can't make the scan engine like the word 'AND' no matter how I type this in.

Any hints or suggestion from better programmers than me? which is most people, FYI.

thanks

Comments

  • markdmarkd mod
    edited September 2016
    Hi @WGFF ,

    (Note: Not saying I'm a better programmer - those days are long over - maybe just a little more experience with this platform :))

    Start over with a new scan to clear the decks. Then, instead of typing in your condition directly, try inserting BB Width(20,2) from the Technical Indicator drop down in the Scan Builder section (twice, since you are comparing two instances) and then edit the two lines together to make the condition you want (adding the 1 day ago and the 1.5). That way, you are at least starting out with correct syntax. Then when you change something and you get an error, you know that change is the problem (hit Check Syntax after each change, even if the change doesn't make logical sense yet, until you get the statement you want).

    I would concentrate on getting the first condition right first.

    I'm not sure what you are getting at with the second condition - a sudden narrowing of the BBs? If so, you wouldn't put them in the same scan with an "AND" conjunction , because the BB Width cannot be both wider AND narrower than yesterday's BB Width.

    It would probably make more sense to put the narrowing condition in a separate scan just to keep things simple (always the best approach, unless a complication is absolutely necessary).

    But, if you want them in the same scan, so you get dramatic widening BBs OR a dramatic narrowing BBs, you would join the two statements with an "OR" conjunction:

    [group is sp500] // or whatever you want

    and

    [

    [wider width condition ]

    or

    [narrower width condition]

    ]

    Notice the extra set of brackets around all the conditions connected by the "or" conjunction.

    You could also format these lines this way

    [group is sp500]

    and [ [wider width condition] or [narrower width condition ] ]

    I think the first way is clearer, but its up to you.
Sign In or Register to comment.