MQL4 - automated forex trading   /  

Documentation

MQL4 Reference  Window functions  WindowBarsPerChart

 
Use the opportunities of
MQL5 in MetaTrader 5
Study the new MQL5 language
Study the new MQL5 language.
Reference is already available
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--)
  {
   // ...
  }