Help on how to Calculate number of Bar in EA

 

Dear

Good day

I am learning to code EA for two timeframe EMA trading strategy. I need to count/calculate the number of bars from when FAST EMA crosses SLOW EMA  and when the Ask Prices retraces back and touches on or below SLOW EMA. I need to record this number as well as be able to get the Highest price between these two point. But I need to continue counting the bars until when the trend reverses.

Anyone who can help how to accomplish this please.

Regards

 
Niyoshaka Stanley Lameck: I need to record this number 

Your number will be wrong as soon as a new bar starts.

Remember the bar time when the event occurred. Use iBarShift to find the current bar index of that time.