First left bar in window

 
Is there a way to identify the first visible bar on the left in the chart window? That value changes every time when bars are added to the right and when zooming in or out.
 
 
SemperAugustus:
Is there a way to identify the first visible bar on the left in the chart window? That value changes every time when bars are added to the right and when zooming in or out.

WindowFirstVisibleBar()
 
Thanks.
 
                                                         #define WINDOW_MAIN 0
void     GetChartLimits(int&iLeft, int&iRight, double&top, double&bot,int iW=0){
   top      = WindowPriceMax(iW);   iLeft    = WindowFirstVisibleBar();
   bot      = WindowPriceMin(iW);   iRight   = iLeft-WindowBarsPerChart();
   if(top-bot < pips2dbl)  top    = bot+pips2dbl;     // Avoid scroll bug / div0
   if(iRight < 0)          iRight = 0;                // Chart is shifted.
}  // GetChartLimits
////////////////////////////////////////////////////////////////////////////////
int start(){
   int iL, iR; double pT, pB; GetChartLimits(iL, iR, pT, pB);
   Print("Left most bar started on " + TimeToStr(Time[iL], TIME_MINUTES) );
Not hard if you RTFM
Reason: