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.
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?
new chart is created, the EA knows its ID. Also knows the NAME of the new
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.
Yes you can specify the chartID when you call for the OBJPROP_STATE of the button.
It is the first Parameter of the function ObjectGetInteger(chartID,...
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
Free download of the 'Multicurrency OnTickMarketWatch tick event handler' expert by 'Lizar' for MetaTrader 5 in the MQL5 Code Base
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
bool btnPressed = ObjectGetInteger(numGraph, someBtnName, OBJPROP_STATE);