|
Bars
Returns the number of bars count in the history for a specified symbol and period. There are 2 variants of functions calls.
Request all of the history bars
int Bars(
|
Request the history bars for the selected time interval
int Bars(
|
Parameters
symbol_name
[in] Symbol name.
timeframe
[in] Period.
start_time
[in] Bar time corresponding to the first element.
stop_time
[in] Bar time corresponding to the last element.
Return Value
If the start_time and stop_time parameters are defined, the function returns the number of bars in the specified time interval, otherwise it returns the total number of bars.
Note
If data for the timeseries with specified parameters are not formed in the terminal by the time of the Bars() function call, or data of the timeseries are not synchronized with a trade server by the moment of the function call, the function returns a zero value.
When requesting the number of bars in a specified time interval, only bars with an open time falling within the interval are considered. For example, if the current day of the week is Saturday and the request is made for the number of W1 bars with start_time=last_tuesday and stop_time=last_friday, the function will return 0 since the open time of a W1 timeframe is always Sunday and not a single W1 bar falls within the specified interval.
Sample request for the number of all history bars:
int bars=Bars(_Symbol,_Period);
|
Sample request for the number of bars in the specified interval:
int n;
|
See also