Counting bars

 

Hello,

 

This is something I was wondering how to do in mql4, but I think while I`m there I may as well learn how to do it in mql5 .

How would you guys approach this ?

 

I want to count the number of bars that are above a moving average during a set period of time . Would it be a backtesting thing or just an expert advisor ? as at the end of the day I just need one number, not an update on every bar. 

Cheers,

Documentation on MQL5: Timeseries and Indicators Access / Bars
  • www.mql5.com
Timeseries and Indicators Access / Bars - Documentation on MQL5
 

Actually I assume this would have to be run in the strategy tester since I would like to specify the date range .

To be even more precise I would need to count the number of bars that are above a moving average AND have closed up . 

Any idea on how to implement this simple counter ?

 

 cheers,

Documentation on MQL5: Timeseries and Indicators Access / Bars
  • www.mql5.com
Timeseries and Indicators Access / Bars - Documentation on MQL5
Reason: