MACD with Bollinger Bands Indicator for ThinkorSwim

it will not let me load a picture (and Yes I followed the instructions from this site) so I will try and explain what I am looking for help on this for. I wanted to know if anyone could help me with adding arrows. I would like a down arrow on the first dot after the green/yellow bullish dots. I not sure what color it is because I am colorblind. but after the bullish dots turn any color then the bullish color on the next dot show a down arrow. I also want a up arrow for the first dot after a red Dot (Bearish dots) that is no longer Red.


Thanks in advanced and thanks for the help everyone has given me on this site.


@yellowlogic, my dad was colorblind, therefore I can imagine having some difficulty with the indicator. I cannot program arrows in the manner you requested. But maybe there's another workaround? Attached is an image to show what I mean.


On the left, I changed the green bullish dots to black. If you can discern when black is no longer black on a white background, then you will know the bullish color has changed. On the right are the red dots changed to white on a black background. If you can discern when white is no longer white on a black background, then you will know the bearish dots have changed. In other words, if you can find a color that you can discriminate on a white and/or black background, you can customize the dot color accordingly.

Another option may be to change the size of the dot that plots with color change. But that's beyond my coding ability, sorry.

Best wishes and happy trading.
 
@yellowlogic I use this macd for arrows. You can use this macd script or use macd BB and use this script just for arrows but turn off all indicators. Hope this helps
Ruby:
#converted from mobisu macd to ppo
# this is actually macd and sqz indicator in one
# added pivots

declare lower;

input fastPeriod = 12; #9/18/6 for 5m
input slowPeriod = 26;
input signalPeriod = 9;
input price = close;
input show = yes;
input agg1 = AggregationPeriod.FIVE_MIN;

def fastEma = ExpAverage( price, fastPeriod );
def slowEma = ExpAverage( price, slowPeriod );
def periodOK = fastPeriod < slowPeriod;
AddLabel( !periodOK, "ERROR: fastPeriod MUST be less than slowPeriod" );
def _ppo = if periodOK then ((fastEma - slowEma) / slowEma) * 100 else 0;
def _signal = ExpAverage( _ppo, signalPeriod );

# generic plots wiht colors
plot pmain = _ppo;
pmain.SetDefaultColor( Color.BLUE );
pmain.SetLineWeight(2);
pmain.AssignValueColor(if pmain < 0 and pmain < pmain[1] then Color.RED
else if pmain < 0 and pmain > pmain[1] then Color.DARK_GREEN
else if pmain > 0 and pmain > pmain[1] then Color.GREEN
else Color.DARK_RED);
pmain.HideBubble();

plot mainEma = _signal;
mainEma.SetDefaultColor( Color.RED );
mainEma.HideBubble();
AddCloud(pmain, mainEma, Color.Green, Color.RED);

#diff as histogram
plot diff = _ppo - _signal;
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"));

#mobius divergence calc
def pmainh = CompoundValue(1,
if pmain < 0 then Double.NaN
else if pmain crosses above 0 then pmain
else if pmain > 0 and pmain > pmainh[1]
then pmain else pmainh[1], 0);

def Valueh = CompoundValue(1,
if pmain < 0 then Double.NaN
else if pmain crosses above 0 then high
else if pmain > 0 and high > Valueh[1] then high
else Valueh[1], 0);

plot divLowSignal = if pmain > 0 and high > Valueh[1] and pmain < pmainh[1] then 0
else Double.NaN;
divLowSignal.SetPaintingStrategy(PaintingStrategy.SQUARES);
divLowSignal.SetLineWeight(5);
divLowSignal.SetDefaultColor(Color.dark_orange);

def pmainL = CompoundValue(1, if pmain > 0 then Double.NaN
else if pmain crosses below 0 then pmain
else if pmain < 0 and pmain < pmainl[1] then pmain
else pmainl[1], 0);

def ValueL = CompoundValue(1, if pmain > 0 then Double.NaN
else if pmain crosses below 0 then low
else if pmain < 0 and low < Valuel[1] then low
else Valuel[1], 0);

plot divUpSignall = if pmain < 0 and low < Valuel[1] and pmain > pmainl[1] then 0
else Double.NaN;
divupSignall.SetPaintingStrategy(PaintingStrategy.SQUARES);
divUpSignall.SetLineWeight(5);
divUPSignall.SetDefaultColor(Color.blue);

#zeroline

plot zeroLine = 0;
zeroLine.SetPaintingStrategy(PaintingStrategy.LINE);
zeroLine.SetLineWeight(1);
zeroLine.SetDefaultColor(Color.Gray);

#pivots

def ptrend = pmain;
def prange = 2;
def pivotHigh = if IsNaN(ptrend[-1]) then 0 else Lowest(ptrend, prange)[1] > ptrend and Lowest(ptrend, prange)[-prange] > ptrend ;
def pivotLow = if IsNaN(ptrend[-1]) then 0 else Highest(ptrend, prange)[1] < ptrend and Highest(ptrend, prange)[-prange] < ptrend ;
#study
plot plotPH = if pivotHigh and show then ptrend else Double.NaN;
plotPH.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
plotPH.SetDefaultColor(Color.GREEN);

plot phline = if pivotHigh then pmain else Double.NaN;
phline.SetDefaultColor(Color.DARK_GREEN);
phline.EnableApproximation();phline.Hide();
#
plot plotPL = if pivotLow and show then ptrend else Double.NaN;
plotPL.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
plotPL.SetDefaultColor(Color.RED);

plot plline = if pivotLow then pmain else Double.NaN;
plline.SetDefaultColor(Color.RED);
plline.EnableApproximation(); plline.hide();
 
Last edited by a moderator:
@Hypoluxa In your SPX strtegy, you do not plot BB up- low- and mid-lines when you use MACD-BB indicator. And you said you use the MACD zero-line cross for signals. Can I say that the regular MCAD will do the same work in your SPX strategy? So, MACD-BB indicator is not neccessary?
yes
 
Just a little update to say this indicator has been golden all week trading both US and globex sessions. I set up scans (5 min time frame) to alert when the dots cross below the lower BB band for shorts and above the upper BB band for longs. When the indicator is in alignment on multiple time frames, I set profit targets based on fibs. 50 and 200 EMAs confirm long term trend so I don't pay too much attention to the zero line.

All my trades this week were futures with charts ranging from 1 min to daily time frame with S/R based on hourly and daily charts. I was profitable using @Hypoluxa's 2m, 6m, 10m strategy. I was also profitable with swing trades based off 30m, hourly, and daily charts, however that requires a risk tolerance for larger stop losses.

This indicator keeps my charts clean so that my brain can process price action when I look left. Thanks again, @BenTen and @Hypoluxa.
Any chance you have a chart to share for your current daytrading strategy?
 
eeek, thanks bro! May I ask what you personally use for daytrading? You have been a huge help here!
Which indicators to use in daytrading are low in importance.
Majority of retail investors who lose money, chose the wrong instruments to trade, at the wrong time.
  1. Trade highly liquid, financially-strong equities w/ positive long-term slope.
  2. Draw your support&resistance and trend lines.
  3. Look at price action and candle patterns to determine trade-ability.
Any indicator that you use to make entry on stocks that fit the above criteria are going to make money as long as you have a viable exit plan.
 
Hello. I would like to ask who can help me, as I am new to this. I need an arrow to be shown in the upper chart, when MACDBB_Upper crosses up to MacdBB_Dots and another arrow when MACDBB_Lower crosses down to MacdBB_Dots.-Thank you very much and congratulations.-
 
I spent quite some time to tune this indicator for SPY daily chart, but the signals are not very good. It would be very appreciated if someone can share the parameters on this indicate for (SPX or SPY) daily chart.
 

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