Download MetaTrader 5

How to tell EA that input parameter has changed

To add comments, please log in or register
macpee
487
macpee  
Hi comrades. How can I tell EA that the value of an input has changed in the parameter window for the EA. The input can be of type integer or double or string (or extern or input) etc. I want my EA to know that the value of an input parameter has changed the moment I clicks OK button. Thank you in advance.
Keith Watford
Moderator
9641
Keith Watford  
macpee:
Hi comrades. How can I tell EA that the value of an input has changed in the parameter window for the EA. The input can be of type integer or double or string (or extern or input) etc. I want my EA to know that the value of an input parameter has changed the moment I clicks OK button. Thank you in advance.
When you change inputs and click OK, the EA is re-initialized and the EA automatically uses the new parameters.
macpee
487
macpee  
GumRai:
When you change inputs and click OK, the EA is re-initialized and the EA automatically uses the new parameters.

Thank you, I know of that. But I want to do something else when an input is CHANGED. I need something like a change event for parameter window, similar to the CHARTEVENT_OBJECT_CHANGE for graphical object property changed via the properties dialog.

What I want to do is assign the new value to a Global Variable so that when I view another chart where that EA is attached, I wont have to re-enter the new value of the input parameter again. I want the change of parameter to take effect on all the charts where the EA has been attached. Thank you in advance





peter.MT4Web
158
peter.MT4Web  

You get the info that parameters have changed in OnDeinit and you can react in the following OnInit.

macpee
487
macpee  
eddie:

You get the info that parameters have changed in OnDeinit and you can react in the following OnInit.


Thank you. But change of parameter input is not the only event that triggers OnDeinit or OnInit, other events do trigger them too. I want something that only the Change inparameter input triggers.

What I want to do is assign the new value to a Global Variable so that when I view another chart where that EA is attached, I wont have to re-enter the new value of the input parameter again. I want the change of parameter to take effect on all the charts where the EA has been attached. Thank you in advance

honest_knave
Moderator
2419
honest_knave  
macpee:

Thank you. But change of parameter input is not the only event thattriggers OnDeinit or OnInit, other events do trigger them too. I wantsomething that only the Change inparameter input triggers.

What I want to do is assign the new value to a Global Variable sothat when I view another chart where that EA is attached, I wont have tore-enter the new value of the input parameter again. I want the changeof parameter to take effect on all the charts where the EA has beenattached. Thank you in advance


Sounds like you have found your own solution: create / update global variables (you'll need to choose a method to do so: manually, OBJ_EDIT etc). Then run a short timer in your code that checks the value of the global variable. As soon as there is a change, all instances of your EA will update accordingly.
peter.MT4Web
158
peter.MT4Web  

Why not trying to read the manual about the parameter comming with OnDeinit ?

To add comments, please log in or register