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
Not working for me. I'm using WM_COMMAND for the second parameter. But which window handle do I need, the one returned by Window.GetHandle or it's parent, or the parent of that? I've tried all three but without success.
Either GetParent(GetParent(GetParent( <windowhandle> ))) or GetAncestor(<windowhandle>, 2)
And the limitation with this is that it's the same as pressing the equivalent toolbar button. Therefore, it acts on whichever chart currently has input focus, not (necessarily) the chart running the MQL4 code which sends the message.
Either GetParent(GetParent(GetParent( <windowhandle> ))) or GetAncestor(<windowhandle>, 2)
And the limitation with this is that it's the same as pressing the equivalent toolbar button. Therefore, it acts on whichever chart currently has input focus, not (necessarily) the chart running the MQL4 code which sends the message.
Thanks. Not a problem that it works on the chart that currently has focus because I'm giving the one I want focus through the steps in this thread. But anyway I'm still not getting it to work. Here's my code:
But anyway I'm still not getting it to work. Here's my code:
It works for me if I add something like the following to your code. (I'm also replacing the undeclared "symbol" parameter for the SendMessageA call with 0.) This basically creates an EA which keeps switching itself back to H4:
However, you really ought to use PostMessage rather than SendMessage. Otherwise, MT4 gets temporarily upset because the SendMessage call changes the timeframe; the EA is reloaded; and all this happens before the SendMessage call completes and returns to the EA... which has now been unloaded.
Thanks, seems to be working OK now.
In order to set the timeframe, all you need to do is:
You can also change those parameters to a different chart than the one the EA is running on, without using DLLs, as I mentioned in: https://www.mql5.com/en/forum/138882#comment_6090096
This is an old post. Today there are built-in functions in both Mql4 and Mql5 to maximize a chart window easily, without using DLL's:
Regards.