This code needs to be applied to an intraday chart without extended hour data included. Otherwise it will count all the crossovers from midnight to midnight.
Screenshot below shows the result.
input maLengthOne = 10;
input maTypeOne = AverageType.SIMPLE;
input maPriceOne = close;
input maLengthTwo = 20;
input maTypeTwo = AverageType.SIMPLE;
input maPriceTwo = close;
plot maOne = MovingAverage(maTypeOne, maPriceOne, maLengthOne);
plot maTwo = MovingAverage(maTypeTwo, maPriceTwo, maLengthTwo);
plot crossAbove = maOne[1] < maTwo[1] and maOne > maTwo;
crossAbove.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
plot crossBelow = maOne[1] > maTwo[1] and maOne < maTwo;
crossBelow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
def newDay = GetDay() <> GetDay()[1];
rec countCrossAbove = if newDay then 0 else if crossAbove then countCrossAbove[1] + 1 else countCrossAbove[1];
rec countCrossBelow = if newDay then 0 else if crossBelow then countCrossBelow[1] + 1 else countCrossBelow[1];
AddLabel(yes, Concat("X Above: ", countCrossAbove), Color.GREEN);
AddLabel(yes, Concat("X Below: ", countCrossBelow), Color.RED);