
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Suppose the chart is scrolled to the right as much as possible, then the indentation is visible and there are, for example, 100 bars on the chart.
But if we scroll the chart to the left to indent it will show 100 + as many bars as fits into the indent.
It is not interesting to rewind the chart by hand.
- get vertical and horizontal size of the current chart in pixels;
1. GetClientRect from user32.dll
I am not experienced in importing *.dll.
I found a description of GetClientRect
Syntax
BOOL GetClientRect
(
HWND hWnd, // window descriptor
LPRECT lpRect // address of work coordinate structure
);
Parameters
hWnd
Identifies the window whose work coordinates are to be returned.
lpRect
Indicates the RECT structure that accepts the working coordinates. The left and top elements are null. The right and bottom elements contain the width and height of the window.
Return values
If the function completes successfully, the return value is different from zero. If the function fails, the return value is zero. To get extended error data, call GetLastError.
In other sources this function is described as void. What to believe ?
Is it necessary to specify #import "user32.dll" to connect ?
According to some sources, the RECT structure is described in winuser.h, others in windef.h. None of these files exist on my machine.
#include <winuser.h> or #include <windef.h> ?
What should be specified as the hWnd window identifier ?
How to get the required parameters from the lpRect structure ? MQL4 does not support complex data types (structures).
- get maximum and minimum apparent quotes of the current chart;
Maybe it makes sense to complement MQL4 language with appropriate functions ?
|------------------------------------------------| <- 1.8595
|................................................|
|................................................|
|.............--- High ........................|
|................................................|
|................................................|
|................................................|
|................................................|
|................................................|
|................................................|
|............................--- Low..........|
|................................................|
|................................................|
|----
Please answer my questions.
There are many articles and a collection of programs on the site. Do not hesitate to read them. In particular, the question of minimum and maximum quotes has been discussed here: "MQL4: Interception".
I quote from
===
If you know the size of the window in pixels, you can easily use the BarsPerWindow and FirstVisibleBar functions. There is no problem to calculate the number of the bar.
It is more complicated with the price coordinate. If the scale is automatic, we can calculate it by adding 5% of the difference between the maximum and minimum price values at the top and bottom. If the scale is fixed, it cannot be calculated as there is no information about the upper and lower limit.
===
===
If you know the size of the window in pixels, then you can easily use the BarsPerWindow and FirstVisibleBar functions. There's no problem figuring out the bar number.
It is more complicated with the price coordinate. If the scale is automatic, we can calculate it by adding 5% of the difference between the maximum and minimum price values at the top and bottom. If the scale is fixed, it cannot be calculated as there is no information about the upper and lower limit.
===
Real example: EURUSD, M1
High 1.2613 Max visible value 1.2620 delta 0.0007
Low 1.2602 Min 1.2600 delta 0.0002 visible value
Where is 5% ?
The GetClientRect search in MQL4.COM forum produces 2 references. No specific answers or recommendations.
So you ask a question. I invited you to a specialized forum for that purpose.
Besides, I quoted myself: "It's more complicated with the price coordinate". Which means that the question does not have an unambiguous answer.
By the way, 5% is not the price, but the number of pixels between the maximum and minimum price.
Besides, I quoted myself: "It's more complicated with the price coordinate". Which means that the question does not have an unambiguous answer.
By the way, 5% is not the price, but the number of pixels between the maximum and minimum price.
I followed your advice and posted your question in MQL4.COM forum. I got zero response and no response and no hope. Please help.
Please help me with the GetClientRect function from user32.dll to get the vertical and horizontal size of the current chart in pixels.
The description of the function is given above.
To connect it, specify #import "user32.dll".
As the identifier of the window hWnd we indicate the value returned by the function WindowHandle (...) .
How to get the required parameters from the lpRect structure, if MQL4 does not support complex data types (structures) ?
I have been asking for help in solving my problem for more than a month without success.
Some posts get a reply after an hour or two, some are blatantly ignored for a long time. Why?