How to detect changes to indicator's parameters in EA?

 

Is it possible inside an EA to detect that the user has changed the parameters of one of the indicators?

My current solution is to embed the parameters in the short name of the indicator and then check every second inside OnTimer(). Is there a better way to detect changes to the indicator parameters?

 
ale:

Is it possible inside an EA to detect that the user has changed the parameters of one of the indicators?

My current solution is to embed the parameters in the short name of the indicator and then check every second inside OnTimer(). Is there a better way to detect changes to the indicator parameters?

A CHARTEVENT_CHART_CHANGE event is triggered when you changed indicator's parameters.
 
angevoyageur:
A CHARTEVENT_CHART_CHANGE event is triggered when you changed indicator's parameters.
Thanks! The MQL4 has no documentation for CHARTEVENT_CHART_CHANGE, but your comment led me to the MQL5 docs.
 
Alain Verleyen:
A CHARTEVENT_CHART_CHANGE event is triggered when you changed indicator's parameters.

Is it possible to tell the difference between a chart resize and a change to the indicator's parameters?

The documentation says, "Change of the chart size or modification of chart properties through the Properties dialog."

It does, indeed, fire for either case; but I see no immediate way to tell them apart. The lparam, dparam, and sparam seem to be the same for either size change or properties modification.

 
Anthony Garot:

Is it possible to tell the difference between a chart resize and a change to the indicator's parameters?

The documentation says, "Change of the chart size or modification of chart properties through the Properties dialog."

It does, indeed, fire for either case; but I see no immediate way to tell them apart. The lparam, dparam, and sparam seem to be the same for either size change or properties modification.

Unfortunately CHARTEVENT_CHART_CHANGE is a catchall event. So you need to test for the changes you want to process.
 
Alain Verleyen:
Unfortunately CHARTEVENT_CHART_CHANGE is a catchall event. So you need to test for the changes you want to process.
Roger that. Thank you for your response.
 
Anthony Garot:

Is it possible to tell the difference between a chart resize and a change to the indicator's parameters?

The documentation says, "Change of the chart size or modification of chart properties through the Properties dialog."

It does, indeed, fire for either case; but I see no immediate way to tell them apart. The lparam, dparam, and sparam seem to be the same for either size change or properties modification.

You can use the reason code of the OnDeinit() as well

void OnDeinit(const int reason)
  {
   if(reason == REASON_PARAMETERS)
     {
      //Parameters Changed
     }
  }

but it will also trigger even if you open the input dialog box and click OK without even changing the parameters..

 
Lakshan Perera:

You can use the reason code of the OnDeinit() as well

but it will also trigger even if you open the input dialog box and click OK without even changing the parameters..

You missed the point I think, the goal is to detect a change OUTSIDE the indicator.
 
Alain Verleyen:
You missed the point I think, the goal is to detect a change OUTSIDE the indicator.

what do you mean? maybe I have misread the question, can you please elaborate more?

 
Anthony Garot:
Roger that. Thank you for your response.

You could save the chart template and then parse the tpl.xml file in order to find which params have changed is any. 

 
nicholi shen:

You could save the chart template and then parse the tpl.xml file in order to find which params have changed is any. 

That seems like a good general solution.

For my current need, I found an easy enough work-around.

I did ask the Service Desk if they would consider differentiating between the two events. I suggested a non-zero value for lparam.

Reason: