How to know how many bars overall the SMA 200 was above the price from our current bar?

To add comments, please log in or register
ArikKarish
74
ArikKarish  

How to know how many bars overall the SMA 200 was above the price from our current bar?

Very simple but yet so complicated.., i just want to know the way to know how many bars in total the SMA 200 was above the price from the current open bar...

please help, thank you for your time!..

kypa
981
kypa  
Loop from last bar towards first comparing SMA200 and price, for example close.
KEENBASE SOFTWARE SOLUTIONS
14379
Nitin Raj  
Create a timestamp at the sma cross. Now use this timestamp in the iBarShift function

Reset of timestamp would require at opposite cross or at some other criteria based on your objective.
ArikKarish
74
ArikKarish  
kypa:
Loop from last bar towards first comparing SMA200 and price, for example close.

maybe could you show me an example please?

ArikKarish
74
ArikKarish  
done!, thanks
To add comments, please log in or register