Help with Moving Average Idea

I want to build an indicator like i have in pinescript, where if the moving average is going up i want it to plot green and vice versa if it’s going down, red. I think what i want to use is MovingHigh and MovingLow but not sure how to use them. Does anyone know of any examples? thanks