MQL4参考 时间序列和指标访问 iBars

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));