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));
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);
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/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));
I used your study on $DIS yesterday bouncing off center band, Scalped it . Love the study !! Thanks again .
It is good to learn that you can use my indicator to make money.I used your study on $DIS yesterday bouncing off center band, Scalped it . Love the study !! Thanks again .
This is awesome work bro.It is good to learn that you can use my indicator to make money.
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.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?
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
![]() |
Req: Daily Change By Weighted Sector | Questions | 0 | |
B | Daily high/low bubble that displays TIME | Questions | 13 | |
B | Daily High Low Lines +Bubbles | Questions | 2 | |
K | Last bar of daily RSI movement on intraday chart | Questions | 1 | |
S | Daily Candle on One Minute Chart | Questions | 4 |
Start a new thread and receive assistance from our community.
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.
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.