Bollinger Bands Format, Watchlist, Label, Scan For ThinkOrSwim

@rad14733 No luck, I cant find any stocks which are touching lower band and or outsider lower band
During regular trading hours...??? I only tested it on GDX because I already had the chart up so I just added the script as a lower study... It fired off more than a few times before I finally removed the study... It was just your code with the two alert lines added... I never bothered to check the semantics of your code, just added the alerts based on your plot conditions...
 
I love the lime candle for upper band and magenta color for the lower band but how do I keep the other colors of the candles its default colors (red/green) instead of gray?
This code will keep your default red/green if it is not upper or lower band.

Code:
# Bollinger Band with High Low Colored
# tomsk
# 12.14.2019

# V1.0 - 12.11.2019 - tomsk - Standard TOS BB tagged with BLUE candles when close above the upper band
# V1.1 - 12.14.2019 - tomsk - Adjustments to make display visually more distinctive and added alarms

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;

MidLine.SetDefaultColor(Color.YELLOW);
LowerBand.SetDefaultColor(Color.CYAN);
UpperBand.SetDefaultColor(Color.GREEN);

AssignPriceColor(if close > UpperBand then Color.LIME else if close < LowerBand then Color.MAGENTA else color.CURRENT);

Alert(close crosses above UpperBand, "BB cross above Upper", Alert.BAR, Sound.Ring);
Alert(close crosses below LowerBand, "BB cross below Lower", Alert.BAR, Sound.Bell);
# End Bollinger Band
 
I'm almost certain it must be on useThinkScript somewhere. I am looking for a simple Bollinger band to put on my price chart that will change colors in a period of price expansion, price contraction, or a period of price doing relatively nothing. Please drop me a line. Thank you, C-Note Johnson
 
I'm almost certain it must be on useThinkScript somewhere. I am looking for a simple Bollinger band to put on my price chart that will change colors in a period of price expansion, price contraction, or a period of price doing relatively nothing. Please drop me a line. Thank you, C-Note Johnson
You, essentially, want rainbow or trend indicating Bollinger Bands which is nothing more than three trend indicating bands...
 
You, essentially, want rainbow or trend indicating Bollinger Bands which is nothing more than three trend indicating bands...
Hello rad14733, I am looking for Bollinger bands much like the ones included in the " Bollinger bands with MACD ". This was an indicator that I got from Horserider. It is exactly what I need. Thank you, C-Note Johnson
 
Hello rad14733, I am looking for Bollinger bands much like the ones included in the " Bollinger bands with MACD ". This was an indicator that I got from Horserider. It is exactly what I need. Thank you, C-Note Johnson
But you want an upper indicator, correct...???
 
Thanks rad14733, I need Bollinger bands on the top and bottom. So two lines total. Check out " Bollinger bands with MACD " from horserider. I currently use that indicator every day. Thanks again. C-Note Richards.
 
Have you tried dragging a copy of that lower indicator into the upper indicator section by chance...???

I had to hunt around because that indicator is actually horseriders Ultimate MACD...
 
Hey rad14733, When you move a copy of " Ultimate MACD " into the top chart that has price candles, it makes a MESS : ) !
Ok... So you just want trending Bollinger Bands... I may have some kicking around, otherwise I can whip them up later...
 
Ok... So you just want trending Bollinger Bands... I may have some kicking around, otherwise I can whip them up later...
Yes. Bollinger bands that change colors for divergence, convergence, and another color for chop/aimless price drift. Sounds good, C-Note Johnson.
 
@C-Note Johnson Here is a quick edit of one of my existing Bollinger Band Studies... If you prefer, you can switch the trending bands to use MidLine instead of UpperBand and LowerBand for color change... Let me know if this is what you were looking for... And if you want, there is a line you can un-comment to enable clouds...

Ruby:
# Acrylic_BollingerBands
# Modified by rad14733
# Added trend indicating midLine
# Added optional cloud between bands
# Added trend indicating upper and lower bands per request from C-Note Johnson 2021-01-06

input price = close;
input displace = 0;
input length = 21;
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);
MidLine.AssignValueColor(if MidLine > MidLine[1] then Color.LIME else if MidLine < MidLine[1] then Color.MAGENTA else Color.LIGHT_GRAY);
MidLine.SetLineWeight(2);

plot UpperBand = MidLine + num_Dev_Up * sDev;
UpperBand.AssignValueColor(if UpperBand > UpperBand[1] then Color.LIME else if UpperBand < UpperBand[1] then Color.MAGENTA else Color.LIGHT_GRAY);
#UpperBand.SetDefaultColor(Color.WHITE);
#UpperBand.SetDefaultColor(CreateColor(50, 150, 250));
UpperBand.SetLineWeight(2);

plot LowerBand = MidLine + num_Dev_Dn * sDev;
LowerBand.AssignValueColor(if LowerBand > LowerBand[1] then Color.LIME else if LowerBand < LowerBand[1] then Color.MAGENTA else Color.LIGHT_GRAY);
#LowerBand.SetDefaultColor(Color.WHITE);
#LowerBand.SetDefaultColor(CreateColor(50, 150, 250));
LowerBand.SetLineWeight(2);

#AddCloud(LowerBand, UpperBand, Color.GRAY, Color.GRAY);
 
Hello,

So I'm trying to write a script for a stocks current price that is below the lower band of the Bollinger band. So far, every script I've written has never shown an error on this word and I don't know what to do to fix it.
everything is good and accepted except for the word "condition" on the very last line. any idea why its not working? I think it has something to do with the Constant--> Price Type--> (PriceType.Last or PriceType.Bid or PriceType.Ask), which is something I haven't used yet.

Also, I seem to be having trouble adding the code and the above paragraph in the original post, I have to edit my post to add either the body text or the code after I post, Any ideas why this is happening?
Code:
#Hint: stocks that are below the lowerband during the day heading into the close

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;

input currentprice = PriceType.LAST;


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

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


plot condition = currentprice < lowerBand;

# The word "condition" above is the only word that shows up with the red box.f
 
No need to make it complicated. Use the conditional wizard.

6VV6ikw.png
 
No need to make it complicated. Use the conditional wizard.
the only issue with this is I want to choose the last price, as I want to do this scan before the market closes, like the last 30 minutes of the day.

The other thing is I see that there is a hl2, hlc3, and a ohlc4. why isn't there a ohl3 function? seems that would be most useful for during the day before the close.
 
@mourningwood4521 First, TOS doesn't like you use of the variable "condition"... I replaced it with "trigger" and that fixed that issue... Now I'm working on a new error - "incompatible parameter: currentprice", expected double... And that is because you are still trying to use Last in a way it can't be used... Switching it to Close, like I stated above, the code verifies... The code below verifies and can be saved... Whether it performs as you desire is subjective as I didn't try it...

Ruby:
#Hint: stocks that are below the lowerband during the day heading into the close

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;

input currentprice = close;


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

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


plot trigger = currentprice < lowerBand;

# The word "condition" above is the only word that shows up with the red box.f
 
@mourningwood4521 First, TOS doesn't like you use of the variable "condition"... I replaced it with "trigger" and that fixed that issue... Now I'm working on a new error - "incompatible parameter: currentprice", expected double... And that is because you are still trying to use Last in a way it can't be used... Switching it to Close, like I stated above, the code verifies... The code below verifies and can be saved... Whether it performs as you desire is subjective as I didn't try it...
when I try replacing it with trigger it gives me the same red box over the word trigger.

Im thinking hmmm....

I replaced the Price Type to "low" and it accepted that term. I just have to filter through about 30 stocks to see if they have bounced off the low or are currently trading near the low of the day

DO you think it would be possible to make the system find the (high + low + close) divided by 3? just cuz I don't see that option incorporated into the system.
 

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
394 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