Bar counting

 

I am trying to backtest price data and am wondering how to create a simple indicator

to count the number of bars over a specified time range.  I presume that this would make

use of datatime variable to set the exact range of dates and then use this in some way

to calculate the bars.  I am a newbie to MQL4 and what seems simple is not so straightforward.

Any help would be appreciated.  Thanks in advance. 

 

https://www.mql5.com/en/forum/143687

Read it and you know how to do 

 
int iBarShift(  string symbol, int timeframe, datetime time, bool exact=false)
This function returns bar shift based on the open time specified. If you specify open and close time you can find the difference between both shifts and in this way count the bars
 
cyberfx.org:
This function returns bar shift based on the open time specified. If you specify open and close time you can find the difference between both shifts and in this way count the bars

Thanks!  So do you mean use two sets of iBarshift for each datetime time (beginning of range and end of range) and then

do a subtraction?  Does iBarShift give you the index Bar number?  I am working with a large period of data but trying to cone

down onto a 5 - bar segment range to test the calculation.

 

Thanks!

 
doubblin: Does iBarShift give you the index Bar number?  
What does the documentation say it gives? RTFM
Reason: