10min BollingerBands on 30min chart

Tsw85

New member
Good Day useThinkscript Community,

Can anyone please help me write a simple script to display the 10minute Bollinger Bands while using a 30minute chart?

I've used the below thinkscript to plot moving averages of different timeframes & perhaps this can be used as a template.

Thanks for your time

input Period = aggregationPeriod.month;
input AvgType = averageType.SIMPLE;
input Length = 50;
input priceclose = close;

plot AVG = MovingAverage(AvgType, close(period = Period), Length);
AVG.setdefaultcolor(color.cyan);
 
Solution
Thanks SleepyZ.

What would the code look like to display 30min BollingerBands on a 10min chart?

Sure, here it is

Capture.jpg
Ruby:
#
# TD Ameritrade IP Company, Inc. (c) 2007-2022
#

input agg = aggregationPeriod.THIRTY_MIN;
input price = fundamentalType.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 = fundamental(price, period=agg)[-displace], length = length);

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

SleepyZ

Well-known member
VIP
Lifetime
Good Day useThinkscript Community,

Can anyone please help me write a simple script to display the 10minute Bollinger Bands while using a 30minute chart?

I've used the below thinkscript to plot moving averages of different timeframes & perhaps this can be used as a template.

Thanks for your time

input Period = aggregationPeriod.month;
input AvgType = averageType.SIMPLE;
input Length = 50;
input priceclose = close;

plot AVG = MovingAverage(AvgType, close(period = Period), Length);
AVG.setdefaultcolor(color.cyan);
Sorry, but you can only display indicators with timeframes that are greater than or equal to the timeframe of the chart you are using.
 

SleepyZ

Well-known member
VIP
Lifetime
Thanks SleepyZ.

What would the code look like to display 30min BollingerBands on a 10min chart?

Sure, here it is

Capture.jpg
Ruby:
#
# TD Ameritrade IP Company, Inc. (c) 2007-2022
#

input agg = aggregationPeriod.THIRTY_MIN;
input price = fundamentalType.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 = fundamental(price, period=agg)[-displace], length = length);

plot MidLine = MovingAverage(averageType, data = fundamental(price, period=agg)[-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));
 
Solution

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