Ok I admit my math may be off, not my best subject. But still not calculating an ATR. There is no high or low so only one value is being used and somehow giving you a change due to the period of days of the average. No idea what kind of number that is coming up with.
Seems would be closer to a true range if used TrueRange(MACDdiffhigh, close, MACDdifflow), nATR); but still off. Would need to find the high and low of the macddiff over the length used.
Best might be to just do this. Uses correct calculations and might work better.
input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;
input averageType = AverageType.EXPONENTIAL;
input showBreakoutSignals = no;
plot Value = MovingAverage(averageType, close, fastLength) - MovingAverage(averageType, close, slowLength);
plot Avg = MovingAverage(averageType, Value, MACDLength);
plot Diff = Value - Avg;
plot ZeroLine = 0;
input averagetype2 = averageType.HULL;
input lengthh = 4;
plot h = Movingaverage(averagetype2,diff,lengthh);
Seems would be closer to a true range if used TrueRange(MACDdiffhigh, close, MACDdifflow), nATR); but still off. Would need to find the high and low of the macddiff over the length used.
Best might be to just do this. Uses correct calculations and might work better.
input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;
input averageType = AverageType.EXPONENTIAL;
input showBreakoutSignals = no;
plot Value = MovingAverage(averageType, close, fastLength) - MovingAverage(averageType, close, slowLength);
plot Avg = MovingAverage(averageType, Value, MACDLength);
plot Diff = Value - Avg;
plot ZeroLine = 0;
input averagetype2 = averageType.HULL;
input lengthh = 4;
plot h = Movingaverage(averagetype2,diff,lengthh);