Chart Price Max/Min

 
Does anyone know how mt4 calculates CHART_PRICE_MAX and CHART_PRICE_MIN ?
 
Pre-build 600

WindowPriceMax

Returns the maximal value of the vertical scale of the specified subwindow of the current chart

Chart Operations

WindowPriceMin

Returns the minimal value of the vertical scale of the specified subwindow of the current chart

Chart Operations

List of MQL4 Functions - MQL4 Reference

Post-build 600
                                                         #define WINDOW_MAIN 0
void     GetChartLimits(int&iLeft, int&iRight, double&top, double&bot,int iW=0){
      /* MT4 build 445: In the tester (visual mode,) on the first tick, these
       * routines return left=100, right=37 (depends on default bar scaling.)
       * This is what the chart looks like when you maximize it while it is
       * generating the FXT file. On ticks after that, it appears like the
       * left/right are correct but the hi/lo are one tick behind the displayed
       * chart. On the start of a new bar, the hi/lo can be off when a recent
       * extreme drops off but the scale hasn't resized. I tried calling
       * WindowRedraw() first but that did not change results. I don't know
       * about live charts.                                                   */
   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 iLeft,iRight; double top,bot;   GetChartLimits(iLeft, iRight, top, bot);
 
whroeder1:
Pre-build 600 Post-build 600
 
Thank you for the reply. It's easier to get the data from the tester than what I had intended to do.
Reason: