I appreciate Nick jumping in there and providing an answer. However his code does not include the alerts which were a core component of the request. Here is my solution which also provides user inputs for the length and type of moving average.
input length = 50;
input averageType = AverageType.EXPONENTIAL;
plot ma = MovingAverage(averageType, close, length);
plot crossAbove = close[1] < ma[1] and close > ma;
crossAbove.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
crossAbove.SetDefaultColor(Color.CYAN);
crossAbove.SetLineWeight(3);
plot crossBelow = close[1] > ma[1] and close < ma;
crossBelow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
crossBelow.SetDefaultColor(Color.MAGENTA);
crossBelow.SetLineWeight(3);
Alert(crossAbove, "Cross Above", Alert.BAR, Sound.RING);
Alert(crossBelow, "Cross Below", Alert.BAR, Sound.RING);
Pete,
Looks great could you add the alert for a full candle cross confirmation and close and not just a cross of part of the candle. Also could you change the arrow alert to the words LONG/SHORT