Select Page

# Widening Bollinger Bands

Optuma Forums Optuma Scripting Widening Bollinger Bands

This topic contains 3 replies, has 2 voices, and was last updated by  Matthew 10 months, 2 weeks ago.

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

Jennifer
• Topics: 4
• Replies: 3
• Posts: 7

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
• Topics: 4
• Replies: 89
• Posts: 93

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).

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

#46495

Jennifer
• Topics: 4
• Replies: 3
• Posts: 7

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
• Topics: 4
• Replies: 89
• Posts: 93

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.