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