Need code from Moving average

 

Hi there,

I need a simple code for the MA when it changes the direction. (deepest or highest point)

What are the conditions for this, indepently if the price ist below or above?

good results to anyone

 
This is when the previous MA bar is either below or above the current bar's MA value.
 
Marco vd Heijden:
this is when the previous MA bar is either below or above the current bar's MA value.

okay, I understand.

how looks the code for this condition?