Disruptive Impact of Enabling/Disabling CHART_EVENT_MOUSE_MOVE for All Apps Running on Same Chart

 

The following code in a program that enables or disables the CHART_EVENT_MOUSE_MOVE for all programs running on the same chart is really unwanted. Or is there something I may be overlooking? It is important to consider the potential consequences of such a change, as it could potentially disrupt the functionality of other programs running on the chart.

Here is the code in question:

ChartSetInteger(0, CHART_EVENT_MOUSE_MOVE, false);
The platform should only make the change for the program that calls the function, rather than all programs.
 
Ehsan: The following code in a program that enables or disables the CHART_EVENT_MOUSE_MOVE for all programs running on the same chart is really unwanted. Or is there something I may be overlooking? It is important to consider the potential consequences of such a change, as it could potentially disrupt the functionality of other programs running on the chart. Here is the code in question:
The platform should only make the change for the program that calls the function, rather than all programs.

If you don't want to disable chart events for all programs, then simply stop processing chart events on the EA. There is no need to use "ChartSetInteger(0, CHART_EVENT_MOUSE_MOVE, false)".

Simply have a globally scoped boolean variable which is checked on the first line of the OnChartEvent function.

bool g_bProcessChartEvent = false;

void  OnChartEvent( ... ) {
   if( g_bProcessChartEvent ) {
      // do something
   };
};

Elsewhere in your code you can enable and disable it as you wish.

// Enable processing chart events
   g_bProcessChartEvent = true;

// Disable processing chart events
   g_bProcessChartEvent = false;
 
Fernando Carreiro #:

If you don't want to disable chart events for all programs, then simply stop processing chart events on the EA. There is no need to use "ChartSetInteger(0, CHART_EVENT_MOUSE_MOVE, false)".

Simply have a globally scoped boolean variable which is checked on the first line of the OnChartEvent function.

Elsewhere in your code you can enable and disable it as you wish.

I think the issue remains partially , for instance if my app blocks access to mouse move and his app needs it .

I also tried to test it with 2 eas on one chart , and i could not have both eas running . I recall multiple eas being possible on mt5 , that changed or i'm doing it wrong ?

 
Lorentzos Roussos #: I think the issue remains partially , for instance if my app blocks access to mouse move and his app needs it . I also tried to test it with 2 eas on one chart , and i could not have both eas running . I recall multiple eas being possible on mt5 , that changed or i'm doing it wrong ?

My example code does not block events for any other program on the same chart.

You can only run one EA per chart, be it MT4 or MT5!

 
Fernando Carreiro #:

My example code does not block events for any other program on the same chart.

You can only run one EA per chart, be it MT4 or MT5!

Yes but it requires everyone to implement it for it to work both ways

 
Lorentzos Roussos #: Yes but it requires everyone to implement it for it to work both ways

Yes, it requires that "everyone" know how to code properly and not misuse the "ChartSetInteger(0, CHART_EVENT_MOUSE_MOVE, false)".

That is the whole point of my previous point!

 
Lorentzos Roussos #: I recall multiple eas being possible on mt5 , that changed or i'm doing it wrong ?

Wrong. Open another chart and put the other EA there.

 
William Roeder #:

Wrong. Open another chart and put the other EA there.

Hmm i remember it wrong , getting old .

Fernando Carreiro #:

Yes, it requires that "everyone" know how to code properly and not misuse the "ChartSetInteger(0, CHART_EVENT_MOUSE_MOVE, false)".

That is the whole point of my previous point!

Well in a hypothesis mq could turn it to "receive from chart" rather than change chart , and even if there is one app that requires mouse move then its tracked . 

 
Lorentzos Roussos #:

...

Well in a hypothesis mq could turn it to "receive from chart" rather than change chart , and even if there is one app that requires mouse move then its tracked . 

You are right, but it's too late now, they can't change as it would break a lot of existing code and products.

It was a bad design decision. Now we just have to deal with it, that can lead to "funny" fight between programs running on a chart.

 
Ehsan:

The following code in a program that enables or disables the CHART_EVENT_MOUSE_MOVE for all programs running on the same chart is really unwanted. Or is there something I may be overlooking? It is important to consider the potential consequences of such a change, as it could potentially disrupt the functionality of other programs running on the chart.

Here is the code in question:

The platform should only make the change for the program that calls the function, rather than all programs.

Your application can detect it and warn the user about conflictual applications.

Don't expect any change in the platform.

 
Alain Verleyen #:

You are right, but it's too late now, they can't change as it would break a lot of existing code and products.

It was a bad design decision. Now we just have to deal with it, that can lead to "funny" fight between programs running on a chart.

Exactly! Thank you for confirming that it's a bad design decision. Currently, we have to run a timer to detect the changes, which is not efficient. However, if the platform is modified to make changes on a per-app basis instead of globally, it should not break any existing code or products - unless someone has written an app with the assumption that other apps will make changes for it, which is not our problem.
Reason: