MQL4参考 预定义变量 Bars

int Bars

Number of bars in the current chart.

Example:

  int counter=1;
  for(int i=1; i<=Bars; i++)
    {
     Print(Close[i-1]);
    }

See also

Function Bars, iBars