You did not specify the length of your moving average so I’ll provide an input parameter to adjust it.
input lengthOne = 50;
input lengthTwo = 200;
def smaOne = Average(close, lengthOne);
def smaTwo = Average(close, lengthTwo);
plot arrowsUp = if smaOne >= smaTwo then smaOne else Double.NaN;
arrowsUp.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
arrowsUp.SetDefaultColor(Color.GREEN);
plot arrowsDown = if smaOne < smaTwo then smaOne else Double.NaN;
arrowsDown.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
arrowsDown.SetDefaultColor(Color.RED);
The screenshot below show how it plots on a chart. I have included two simple moving averages on the chart that plot normally so you can see that the arrows change direction and color based on their relative position. This code is not set to plot smaTwo, only the arrows based on smaOne. If you want this study to plot either smaOne or smaTwo in their normal fashion you can change the def to plot for each of the sma’s.