I would like to code a condition which check previous bars whether the short term MA is above or below a long term MA. For example if I want the condition to check back 50 bars from the current bar if the 5MA is above the 10MA. Can you please help with the code. Thank you.
Just to clarify things a little. The current bar/candle is bar zero so if you want to check 50 bars back and the count includes the current bar then it would be test[49]. If you want to check 50 bars back and not include the current bar in the count back then it is test[50] you need.
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.