Where does MetaTrader store its state?

 

Hello all,

it sometimes happens to me that after a terminal restart, not all of my EAs and indicators are restored. So I'm wondering where/how MetaTrader stores its state? Maybe it's just a permission problem that can be fixed easily. Multiple re-installs of the terminal did not fix the problem.

Thank you in advance.

 
Eric Emmrich: it sometimes happens to me that after a terminal restart, not all of my EAs and indicators are restored. So I'm wondering where/how MetaTrader stores its state? Maybe it's just a permission problem that can be fixed easily. Multiple re-installs of the terminal did not fix the problem.
The charts state is saved in "..\[data folder]\MQL5\Profiles\Charts\..."
 
Fernando Carreiro #:
The charts state is saved in "..\[data folder]\MQL5\Profiles\Charts\..."

What would I do without you, Fernando :) Many thanks for the prompt response!

I will check the permissions on this folder then. If they are correct, do you happen to know what else could cause this problem? I don't see any pattern. It only happens occasionally and the logs also don't state anything.

 
Eric Emmrich #: What would I do without you, Fernando :) Many thanks for the prompt response! I will check the permissions on this folder then. If they are correct, do you happen to know what else could cause this problem? I don't see any pattern. It only happens occasionally and the logs also don't state anything.

It can happen when the MetaTrader terminal is not properly closed. This can sometimes happen when a computer undergoes a forced restart (such as a VPS that is restarted as part of a Windows update or other maintenance intervention).

When you change your chart setup, close MetaTrader manually and then restart it again so that the changes are saved. This way even if MetaTrader is not properly closed later on, the changes have already been saved.

 
Fernando Carreiro #:

It can happen when the MetaTrader terminal is not properly closed. This can sometimes happen when a computer undergoes a forced restart (such as a VPS that is restarted as part of a Windows update or other maintenance intervention).

When you change your chart setup, close MetaTrader manually and then restart it again so that the changes are saved. This way even if MetaTrader is not properly closed later on, the changes have already been saved.

Oh that's a really good point. That would also explain why it only happens occasionally. 

Is there any option to force MetaTrader to store its state periodically? Or can I store the state manually somehow without closing MetaTrader?

 
Eric Emmrich #: Oh that's a really good point. That would also explain why it only happens occasionally. Is there any option to force MetaTrader to store its state periodically? Or can I store the state manually somehow without closing MetaTrader?

I don't know of any method to instruct MetaTrader to flush its state to disk. As long as MetaTrader is closed properly, it should save it's state.

Maybe you can change your computer or VPS settings to not carry out automatic Windows updates or to not to restart automatically but simply notify you first.

Reason: