I have problem "Recovering data from last run by GVs"

 

Hi pals,
Hope you are having a nice day

When I want restart VPS, I always Remove EA from chart, restart the VPS and attach the EA again to the chart. However this time I forgot to remove(and reattach) and my data from last run which I always recover with OnInit(), corrupted :(

For now, I have 2 questions:

First, to just be cleared, what would happen by just closing the MT4 without removing the EA? Doesn't the OnDeinit() run? In this case after restarting the MT4, doesn't the OnInit() run before OnTick()?

Second, How can I make it automatically in my EA so if I forget to remove(and reattach), the EA run my GVs recovery? Any idea please?

Virtual hosting for MetaTrader 5
Virtual hosting for MetaTrader 5
  • www.mql5.com
The fastest VPS server for forex trading from the MetaTrader 4/5 terminal developers
 
Stop removing the EA and causing your own problem.
 
William Roeder #:
Stop removing the EA and causing your own problem.

Hi William,

I can not understand you. Please clarify what you mean.

 
HosseinKOGO #:

Hi William,

I can not understand you. Please clarify what you mean.

Fix your code

 
amando #:

Fix your code

Where should I look for the bug?

Currently I recover data in OnInit() by GVs.

What should I do?

 
HosseinKOGO: When I want restart VPS, I always Remove EA from chart, restart the VPS and attach the EA again to the chart.
HosseinKOGO #: I can not understand you. Please clarify what you mean.

What part of “Stop removing the EA” is unclear? Just close the terminal. On restart, the charts and your EA will be there.

 
William Roeder #:

Just close the terminal. On restart, the charts and your EA will be there.

Do you mean the OnInit function would execute after I re-opened the MT4?(Because my GVs recovery is in my OnInit function)

 
Of course, it will. The EA is still attached to the chart(s). What part of “Stop removing the EA” was unclear?