Remembering previous values of EA extern variables

 

Is there any way to remember previous values for extern variables of an EA in N2Trader?

in N2Trader, When a user attachs the EA to a chart, a windows is displayed that allows him to change values for extern variables defined in EA.

The user can store this values by "Save" and "Load" them later.

But, is there any way that the EA do this automatically and programatically?

The first suggestion is storing this values in a file and loading them in init() function. But It seems the init() function is called AFTER this dialog, so there is no chance? :(

 

Yep, these should do it.

https://docs.mql4.com/globals/GlobalVariableSet

https://docs.mql4.com/globals/GlobalVariableGet

https://book.mql4.com/variables/globals

V

Of course you could just delete the extern part in the program


EDIT: I really must learn to finish reading before I start typing..

"The first suggestion is storing this values in a file and loading them in init() function. But It seems the init() function is called AFTER this dialog, so there is no chance? :("

Now I'm confused as to your intention... Do you mean that the program should re write the extern values so that the next time you see the dialologue, the latest values would be seen?... hmm not sure then if that's the case

V

 

Note that if you stop the terminal with the EA running, then whenever you start it again with the EA still attached to the chart, it will be initialized with whatever extern parameters you had previously entered in the dialog box.

CB

 

@Viffer:

yes. unfortunately, that's the case.

@cloudbreaker:

Well! this is a big development. This really solves some part of problem and the user does not have to do anything!

But when he/she want to change "some" of external variables, the problem arise again. Because in that dialogue all external parameters take their "default" value, not their previous value :(

So the question is:

Is there any way to allow the user to change an arbitary external variable while keeping previous values of other external variables?

Thanks.

 

Talk us through the sequence of events that you desire, along with the rationale.

CB

 
isaac, are u changing the values of extern variables via code? If so, u should read this -> https://www.mql5.com/en/forum/123535.
Reason: