MQL4 Reference Timeseries and Indicators Access iBars

MQL4 Help as One File:

iBars

Returns the number of bars on the specified chart.

int  iBars(
   string           symbol,          // symbol
   int              timeframe        // timeframe
   );

Parameters

symbol

[in]  Symbol the data of which should be used to calculate indicator. NULL means the current symbol.

timeframe

[in]  Timeframe. It can be any of ENUM_TIMEFRAMES enumeration values. 0 means the current chart timeframe.

Returned value

The number of bars on the specified chart.

Note

For the current chart, the information about the amount of bars is in the Bars predefined variable.

Example:

  Print("Bar count on the 'EURUSD,H1' is ",iBars("EURUSD",PERIOD_H1));