Is there an optimized way to refresh an EA?

whoowl
236
whoowl  

I have an EA running on more than a dozen pairs. Every time I edit the code, I have to manually switch to each chart and manually reload the EA because the new code won't go into effect automatically. A real pain.

That also applies to templates. Even if I reload a template after the code has been changed, the template stores the old version of the EA. So I have to reload the EA and save the template again so it is updated properly, then I have to manually reload the template in each chart individually. Extra pain.


Is there some way around that, either programatically or some other way?

Keith Watford
Moderator
31749
Keith Watford  

I assume that you are not changing the name of the EA.

You can try adding a new fake input before compiling. Ie. an input variable that is not actually used in the code. Don't forget to remove it later.

whoowl
236
whoowl  
Keith Watford:

I assume that you are not changing the name of the EA.

You can try adding a new fake input before compiling. Ie. an input variable that is not actually used in the code. Don't forget to remove it later.

So you're saying that merely introducing an input variable will force the EA to be reloaded on all charts?

And why do I have to remove it later?

Keith Watford
Moderator
31749
Keith Watford  
whoowl:

So you're saying that merely introducing an input variable will force the EA to be reloaded on all charts?

Why don't you try it and see.

whoowl:

And why do I have to remove it later?

You don't have to remove it, but do you really want inputs that don't do anything?

whoowl
236
whoowl  
Keith Watford:

Why don't you try it and see.


I tried it, and it doesn't make any difference. I still have to reload the EA on every chart individually.

Keith Watford
Moderator
31749
Keith Watford  
Keith Watford:

I assume that you are not changing the name of the EA.

You can try adding a new fake input before compiling. Ie. an input variable that is not actually used in the code. Don't forget to remove it later.

I know that this seems a dumb question, but when you are editing and compiling, you are keeping the EA name the same are you?

whoowl
236
whoowl  
Keith Watford:

I know that this seems a dumb question, but when you are editing and compiling, you are keeping the EA name the same are you?

Yes. I just save it and press F7 to recompile.

Keith Watford
Moderator
31749
Keith Watford  
whoowl:

Yes. I just save it and press F7 to recompile.

I don't know why you need to save it before compiling as it gets saved when it is compiled. But that shouldn't make any difference.

Whenever I re-compile, if the EA is on a chart it will automatically re-initialize so I don't know why yours do not.

The only thing is if you change the default input values in the code, they will not be updated. That is why I suggested the trick of adding a fake input, then the input values are updated.

Do you use software to clean your system  periodically. I do find that I need to do that when MT gets clunky.

The other thing that you can try is to change profiles. This should unload all the EAs. Change back to the original profile and the EAs should all be re-loaded and re-initialized.