input price = close;
input length = 9;
#ONE ON ONE
input averageType = AverageType.SIMPLE;
DECLARE LOWER;
#def agg = AggregationPeriod.two_MIN;
#(period = agg)
#SMA2
plot SMA2 = MovingAverage(averageType, price, 2) - MovingAverage(averageType, price, 6);
SMA2.SetLineWeight(5);#5
SMA2.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
#orange
SMA2.ASSignValueColor(IF SMA2 > 0 THEN CREATECOLOR(0, 200, 80) else if SMA2 < 0 THEN CREATECOLOR(240, 100, 50) else color.gray);
#
SMA
plot SMA = MovingAverage(averageType, price, 2) - MovingAverage(averageType, price, 12);
SMA.SetLineWeight(5);#1, 3
SMA.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
#green on top
SMA.ASSignValueColor(IF SMA > 0 THEN CREATECOLOR(0, 240, 160) else if SMA < 0 THEN COLOR.PINK else color.gray);
#THICK
plot SMA3 = MovingAverage(averageType, price, 2) - MovingAverage(averageType, price, 24);
SMA3.SetLineWeight(5);#1
SMA3.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
SMA3.ASSignValueColor(IF SMA3 > SMA3[1] THEN COLOR.GREEN else if SMA3 < SMA3[1] THEN COLOR.RED else color.gray);
#SMA3.ASSignValueColor(IF SMA3 > 0 THEN COLOR.CYAN else if SMA3 < 0 THEN COLOR.PINK else color.gray);
#orange sma2, red sma, pink sma3
AddLabel(yes, (" "), IF sma2> sma and sma2 > sma3 and sma2> sma and sma2 > sma3 and sma>sma3 and sma>sma[1] and sma2>sma2[1] and sma3>sma3[1] then color.green else if sma2< sma and sma2 < sma3 and sma2< sma and sma2 < sma3 and sma<sma3 and sma<sma[1] and sma2<sma2[1] and sma3<sma3[1] then color.red else color.gray);
AddLabel(yes, (" "), IF sma2> sma and sma2 > sma3 and sma2> sma and sma2 > sma3 and sma3>sma then color.red else if sma2< sma and sma2 < sma3 and sma2< sma and sma2 < sma3 and sma3<sma then color.green else color.gray);
#end code