Is there a way to find the Bar index number of the last bar that crossed a MA

 

Good afternoon,


Is there a way to find the Bar index number of the last bar that crossed a MA?


Best Regards,



Robert

 
ReactoFX:

Good afternoon,


Is there a way to find the Bar index number of the last bar that crossed a MA?


Best Regards,



Robert

yes!

 
Yes...You can make a for loop that goes through the previous candles then return the index number of the bar that crossed the MA.
 
Amine Abed #:
Yes...You can make a for loop that goes through the previous candles then return the index number of the bar that crossed the MA.

Hi Amine,


Can you please explain how this should be done, I'm not a professional programmer, just a trader who makes his own indicators


Robert

 
Amine Abed #:
Yes...You can make a for loop that goes through the previous candles then return the index number of the bar that crossed the MA.

Hi Amine,


Thanks for pointing me to the loop functionality, I managed to make it work thanks to you.


Robert

 
ReactoFX #:

Hi Amine,


Thanks for pointing me to the loop functionality, I managed to make it work thanks to you.


Robert

You're welcome :)