Count how many bars ago an event has occured

 

Hi,


as the title says i wanted to get how many bars ago an event has occurred, does anyone have an idea on where to start. Thanks

 
Olisipo:

Hi,


as the title says i wanted to get how many bars ago an event has occurred, does anyone have an idea on where to start. Thanks

since you have the time of the event you can use iBarShift
https://www.mql5.com/en/docs/series/ibarshift

Documentation on MQL5: Timeseries and Indicators Access / iBarShift
Documentation on MQL5: Timeseries and Indicators Access / iBarShift
  • www.mql5.com
iBarShift - Timeseries and Indicators Access - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Olisipo:

Hi,


as the title says i wanted to get how many bars ago an event has occurred, does anyone have an idea on where to start. Thanks

Like what kind of event ?
 
I wrote an answer here but it doesn't show up anymore. I actually don't understand what's wrong!
 
Ahmet Metin Yilmaz #: I wrote an answer here but it doesn't show up anymore. I actually don't understand what's wrong!

Because your answer was about a another application and has nothing to do with MetaTrader. Your answer should be relevant to MQL and MetaTrader and not about another language on another application.

 
Fernando Carreiro #:

Because your answer was about a another application and has nothing to do with MetaTrader. Your answer should be relevant to MQL and MetaTrader and not about another language on another application.

Ok. Thank you Fernando. 
My goal was to accurately identify the problem and offer a solution.