Platform shutdown retains variable values and restart won't reset them.

 

I have an EA with some external variables such as: extern string entry = "";


When I run the EA and use the EA properties window to change the value, for example setting "entry" to the value "above", it works fine. Initially the value was blank and now its "above".


However, if I shutdown the MT4 platform completely and then reopen it, the external variable value will now be "above" when I want it to be "".


Is there a way to have the EA reset the value instead of retaining the last setting?


I don't want to reset the values in Init() because Init() runs when chart symbol is changed, time period is changed, or EA inputs screen closed. That would reset the value when I don't want it reset. I just want it reset when the platform is restarted.

 

Hi jtr,

for doing so you can declare the variable as global but declaring its value inside start(). However you have to remove the EA prior closing it in order to restart its value.

Good luck,

 

Hello Jrt!

I need that my EA close all EURUSD trades and stop to work or reset the values at 23:30 hrs. server time and work again at 24:00 hrs.

Do you know how to do it?

Thank you!

 
sara01:

Hello Jrt!

I need that my EA close all EURUSD trades and stop to work or reset the values at 23:30 hrs. server time and work again at 24:00 hrs.

Do you know how to do it?

Thank you!

Don't double post: https://www.mql5.com/en/forum/141278

Don't dredge up ancient threads without a very good reason . . .

Thread start date: 2008.06.10

Reason: