Cumulative Advance-Decline Line with Moving Average



New member
Hello. I'm not sbsolutely sure if the modified script below is in fact correct. Could anyone give this a look and advise? Thanks!

#CumADLine - Mobius
#Mike - Added iput for Moving Average Type, color definition, and assigned value color.

declare lower;

input length = 21;
input averageType = AverageType.EXPONENTIAL;

plot Data = TotalSum(close("$ADSPD"));
plot MA = MovingAverage(averageType,data,length);

data.DefineColor("Above", Color.UPTICK);
data.DefineColor("Below", Color.DOWNTICK);
data.AssignValueColor(if data > MA then data.Color("Above") else data.Color("Below"));
Last edited by a moderator:

Similar threads