Personal Opinion here:
You could:
1) slow down your MACD using 33,100,13, often referred to as a "slow MACD" (or a host of other possibilities).
or
2) consider adapting your MACD to a longer timeframe. Shorter timeframes like this present the "noise" you're experiencing.
What you're illustrating here is a combination of divergence and the math of the MACD itself.
I have come to accept the formation you're illustrating to be referred to personally as a "MACD ramp". It happens a fair bit and is worth paying attention to.
In the code below, I've set up a MACD with a switch. I was in a group with some people who had their own settings they had discovered and also, I wanted to switch the MACD settings faster.
You can copy the code of the MACD you're working with into a new indicator script and set up inputs for your levels to mess around and see what works for you.
This script also has a set of labels that give you an indication of whether the MACD is bullish or bearish along with showing you the last 5 periods.
Another tactic I've looked at with some success is adjusting the MACD to calculate based on highs and lows vs. just the close. I've never tried this, but, if you do stay with close, try setting it one bar back by adding [1]. Since "close" varies during a bar, the idea of "locking down" the MACD to the previous and complete close of the last bar could bring some clarity. Again, I've never tried it with MACD, but, I have done it with success.
Code:
declare lower;
def data = close;
input MACD_type = {default SLOW, "FAST", TekMuNNee, Neo};
input averagetype = averageType.EXPONENTIAL;
input ShowNOWLabels = yes;
input ShowHOWLONGLabel = yes;
def fastlength;
def slowlength;
def MACDlength;
switch (MACD_Type) {
case SLOW:
fastlength = 33;
slowlength = 100;
MACDlength = 13;
case FAST:
fastlength = 12;
slowlength = 26;
MACDlength = 9;
case TekMunNee:
fastlength = 5;
slowlength = 9;
MACDlength = 5;
case Neo:
Fastlength = 5;
slowlength = 8;
MACDLength = 5;
}
def fastMacd = fastlength == 12 and slowlength == 26 and macdlength == 9;
def slowmacd = fastlength == 33 and slowlength == 100 and macdlength == 13;
def TekMuNNeeMACD = fastlength == 5 and slowlength == 9 and macdlength == 5;
def NeoMacd = fastlength == 5 and slowlength == 8 and macdlength == 5;
AddLabel(1,if slowmacd then "Slow MACD" else if fastmacd then "Fast MACD" else if tekmunneemacd then "TekMuNNee" else if NeoMacd then "MyNameIsNEO" else "AddOption", Color.YELLOW);
plot Value = MACD(fastLength, slowLength, MACDLength, averagetype).value;
plot Avg = MACD(fastLength, slowLength, MACDLength, averageType).Avg;
plot ZeroLine = 0;
value.setdefaultcolor(color.cyan);
avg.setdefaultcolor(color.yellow);
zeroline.setdefaultcolor(color.white);
def valueavg = average((value),14);
def valuehigh = highestall(valueavg);
#Addlabel(1,valuehigh,color.cyan);
def bullish = value > avg;
addlabel(shownowlabels,if value is greater than avg then "BULL" else "BEAR",if bullish then color.green else color.red);
addlabel(ShowHOWLONGlabel,if value is greater than avg then "BULL1" else "BEAR1",if bullish then color.green else color.red);
addlabel(ShowHOWLONGlabel,if value[1] is greater than avg[1] then "BULL2" else "BEAR2",if bullish[1] then color.green else color.red);
addlabel(ShowHOWLONGlabel,if value[2] is greater than avg[2] then "BULL3" else "BEAR3",if bullish[2] then color.green else color.red);
addlabel(ShowHOWLONGlabel,if value[3] is greater than avg[3] then "BULL4" else "BEAR4",if bullish[3] then color.green else color.red);
addlabel(ShowHOWLONGlabel,if value[4] is greater than avg[4] then "BULL5" else "BEAR5",if bullish[4] then color.green else color.red);