MQL4 - automated forex trading   /  

Documentation

MQL4 Reference  Window functions  WindowBarsPerChart

 
int WindowBarsPerChart( )
Function returns the amount of bars visible on the chart.
Sample:
// work with visible bars.
int bars_count=WindowBarsPerChart();
int bar=WindowFirstVisibleBar();
for(int i=0; i<bars_count; i++,bar--)
  {
   // ...
  }