Expert advisor state

 
Can an expert advisor lose state over the weekend when market is closed since there are no ticks coming in? 

For example, when I have a boolean flag to Keep track of something that was  set to true on  Friday and we go into the weekend with the variable still holding value "true" , when market opens on Monday next week, will it still be having the same state of true or it's possible the EA will have lost state when market closed for the weekend?

Secondly, when the EA is running, and then the terminal rescans the network and maybe changes to a different server does that make the EA lose state too ?? 

 
Seleucus: Can an expert advisor lose state over the weekend when market is closed since there are no ticks coming in?  For example, when I have a boolean flag to Keep track of something that was  set to true on  Friday and we go into the weekend with the variable still holding value "true" , when market opens on Monday next week, will it still be having the same state of true or it's possible the EA will have lost state when market closed for the weekend? Secondly, when the EA is running, and then the terminal rescans the network and maybe changes to a different server does that make the EA lose state too ?? 

Over the weekend, many brokers carry out maintenance, so it could happen hat the connection goes down.

If there is a loss of connection or the account reconnects, then there is a possibility of the EA (and indicators) being restarted by the terminal.

You should program your EA to automatically recover, for example by saving important information or states in the Global Terminal Variables or in files.

 
Seleucus:
Can an expert advisor lose state over the weekend when market is closed since there are no ticks coming in? 

For example, when I have a boolean flag to Keep track of something that was  set to true on  Friday and we go into the weekend with the variable still holding value "true" , when market opens on Monday next week, will it still be having the same state of true or it's possible the EA will have lost state when market closed for the weekend?

Secondly, when the EA is running, and then the terminal rescans the network and maybe changes to a different server does that make the EA lose state too ?? 

If you close it and reattach it yes it will close state.

If there is a disconnect and reconnect it won't go through init again (if ea is running)

 
Fernando Carreiro #:

Over the weekend, many brokers carry out maintenance, so it could happen hat the connection goes down.

If there is a loss of connection or the account reconnects, then there is a possibility of the EA (and indicators) being restarted by the terminal.

You should program your EA to automatically recover, for example by saving important information or states in the Global Terminal Variables or in files.

Isn't it only for indicators ?

 
Fernando Carreiro #:

Over the weekend, many brokers carry out maintenance, so it could happen hat the connection goes down.

If there is a loss of connection or the account reconnects, then there is a possibility of the EA (and indicators) being restarted by the terminal.

You should program your EA to automatically recover, for example by saving important information or states in the Global Terminal Variables or in files.

Thanks for insight on saving state. A good reminder about weekend maintenance for most brokers too. I had completely forgotten about it. 

 
Lorentzos Roussos #: Isn't it only for indicators ?

I'm not 100% sure, because if the connection goes down for long, it might think that it is a new account.

So, I would suggest that it is better to be safe than sorry and build the EA to self-recover, even if it does not happen.

The OP has not provide much information, so we can only speculate. For example, if this is a VPS, it might be rebooting during the weekend.

We have very little information about the conditions that could be the cause of the problem. So, one might as well build safe-guards into the EA to make it recover for all these cases.

 
Fernando Carreiro #:

I'm not 100% sure, because if the connection goes down for long, it might think that it is a new account.

So, I would suggest that it is better to be safe than sorry and build the EA to self-recover, even if it does not happen.

The OP has not provide much information, so we can only speculate. For example, if this is a VPS, it might be rebooting during the weekend.

We have very little information about the conditions that could be the cause of the problem. So, one might as well build safe-guards into the EA to make it recover for all these cases.

touche'

 
Lorentzos Roussos #:

If you close it and reattach it yes it will close state.

If there is a disconnect and reconnect it won't go through init again (if ea is running)

Oh that's interesting. So once initialized it works just as it should unless it's reloaded on the chart. Thanks man this has been really helpful. 
Reason: