MQL4 - automated forex trading   /  

Documentation

MQL4 Reference  Window functions  WindowPriceMax

 
double WindowPriceMax( int index=0)
Returns 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.
See also WindowPriceMin(), WindowFirstVisibleBar(), WindowBarsPerChart()
Parameters:
index   -   Chart subwindow index (0 - main chart window).
Sample:
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();