BB shading

Rogue Trader

New member
Has anyone posted a mod for the TOS BB indicator to allow background shading so you can eliminate the lines and just see shading between lines similar to Tradingview??
 
Solution
Has anyone posted a mod for the TOS BB indicator to allow background shading so you can eliminate the lines and just see shading between lines similar to Tradingview??

i have no idea what things look like on trading view.
when asking strangers for help, it is best to provide as much information as possible, to help them help you.
include a link to a study or an image showing what you want.

i guessed and made this,
this draws 2 clouds, between the 3 lines.
can turn the lines and clouds on/off.

Code:
# BollingerBands_shading_0

# BollingerBands
# TD Ameritrade
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...
Has anyone posted a mod for the TOS BB indicator to allow background shading so you can eliminate the lines and just see shading between lines similar to Tradingview??

i have no idea what things look like on trading view.
when asking strangers for help, it is best to provide as much information as possible, to help them help you.
include a link to a study or an image showing what you want.

i guessed and made this,
this draws 2 clouds, between the 3 lines.
can turn the lines and clouds on/off.

Code:
# BollingerBands_shading_0

# BollingerBands
# TD Ameritrade
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);
def MidLine = MovingAverage(averageType, data = price[-displace], length = length);
def UpperBand = MidLine + num_Dev_Up * sDev;
def LowerBand = MidLine + num_Dev_Dn * sDev;

input show_lines = no;
plot UpperBand2 = UpperBand;
plot MidLine2 = MidLine;
plot LowerBand2 = LowerBand;
#UpperBand.SetDefaultColor(GetColor(5));
#MidLine.SetDefaultColor(GetColor(1));
#LowerBand.SetDefaultColor(GetColor(0));
UpperBand2.SetDefaultColor(color.orange);
MidLine2.SetDefaultColor(color.cyan);
LowerBand2.SetDefaultColor(color.magenta);
UpperBand2.SetHiding(!show_lines);
MidLine2.SetHiding(!show_lines);
LowerBand2.SetHiding(!show_lines);

def na = double.nan;
def bn = barnumber();
def mid_dir = if bn == 1 then 0 else if midline > midline[1] then 1 else -1;

input show_simple_clouds = yes;
def top1 = if show_simple_clouds then UpperBand else na;
def mid1 = if show_simple_clouds then midline else na;
def bot1 = if show_simple_clouds then lowerBand else na;

addcloud(top1,mid1,color.gray, color.gray);
addcloud(mid1,bot1,color.light_gray, color.light_gray);
#
 
Solution
Code:
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));

DefineGlobalColor("Bullish", Color.light_green);
DefineGlobalColor("Bearish", Color.light_RED);
AddCloud(UpperBand,  LowerBand,  GlobalColor("Bullish"),  GlobalColor("Bearish"));

def EMA8 = ExpAverage(close, 8);
def EMA20 = expAverage(close, 20);

#AddLabel(price, "8 EMA: $" + Round (EMA8,2) + " ", (if price > EMA8 then  CreateColor(0, 150, 0) else if price < EMA8 then createcolor(165,15,10) else Color.LIGHT_GRAY));

#AddLabel(price, "20MA: $" + Round (midline,2) + " ", (if price > midline then color.uptick else if price < midline then color.red else Color.LIGHT_GRAY));

Another way of shading Bollinger Bands
 
i have no idea what things look like on trading view.
when asking strangers for help, it is best to provide as much information as possible, to help them help you.
include a link to a study or an image showing what you want.

i guessed and made this,
this draws 2 clouds, between the 3 lines.
can turn the lines and clouds on/off.

Code:
# BollingerBands_shading_0

# BollingerBands
# TD Ameritrade
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);
def MidLine = MovingAverage(averageType, data = price[-displace], length = length);
def UpperBand = MidLine + num_Dev_Up * sDev;
def LowerBand = MidLine + num_Dev_Dn * sDev;

input show_lines = no;
plot UpperBand2 = UpperBand;
plot MidLine2 = MidLine;
plot LowerBand2 = LowerBand;
#UpperBand.SetDefaultColor(GetColor(5));
#MidLine.SetDefaultColor(GetColor(1));
#LowerBand.SetDefaultColor(GetColor(0));
UpperBand2.SetDefaultColor(color.orange);
MidLine2.SetDefaultColor(color.cyan);
LowerBand2.SetDefaultColor(color.magenta);
UpperBand2.SetHiding(!show_lines);
MidLine2.SetHiding(!show_lines);
LowerBand2.SetHiding(!show_lines);

def na = double.nan;
def bn = barnumber();
def mid_dir = if bn == 1 then 0 else if midline > midline[1] then 1 else -1;

input show_simple_clouds = yes;
def top1 = if show_simple_clouds then UpperBand else na;
def mid1 = if show_simple_clouds then midline else na;
def bot1 = if show_simple_clouds then lowerBand else na;

addcloud(top1,mid1,color.gray, color.gray);
addcloud(mid1,bot1,color.light_gray, color.light_gray);
#
Can you please add an audio alert when price crosses the midline of the Bollinger Bands?
 

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

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
537 Online
Create Post

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