I want to ask you if it is possible to react to a button clicked from a chart that is opened from the main chart which the EA is executed on.
I load the EA in the main chart. In this main chart, under some circumstances another chart is opened.
Inside this new chart, the EA creates a button. And the click actions of this button are what I want to intercept in the original EA. Is this possible to achieve?
(When the new chart is created, the EA knows its ID. Also knows the NAME of the new button).
I doubt so. One possible way is to use ChartApplyTemplate() and assign one with a special indicator on the second chart, which will then capture button click and somehow communicate this action back to the original EA.
You capture the button click and forward a custom event to the chart with the EA. Working with Events / EventChartCustom - Reference on algorithmic/automated trading language for MetaTrader 5
Custom Event: Call from EA1 to EA2 - MT4 - MQL4 and MetaTrader 4 - MQL4 programming forum
In graph 0 I have the EA. In others graphs I don’t have EAs, just buttons. But in the EA I know the others numGraphs and someBtnNames..
As Marco vd Heijden suggested I achieve it with the following inside onTick method of my EA:
bool btnPressed = ObjectGetInteger(numGraph, someBtnName, OBJPROP_STATE);
- 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 want to ask you if it is possible to react to a button clicked from a chart that is opened from the main chart which the EA is executed on.
I load the EA in the main chart. In this main chart, under some circumstances another chart is opened.
Inside this new chart, the EA creates a button. And the click actions of this button are what I want to intercept in the original EA. Is this possible to achieve?
(When the new chart is created, the EA knows its ID. Also knows the NAME of the new button).
thanks!