Hi all,

I'm looking to add a criterion to my algorithm so it only executes when the simple moving average is upward sloping (for a buy) or downward sloping (for a sell). 

Is there an easy way of checking whether the slope is upward or downward? I imagine it'd be to do with whether the current value of the moving average is greater than or less than the value one step prior, but not sure how to do that.

Thanks
Hasan