MQL4 Reference Chart Operations WindowPriceMax

MQL4 Help as One File:

WindowPriceMax

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

int  WindowPriceMax(
   int       index=0   // subwindow
   );

Parameters

index=0

[in]  Chart subwindow index (0 - main chart window).

Returned value

The maximal value of the vertical scale of the specified subwindow of the current chart (0-main chart window, the indicators' subwindows are numbered starting from 1). If the subwindow index has not been specified, the maximal value of the price scale of the main chart window is returned.

Example:

  double   top=WindowPriceMax();
  double   bottom=WindowPriceMin();
  datetime left=Time[WindowFirstVisibleBar()];
  int      right_bound=WindowFirstVisibleBar()-WindowBarsPerChart();
  if(right_bound<0) right_bound=0;
  datetime right=Time[right_bound]+Period()*60;
//----
  ObjectCreate("Padding_rect",OBJ_RECTANGLE,0,left,top,right,bottom);
  ObjectSet("Padding_rect",OBJPROP_BACK,true);
  ObjectSet("Padding_rect",OBJPROP_COLOR,Blue);
  WindowRedraw();

See also

WindowPriceMin(), WindowFirstVisibleBar(), WindowBarsPerChart()