Hi,
Can an expert advisor programmatically turn off the mt4's 'expert advisor' switch? and also to turn it on?
(i am referring to that button at top of mt4, which enables or disables ea execution)
I am almost sure u can turn it off and it was mentioned in some thread, but currently search on the site is broken. Alternatively, you can completely remove an expert from the chart via:
PostMessageA( WindowHandle( Symbol(), Period()), WM_COMMAND, 33050, 0);
Don't forget to include WinUser32.mqh for this to work.
"Turning it on" on the other hand doesn't make any sense, since if it's off - how can an expert do anything at all?
I am almost sure u can turn it off and it was mentioned in some thread, but currently search on the site is broken. Alternatively, you can completely remove an expert from the chart via:
Don't forget to include WinUser32.mqh for this to work.
"Turning it on" on the other hand doesn't make any sense, since if it's off - how can an expert do anything at all?
actually what i want to do is like this.
1) i want to buy a commercial ea, say eaxxx.
2) then i will program my own robot, whose job is to turn on or off the eaxxx - both being attached to diffferent charts.
i want to do this to add some sort of a 'filter' or 'entry condition' to an ea whose code i dont have and has no extension points (i dont know if any commercial eas allow progrmming extensions to their eas). for example, i want to make sure that if the market is 'too volatile', i want to turn the eaxxx off.
Unfortunately the 'expert advisor' button affects all experts on all charts in the Terminal. I would be very careful if I were u... Enabling an expert is one thing, but shutting it off before it has finished it's work is dangerous. How will your robot know when to shut off the commercial expert?
Anyway, another solution is to have an expert in one terminal launch another terminal and inject it with the expert, params, etc. of the commercial expert. You can get an idea of how to do this from the article "Automated Optimization of a Trading Robot in Real Trading" (https://www.mql5.com/en/articles/1467). In the article they launch another terminal in optimization mode, but u can do it in expert mode, including params, symbol, timeframe, etc. Good luck!
Alternatively, you can completely remove an expert from the chart via:
PostMessageA( WindowHandle( Symbol(), Period()), WM_COMMAND, 33050, 0);
What is 33050? Is this a menu command ID or something else?
Here's the source (it's in russian though...) -> https://www.mql5.com/ru/code.
Thanks. I'll need google translate. The Russians seem to be even more hardheaded than the French in their unwillingness to use the english language when communicating with foreigners (commenting sourcecode == communicating with the outside world)
Thanks. I'll need google translate. The Russians seem to be even more hardheaded than the French in their unwillingness to use the english language when communicating with foreigners (commenting sourcecode == communicating with the outside world)
- 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,
Can an expert advisor programmatically turn off the mt4's 'expert advisor' switch? and also to turn it on?
(i am referring to that button at top of mt4, which enables or disables ea execution)