WindowScreenShot: How many pixels (size_x) does have one candle on a chart with chart_scale=5 (biggest) and others?
Presumably that will depend on the resolution of your screen and how much the chart is zoomed in or out.
Perhaps you could get a rough estimate by creating an object and then using ObjectGet() (https://docs.mql4.com/objects/ObjectGet) and the object properties enumeration (https://docs.mql4.com/constants/objects/properties) of OBJPROP_XDISTANCE or OBJPROP_YDISTANCE to find the x and y coordinates of that object, and then display this on the chart using Comment(). The coordinates of each chart object apply to the highlighted corner of the selection box of that object when you double click on it. You could move the object around the screen manually and then read off the coordinates at each point to figure out the distance yourself.
If this works then you could automatically attach an object to the high and low of each bar and then calculate the distance that way. Automatically attaching an object to the side of a bar might be difficult because I think MT4 only allows objects to relate to the Time[x] of the bar, and can not distinguish between either side. Attaching an object to the top or bottom should be much easier.
There may be an easier way, but I think this would at least work.
There is also the option to set the start point of x and y coordinates to any corner of the screen if you use a label as the chart object, and use ObjectSet() to set the object properties enumeration of OBJPROP_CORNER.
Hi,
does anybody knows ho many pixel in x-direction (size_x) does have one candle of the chart with chart_scale 5 (and 4,3,2..)?
Is there a way to calculate the size_y out of the High[iHighest(..)] and Low[iLowest(..)]?
Thanks in advance,
Gooly
PS: I didn't find anything but the descr. of WindowScreenShot()
If you mean the candle pitch ? I have this saved somewhere for the different zoom settings . . .
Found it, from the zoom setting where you can see the most candles the pitch is 1 pixel, then 2, then 4, 8, 16, 32 and finally 64 pixel pitch.
If you mean the candle pitch ? I have this saved somewhere for the different zoom settings . . .
Found it, from the zoom setting where you can see the most candles the pitch is 1 pixel, then 2, then 4, 8, 16, 32 and finally 64 pixel pitch.
Thanks, that makes sense!
But now I have another question about arrows and their description: https://www.mql5.com/en/forum/141432
Gooly
If you mean the candle pitch ? I have this saved somewhere for the different zoom settings . . .
Found it, from the zoom setting where you can see the most candles the pitch is 1 pixel, then 2, then 4, 8, 16, 32 and finally 64 pixel pitch.
Good answer.
Just wanted to add translation of this to code:
int candleWidthInPixels=(int)(1<<ChartGetInteger(0,CHART_SCALE));
Have fun
If you mean the candle pitch ? I have this saved somewhere for the different zoom settings . . .
Found it, from the zoom setting where you can see the most candles the pitch is 1 pixel, then 2, then 4, 8, 16, 32 and finally 64 pixel pitch.
to get these values :
//number of pixels per candle long hh = ChartGetInteger(chart_id, CHART_WIDTH_IN_PIXELS, sub_window)/ChartGetInteger(chart_id, CHART_WIDTH_IN_BARS, sub_window);
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- 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,
does anybody knows ho many pixel in x-direction (size_x) does have one candle of the chart with chart_scale 5 (and 4,3,2..)?
Is there a way to calculate the size_y out of the High[iHighest(..)] and Low[iLowest(..)]?
Thanks in advance,
Gooly
PS: I didn't find anything but the descr. of WindowScreenShot()