Hi,
I am trying to receive CHARTEVENT_MOUSE_MOVE event for a chart that I open with ChartOpen :
I also couldn't hide trade levels for EURUSD. That may have a common reason. Any ideas?
Thanks in advance
Please read the documentation carefully :
CHART_EVENT_MOUSE_MOVE | Send notifications of mouse move and mouse click events (CHARTEVENT_MOUSE_MOVE) to all mql4 programs on a chart | bool |
That means the mouse move event is NOT sent on mql4 programs running on an other chart.
Please read the documentation carefully :
CHART_EVENT_MOUSE_MOVE | Send notifications of mouse move and mouse click events (CHARTEVENT_MOUSE_MOVE) to all mql4 programs on a chart | bool |
That means the mouse move event is NOT sent on mql4 programs running on an other chart.
Thanks for editing Alain. This is the first time I am posting in this forum. I didn't know that.
I now see an MQLX program's scope is a chart not the Metatrader's environment. So I think I will run the same EA on multiple charts to achieve what I want. Thanks for your answer.
you can open up up many charts then use
ID |
Description |
Property Type |
Show chart on top of other charts |
bool w/o |
Then have each chart check if it is currently on top, and if it is,
//Do Something.
Then you can cycle through and do lots of interesting things.
ChartSetInteger(chart_ID,CHART_BRING_TO_TOP,0,value); ChartGetInteger(chart_ID_BRING_TO_TOP);
Thanks for editing Alain. This is the first time I am posting in this forum. I didn't know that.
I now see an MQLX program's scope is a chart not the Metatrader's environment. So I think I will run the same EA on multiple charts to achieve what I want. Thanks for your answer.
Running the EA on multiple charts to send events may not be necessary. It is possible to broadcast the event to other charts. See the example code here:
https://www.mql5.com/en/docs/eventfunctions/eventchartcustom
//+------------------------------------------------------------------+ //| sends broadcast event to all open charts | //+------------------------------------------------------------------+ void BroadcastEvent(long lparam,double dparam,string sparam) { int eventID=broadcastEventID-CHARTEVENT_CUSTOM; long currChart=ChartFirst(); int i=0; while(i<CHARTS_MAX) // We have certainly no more than CHARTS_MAX open charts { EventChartCustom(currChart,eventID,lparam,dparam,sparam); currChart=ChartNext(currChart); // We have received a new chart from the previous if(currChart==-1) break; // Reached the end of the charts list i++;// Do not forget to increase the counter } }
- www.mql5.com
Running the EA on multiple charts to send events may not be necessary. It is possible to broadcast the event to other charts. See the example code here:
https://www.mql5.com/en/docs/eventfunctions/eventchartcustom
That's not a solution to the problem, as the OP was opening a new chart with no running code on it. He can't catch mouse move event. Running the EA on multiple chart is the only solution.
I believe the solution I posted above is closer to what the OP wanted. The OP's EA opens new charts dynamically. If the OP has to run the same EA on those charts too, he'll never finish loading EAs.
Of course the EA can be refactored to only work in one chart. But the OP probably has a reason why he wanted to process events on multiple charts in a single EA. That is why I made the suggestion of broadcasting events. The OP can create something (EA, indicator, or even script that runs indefinitely) that broadcasts events back to the chart where the event-processing EA is loaded (without having to modify that EA). This is not a fully automated solution as the OP wanted, but neither does the solution of running the same EA on charts it dynamically opened.
- 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 am trying to receive CHARTEVENT_MOUSE_MOVE event for a chart that I open with ChartOpen :
I also couldn't hide trade levels for EURUSD. That may have a common reason. Any ideas?
Thanks in advance