Daily Bollinger Bands

Buckbull

Active member
Is there a study that allows you to overlay the Daily Bollinger Bands on a lower time frame chart ? Thanks
 
I create an indicator which can show daily Bollinger Bands in hourly time frame. You can choose aggregation periods to show Bollinger Bands for different timeframes from the indicator properties.
Ruby:
input price = FundamentalType.CLOSE;
input aggregationPeriod = AggregationPeriod.DAY;
input displace = 0;
input length = 20;
input Num_Dev_Dn = -2.0;
input Num_Dev_up = 2.0;
input averageType = AverageType.SIMPLE;
input aggregationPeriod1 = AggregationPeriod.HOUR;
input Num_Dev_Dn1 = -2.0;
input Num_Dev_up1 = 2.0;
input length1 = 20;
def sDev = StDev(data = Fundamental(price, period = aggregationPeriod)[-displace], length = length);
plot MidLine = MovingAverage(averageType, Fundamental(price, period = aggregationPeriod), length);
plot LowerBand = MidLine + Num_Dev_Dn * sDev;
plot UpperBand = MidLine + Num_Dev_up * sDev;
LowerBand.SetDefaultColor(GetColor(0));
lowerBand.SetLineWeight(3);
MidLine.SetDefaultColor(GetColor(1));
MidLine.SetLineWeight (3);
UpperBand.SetDefaultColor(GetColor(5));
UpperBand.SetLineWeight(3);
def sDev1 = StDev(data = Fundamental(price, period = aggregationPeriod1)[-displace], length = length1);
plot MidLin1e1 = MovingAverage(averageType, Fundamental(price, period = aggregationPeriod1), length1);
plot LowerBand1 = MidLin1e1 + Num_Dev_Dn1 * sDev;
plot UpperBand1 = MidLin1e1 + Num_Dev_up1 * sDev;

LowerBand1.SetDefaultColor(GetColor(3));
MidLin1e1.SetDefaultColor(GetColor(8));
UpperBand1.SetDefaultColor(GetColor(9));
 
Last edited:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Here is an indicator with one daily Bollinger band in a lower timeframe.

Ruby:
input price = FundamentalType.CLOSE;
input aggregationPeriod = AggregationPeriod.DAY;
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 = Fundamental(price, period = aggregationPeriod)[-displace], length = length);
plot MidLine = MovingAverage(averageType, Fundamental(price, period = aggregationPeriod), length);
plot LowerBand = MidLine + Num_Dev_Dn * sDev;
plot UpperBand = MidLine + Num_Dev_up * sDev;
LowerBand.SetDefaultColor(GetColor(0));
lowerBand.SetLineWeight(3);
MidLine.SetDefaultColor(GetColor(1));
MidLine.SetLineWeight (3);
UpperBand.SetDefaultColor(GetColor(5));
UpperBand.SetLineWeight(3);
 
Daily Bollinger bands in a lower timeframe. The partial code is from ThinkorSwim.
Ruby:
input price = FundamentalType.CLOSE;
input aggregationPeriod = AggregationPeriod.DAY;
input displace = 0;
input length = 20;
input Num_Dev_Dn = -2.0;
input Num_Dev_up = 2.0;
input averageType = AverageType.SIMPLE;
input price1 = close;
input displace1 = 0;
input length1 = 20;
input Num_Dev_Dn1 = -2.0;
input Num_Dev_up1 = 2.0;
input averageType1 = AverageType.SIMPLE;
def sDev = StDev(data = Fundamental(price, period = aggregationPeriod)[-displace], length = length);
plot MidLine = MovingAverage(averageType, Fundamental(price, period = aggregationPeriod), length);
plot LowerBand = MidLine + Num_Dev_Dn * sDev;
plot UpperBand = MidLine + Num_Dev_up * sDev;
LowerBand.SetDefaultColor(GetColor(0));
lowerBand.SetLineWeight(3);
MidLine.SetDefaultColor(GetColor(1));
MidLine.SetLineWeight (3);
UpperBand.SetDefaultColor(GetColor(5));
UpperBand.SetLineWeight(3);
def sDev1 = stdev(data = price1[-displace1], length = length1);
plot MidLine1 = MovingAverage(averageType1, data = price1[-displace1], length = length1);
plot LowerBand1 = MidLine1 + num_Dev_Dn1 * sDev1;
plot UpperBand1 = MidLine1 + num_Dev_Up1 * sDev1;
LowerBand1.SetDefaultColor(GetColor(0));
MidLine1.SetDefaultColor(GetColor(1));
UpperBand1.SetDefaultColor(GetColor(5));
 
Last edited:
Daily Bollinger bands in a lower timeframe. The partial code is from ThinkorSwim.
Ruby:
input price = FundamentalType.CLOSE;
input aggregationPeriod = AggregationPeriod.DAY;
input displace = 0;
input length = 20;
input Num_Dev_Dn = -2.0;
input Num_Dev_up = 2.0;
input averageType = AverageType.SIMPLE;
input price1 = close;
input displace1 = 0;
input length1 = 20;
input Num_Dev_Dn1 = -2.0;
input Num_Dev_up1 = 2.0;
input averageType1 = AverageType.SIMPLE;
def sDev = StDev(data = Fundamental(price, period = aggregationPeriod)[-displace], length = length);
plot MidLine = MovingAverage(averageType, Fundamental(price, period = aggregationPeriod), length);
plot LowerBand = MidLine + Num_Dev_Dn * sDev;
plot UpperBand = MidLine + Num_Dev_up * sDev;
LowerBand.SetDefaultColor(GetColor(0));
lowerBand.SetLineWeight(3);
MidLine.SetDefaultColor(GetColor(1));
MidLine.SetLineWeight (3);
UpperBand.SetDefaultColor(GetColor(5));
UpperBand.SetLineWeight(3);
def sDev1 = stdev(data = price1[-displace1], length = length1);
plot MidLine1 = MovingAverage(averageType1, data = price1[-displace1], length = length1);
plot LowerBand1 = MidLine1 + num_Dev_Dn1 * sDev1;
plot UpperBand1 = MidLine1 + num_Dev_Up1 * sDev1;
LowerBand1.SetDefaultColor(GetColor(0));
MidLine1.SetDefaultColor(GetColor(1));
UpperBand1.SetDefaultColor(GetColor(5));
https://www.tradingview.com/script/...-Identify-Overbought-Oversold-Multitimeframe/
 
This is awesome work bro.

however this does not work for lower timeframe....i.e. when I try to plot 3 minutes BB on 5 minutes charges it does not work. 5 min BB on a 3 min chart works.

Can you help tweak this?
A common error when using MTF indicators is trying to use a time frame that is lower than the chart you are posting it on.
On the TOS platform, you can display data from a higher timeframe onto a lower timeframe but not the other way around.

As such, you can overlay 5 min BB on a 3 min but how cannot use 3 minutes BB on 5 minutes chart.
https://tlc.thinkorswim.com/center/...hapter-11---Referencing-Secondary-Aggregation
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
344 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top