Widening Bollinger Bands

Optuma Forums Optuma Scripting Widening Bollinger Bands

This topic contains 3 replies, has 2 voices, and was last updated by Matthew Matthew 6 months, 1 week ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #46359

    Jennifer
    • Topics: 3
    • Replies: 3
    • Posts: 6

    Good Morning,
    I have been using Bollinger Bands on my charts.
    The settings I have are 20 periods with a standard deviation of 2.
    I have been trying to work out how to write a script that I can put in a scan to identify when the current period has the upper and lower bollinger bands widening. That is, that the gap between them is greater than the gap between them of the previous period on the chart.

    Thank you,
    Best regards,
    Jennifer 

    #46363
    Matthew
    Matthew
    • Topics: 3
    • Replies: 75
    • Posts: 78

    Hi Jennifer,

    The Vergence() function will be able to produce the results you are after.

    Using the same Bollinger Band settings in your post, the following script is one example:

    B1 = BB(BARS=20).UpperLine ;

    B2 = BB(BARS=20).LowerLine ;

    VERGENCE(B1,B2, TYPE=Divergence)

    You can adjust the script in increase or decrease the number of consecutive days the lines need to be widening for a positive result (by default it is 2 days).

    Ex9

    Green shaded zones are examples of where the script will trigger.

     

    #46495

    Jennifer
    • Topics: 3
    • Replies: 3
    • Posts: 6

    Thanks Mathew,

    I want the script to trigger after just 1 period of the band distance being wider.

    The default setting of 2 appears to be the least number of days. Is it possible to change it to 1, as I want it to trigger when the lines have widened for 1 day only.

    I can change it to more than 2, but 2 seems to be the minimum.

    #46499
    Matthew
    Matthew
    • Topics: 3
    • Replies: 75
    • Posts: 78

    Hi Jennifer,

    For a single day you’d use the following…

    B1 = BB(BARS=20).UpperLine ;

    B2 = BB(BARS=20).LowerLine ;

    B1 IsUp and B2 IsDown

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

Pin It on Pinterest

Share This

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close