 # Include 1 and 2.5 deviations to Bollinger Bands

#### Aliikhatami

##### New member
VIP
I'm looking for an edit to Bollinger band indicator. so statistically speaking, Bollinger bands show you how far the price is moving from its moving averages and that's based on standard deviations which shows the statistical significance of that price level. so based on that you know how likely it is for the price action is to stay there and as if its gonna start moving closer to its average and eventually reverse. so with that I have been using 2 Bollinger bands with std of 1 and another with std of 2.5. I short the future or stock when its below its 10 and 20 moving averages and also crossing below 1std from BBand with 10 moving average and start covering my position and trimming when it reaches the 2.5 standard deviation and taking profits. that being said, to make it easer to recognize the entry I was looking for a version of BBands that highlights the area between the 2 upper bands and 2 lower bands of 2 BBands with one being standard deviation of 1 and another 2.5. please let me know if that's possible. thank you!

entry example on 1h chart of /ES: Last edited by a moderator:

#### BenTen

Staff member
Staff
VIP
Is this what you're looking for?

Code:
``````# Bollinger Bands with Cloud
# TD Ameritrade IP Company, Inc. (c) 2007-2020
#

input price = close;
input displace = 0;
input length = 20;
input Num_Dev_Dn = -2.0;
input Num_Dev_up = 2.0;
input averageType = AverageType.Simple;

def sDev = stdev(data = price[-displace], length = length);

plot MidLine = MovingAverage(averageType, data = price[-displace], length = length);
plot LowerBand = MidLine + num_Dev_Dn * sDev;
plot UpperBand = MidLine + num_Dev_Up * sDev;

LowerBand.SetDefaultColor(GetColor(0));
MidLine.SetDefaultColor(GetColor(1));
UpperBand.SetDefaultColor(GetColor(5));

#### Aliikhatami

##### New member
VIP
so if you can add another bollinger band with sd of 1 and only highlight the area between the 2 upperS and 2 lowerS then would be perfect! @BenTen
area around moving average should be empty and not highlighted

Last edited:

#### Aliikhatami

##### New member
VIP
@horserider not this. its a different strategy. i got it to work though. i highlighted the 1std and that keeps the outer area unhighlighted. love it. thank you

#### BenTen

Staff member
Staff
VIP
@Aliikhatami Here you go:

Code:
``````#
# Double Bollinger Bands
# Assembled by BenTen at useThinkScript.com
# Based on request/concept of @aliikhatami

input price = close;
input displace = 0;
input length = 20;
input Num_Dev_Dn1 = -1.0;
input Num_Dev_up1 = 1.0;
input Num_Dev_Dn3 = -3.0;
input Num_Dev_up3 = 3.0;
input averageType = AverageType.EXPONENTIAL;

def sDev = stdev(data = price[-displace], length = length);

plot MidLine = MovingAverage(averageType, data = price[-displace], length = length);
plot LowerBand1 = MidLine + num_Dev_Dn1 * sDev;
plot UpperBand1 = MidLine + num_Dev_Up1 * sDev;
plot UpperBand3 = MidLine + num_Dev_Up3 * sDev;
plot LowerBand3 = MidLine + num_Dev_Dn3 * sDev;

• mrmac and jacqshen

#### Aliikhatami

##### New member
VIP
thank you so much man this is AWESOME!

#### Brain Monkey

##### New member
Here is a slight tweak that makes the clouds translucent so they don't over take the screen.
Code:
``````#
# Double Bollinger Bands with translucent clouds.
# Assembled by BenTen at useThinkScript.com
# Based on request/concept of @aliikhatami
# Slightly touched up by some spitball no name.

input price = close;
input displace = 0;
input length = 20;
input Num_Dev_Dn1 = -1.0;
input Num_Dev_up1 = 1.0;
input Num_Dev_Dn3 = -3.0;
input Num_Dev_up3 = 3.0;
input averageType = AverageType.EXPONENTIAL;

def sDev = stdev(data = price[-displace], length = length);

plot MidLine = MovingAverage(averageType, data = price[-displace], length = length);
plot LowerBand1 = MidLine + num_Dev_Dn1 * sDev;
plot UpperBand1 = MidLine + num_Dev_Up1 * sDev;
plot UpperBand3 = MidLine + num_Dev_Up3 * sDev;
plot LowerBand3 = MidLine + num_Dev_Dn3 * sDev;

AddCloud(UpperBand1, UpperBand3, createcolor(000, 090, 000), createcolor (000, 090, 000));

AddCloud(LowerBand1, LowerBand3, createcolor(100, 000, 000), createcolor (100, 000, 000));``````

• BenTen

#### Brain Monkey

##### New member
So I take 2 studies and overlap them. I set one cloud at 1 and 3 Std Dev and the second cloud I set at 2 and 3 Std Dev. Right now I only use it on my daily chart with 20 SMA. #### thaisangcr7

##### New member
VIP
@BenTen Hi, ben I need help with coloring inside those bands. Can you help me with that?