MACD with HMA For ThinkOrSwim

BillW

Member
VIP
One way of interpreting MACD with HMA​

We know using HMA on MACD is kind 'a weird. But using it with Wilders Histogram can make it useful when looking at what happens when the hull value AVG cross in relation to the histogram.
I've included a couple of moving averages that are included in the shared style link. (IMO) SuperSmootherFilter with a period of 50 is a better (smoother) than the tried and true 20 period SMA. Hann moving average is included too.

I always recommend watching something that is new to you for a few days. Don't be a noob and fall in love with hindsight.

https://tos.mx/!vg023o8Y
Screen Shot 11-11-25 at 01.49 PM.jpg




Code:
# MACD HULL with Wilders Histogram

declare lower;

plot ZeroLine = 0;
ZeroLine.SetDefaultColor(CreateColor(0, 0, 0));

input colorNormLength1 = 2;

input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;
input averageType = AverageType.HULL;
input showBreakoutSignals = no;
plot Value = MACD(fastLength, slowLength, MACDLength, averageType).Value;
plot Avg = MACD(fastLength, slowLength, MACDLength, averageType).Avg;

Value.DefineColor("Highest", CreateColor(127, 255, 255)) ;
Value.DefineColor("Lowest", CreateColor(128, 0, 255));
Value.AssignNormGradientColor(colorNormLength1, Value.Color("Lowest"), Value.Color("Highest"));
Value.HideBubble();

Avg.DefineColor("Up", CreateColor(200, 200, 0)) ;
Avg.DefineColor("Down", CreateColor(0, 200, 200)) ;
Avg.DefineColor("Flat", Color.GRAY);
Avg.HideBubble();

Avg.AssignValueColor(if Avg[0] > Avg[1] then Avg.Color("Up") else if Avg[0] <
Avg[1] then Avg.Color("Down") else Avg.Color("Flat"));

plot Diff = Value - Avg;

diff.hide();

plot UpSignal = if Diff crosses above ZeroLine then ZeroLine else Double.NaN;
plot DownSignal = if Diff crosses below ZeroLine then ZeroLine else Double.NaN;

UpSignal.SetHiding(!showBreakoutSignals);
DownSignal.SetHiding(!showBreakoutSignals);

Alert(UpSignal == ZeroLine, "Up Arrow Alert", Alert.BAR, Sound.Chimes);
Alert(DownSignal == ZeroLine, "Down Arrow Alert", Alert.BAR, Sound.Chimes);

input fastLength2 = 12;
input slowLength2 = 26;
input MACDLength2 = 9;
input averageType2 = AverageType.Wilders;

plot Diff2 = MACD(fastLength2, slowLength2, MACDLength2, averageType2).Diff *1;

Diff2.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Diff2.SetLineWeight(3);
Diff2.DefineColor("Positive and Up", CreateColor(44, 139, 53));
Diff2.DefineColor("Positive and Down", CreateColor(130,139, 44));
Diff2.DefineColor("Negative and Down", CreateColor(53, 44, 139));
Diff2.DefineColor("Negative and Up", CreateColor(139,44,130));

Diff2.AssignValueColor(if Diff2 >= 0 then if Diff2 > Diff2[1] then Diff2.color("Positive and Up") else Diff2.color("Positive and Down") else if Diff2 < Diff2[1] then Diff2.color("Negative and Down") else Diff2.color("Negative and Up"));
 
Last edited by a moderator:

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