MACD with Bollinger Bands Indicator for ThinkorSwim

One of my favorite indicators as of yet. Can someone please help me with a watchlist for the zero line?

Your question is: can the coloring of the zeroline being translated to a watchlist?
The zeroline is painted green if the MACD is above 0 otherwise red.
Here is a watchlist that is painted green when MACD is greater than 0 else red.

Ruby:
# MACD above/below 0 Watchlist
input fast = 12;  input slow = 26;  input Length = 5;
plot nMACD = MACD(fastLength = fast, slowLength = slow, MACDLength = Length);
AssignBackgroundColor(if nMACD>=0 then color.green else color.red);
 
Last edited:
Your question is: can the coloring of the zeroline being translated to a watchlist?
The zeroline is painted green if the MACD is above 0 otherwise red.
Here is a watchlist that is painted green when MACD is greater than 0 else red.

Ruby:
# MACD above/below 0 Watchlist
input fast = 12;  input slow = 26;  input Length = 5;
plot nMACD = MACD(fastLength = fast, slowLength = slow, MACDLength = Length);
AssignBackgroundColor(if nMACD>=0 then color.green else color.red);

Not exactly. I would like to be able to check the watchlist for the bollinger band levels. Is something like this possible?
 
Not exactly. I would like to be able to check the watchlist for the bollinger band levels. Is something like this possible?
Sure, here is MACD Bollinger Band Level Watchlist.

This script defaults to displaying the upper band level number
Change the hashtags to display other levels.
Ruby:
input price = close;
input BBlength = 10;
input BBNum_Dev = 1.0;
input MACDfastLength = 12;
input MACDslowLength = 26;
input MACDLength = 5;

def MACD_Data = MACD(fastLength = MACDfastLength, slowLength = MACDslowLength, MACDLength = MACDLength);


plot BB_Upper = reference BollingerBands(price = MACD_Data, length = BBlength, Num_Dev_Dn = -BBNum_Dev, Num_Dev_Up = BBNum_Dev).UpperBand;

#plot BB_Lower = reference BollingerBands(price = MACD_Data, length = BBlength, Num_Dev_Dn = -BBNum_Dev, Num_Dev_Up = BBNum_Dev).Lowerband;

#plot BB_Midline = reference BollingerBands(price = MACD_Data, length = BBlength, Num_Dev_Dn = -BBNum_Dev, Num_Dev_Up = BBNum_Dev).MidLine;
 
Last edited:
Sure, here is MACD Bollinger Band Level Watchlist.

This script defaults to displaying the upper band level number
Change the hashtags to display other levels.
Ruby:
input price = close;
input BBlength = 10;
input BBNum_Dev = 1.0;
input MACDfastLength = 12;
input MACDslowLength = 26;
input MACDLength = 5;

def MACD_Data = MACD(fastLength = MACDfastLength, slowLength = MACDslowLength, MACDLength = MACDLength);


plot BB_Upper = reference BollingerBands(price = MACD_Data, length = BBlength, Num_Dev_Dn = -BBNum_Dev, Num_Dev_Up = BBNum_Dev).UpperBand;

#plot BB_Lower = reference BollingerBands(price = MACD_Data, length = BBlength, Num_Dev_Dn = -BBNum_Dev, Num_Dev_Up = BBNum_Dev).Lowerband;

#plot BB_Midline = reference BollingerBands(price = MACD_Data, length = BBlength, Num_Dev_Dn = -BBNum_Dev, Num_Dev_Up = BBNum_Dev).MidLine;

Thanks @MerryDay! This is close lol is there anyway I can get the watchlist level column for the lines and dots?
 
The script you referenced is different from other pivot repainters.
With other pivot scripts, it is expected for pivots to repaint when the pivot point is broken through, allowing new support / resistance points to be created.

But with the script you referenced, uses future bars.
Meaning, it waits until the future to confirm the pivot happened and then goes back in time and repaints the pivot at the point it happened.

In answer to your question: yes, it repaints and it lags.
Which means the scanner filter in the above post had to be modified.

The scanner is set to look for pivots on the current candle, but in actuality they can be repainted much further back.

So the scan filter needs to be re-written:

this will only find pivots repainted within the last 10 bars.
I've been looking @ MACD signals and wondered if we can add orders in order to generate a P & L and a label
TY in advance

input pricecolor = yes;
input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;
input averageType = AverageType.EXPONENTIAL;

def Value = MovingAverage(averageType, close, fastLength) - MovingAverage(averageType, close, slowLength);
def Avg = MovingAverage(averageType, Value, MACDLength);

plot Diff = Value - Avg;

Diff.Hide();
Diff.SetDefaultColor(GetColor(5));
Diff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Diff.SetLineWeight(3);
Diff.DefineColor("Positive and Up", Color.GREEN);
Diff.DefineColor("Positive and Down", Color.DARK_GREEN);
Diff.DefineColor("Negative and Down", Color.RED);
Diff.DefineColor("Negative and Up", Color.DARK_RED);
Diff.AssignValueColor(if Diff >= 0 then if Diff > Diff[1] then Diff.Color("Positive and Up") else Diff.Color("Positive and Down") else if Diff < Diff[1] then Diff.Color("Negative and Down") else Diff.Color("Negative and Up"));

AssignPriceColor(if !pricecolor then Color.CURRENT else Diff.TakeValueColor());

plot UpSignal = if Diff crosses above 0 then low else Double.NaN;

AddChartBubble(UpSignal, low, "Buy", Color.LIGHT_GREEN, no);

plot DownSignal = if Diff crosses below 0 then high else Double.NaN;

AddChartBubble(DownSignal, high, "Sell", Color.LIGHT_RED, yes);

#
 

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
253 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