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.
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.
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.
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..
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.
what do you mean? maybe I have misread the question, can you please elaborate more?
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.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
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?