In my recent project, I tried to call an indicator, which uses chart event and button objects, from EA using iCustom function.
After EA is loaded, the indicators are also loaded as the indicators are compiled as the part of resource of EA.
However, when I tried to click on the button from the indicator, nothing is happened.
I tried to print something to check if OnChartEvent function is working fine, but nothing is printed. I have no idea how to deal with this problem. Except OnChartEvent function problem, the other things are working fine from the indicators. Even buttons are correctly created.
OnChartEvent function is the MQL5 built in function, and I have no idea how to go about this problem. Please share your idea if you have any.
void OnChartEvent(const int id,const long &lparam,const double &dparam,const string &sparam)
printf("button is clicked");
Hi, maybe you have to add this :
void OnChartEvent(const int id,
const long &lparam,
const double &dparam,
const string &sparam)
//--- Check the event by pressing a mouse button
//--- If you click on the object with the name buttonID
Print("button is clicked");
I already try it and its work. This example is taken from documentation.
Hi Thanks. Let me try and see it works.
The complication comes from the fact that I am calling the indicator using Object and Chart Event function with iCustom function after I embedded the indicator into resource in my EA.
Therefore, things would normally worked very well if the indicator is attached directly to charts. But when the indicator is called with iCustom, button object is drawn correctly but the button object with chart event is not function correctly.
Anyway, I will give a go with your idea.
Just tried your ideas. However nothing is printed.
As I mentioned before, The complication comes from the fact that I am calling the indicator from iCustom function after I embedded the indicator into resource in my EA.
Anyways, thanks for your idea.