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
long height = ChartGetInteger(0,CHART_HEIGHT_IN_PIXELS,0); long width = ChartGetInteger(0,CHART_WIDTH_IN_PIXELS,0);
Another solution to the problem is to use the OBJPROP_CORNER and set the 0,0 to the top right corner. This allows you to put text objects on the far right of the window aligned with the edge of the chart.
ObjectSet(obj_label,OBJPROP_CORNER,CORNER_RIGHT_UPPER);
I am trying to use your method but I get this warning: "possible loss of data due to type conversion DW-Panel v2.0.mq4 218 17"
The code runs successfully but I would like to get rid of the warning. Any thoughts?
/....... at beginning of code #property indicator_chart_window int extern atrPeriod = 14; int extern width = 325; int extern height = 25; extern double maxSpread = 2.0; //........ Later in "int OnCalculate(......){.......}" int heightScreen=ChartGetInteger(0,CHART_HEIGHT_IN_PIXELS,0); int widthScreen=ChartGetInteger(0,CHART_WIDTH_IN_PIXELS,0); height1 = heightScreen - height; margin = widthScreen - width;
- www.mql5.com
I am trying to use your method but I get this warning: "possible loss of data due to type conversion DW-Panel v2.0.mq4 218 17"
The code runs successfully but I would like to get rid of the warning. Any thoughts?
I changed int to bool and it's all unicorns and rainbows now. Thanks.
I am trying to use your method but I get this warning: "possible loss of data due to type conversion DW-Panel v2.0.mq4 218 17"
The code runs successfully but I would like to get rid of the warning. Any thoughts?
(int) ChartGetInteger(0, CHART_HEIGHT_IN_PIXELS); Please use conversion like this, it should resolve the warning.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi.
I would like to ask if you know how to get the width and height of a char window because i want to create EA objects that programmatically adjust to the windows height and width...
Thanks...