- Platform
-
- Thinkorswim
Mac Divergence is important in spotting slowed momentum in comparison to the trend of price. The indicator on top is the Mac Divergence Average, the one underneath is the previously posted Ema of an Ema indicator. As you can see it is much easier to spot divrgence of price to momentum when stacking these two together.
Code:
#Mac Divergence Average
#Ghost
declare lower;
input fastLength = 113;
input slowLength = 127;
plot Value = expaverage(close, fastLength) - expaverage(close, slowLength);
plot Avg = expaverage(Value, 47.5);
plot Avg2 = expaverage(Value, 55);
plot Avg1 = expaverage(Value, 113);
plot Avg21 = expaverage(Value, 121);
addcloud(avg,avg2, color.green,color.green);
addcloud(avg1,avg21, color.cyan,color.cyan);
Avg1.setdefaultColor(color.cyan);
Avg21.setdefaultColor(color.cyan);
Avg.setdefaultColor(color.green);
Avg2.setdefaultColor(color.green);
Value.setdefaultColor(color.dark_green);
plot ZeroLine = 0;