I'm new to this so thanks for your assistance in advance.
I'm trying to determine if the SMA(10) is indicating a trend. I would like to define a trend by saying the most recent peak must be higher than the previous peak, and the most current trough is higher than the previous trough.
I'm struggling to understand how I would code this though...
How could I define current/previous peaks and troughs?
Are there any inbuilt functions that could be used? i.e. can I use the slope of the SMA line? or would I need to check that the SMA(10) on a particular bar is greater (for peak) or less than (for trough) both the next x bars, and previous x bars?
Hope I am making sense, and thanks for any help you can provide
Comment