Code:
###
#MA Difference Histogram Indicator
#Compiled by Zurika(ApoZee)
#
#This is based on the concept of MACD and gives the ability to change the lengths and MA type.
#The indicator could be used with other trend and momentum indicators for better entry.
###
declare lower;
input fastLength = 3;
input slowLength = 9;
input avgType = AverageType.EXPONENTIAL;
def fast_ma = MovingAverage(avgType, close, fastLength);
def slow_ma = MovingAverage(avgType, close, slowLength);
def diff_ma = fast_ma - slow_ma;
plot ma_hist = diff_ma;
ma_hist.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
ma_hist.AssignValueColor(if diff_ma <= 0 then Color.RED else Color.GREEN);
ma_hist.SetLineWeight(3);
Last edited: