Wrong. Your code is deleting them, or you are not properly shutting down the terminal. It can take thirty (30) seconds after the window closes, before all files are written and the terminal exits if you have dozens of open charts.
Wrong. Your code is deleting them, or you are not properly shutting down the terminal. It can take thirty (30) seconds after the window closes, before all files are written and the terminal exits if you have dozens of open charts.
My code does not remove global variables because it does not contain the GlobalVariableDel function. As I wrote above, with the same code, my global variable is saved after restarting the terminal, but the customer does not.
Regarding the incorrect closing of the terminal, I do not quite understand what you mean. Could you explain this in more detail please?
- There is a possibility that the file that holds the Global Terminal Variables may be corrupted. Try closing the terminal then deleting that file "<data folder>/Bases/gvariables.dat" and then recreating all the variables again.
- When you change a Global Terminal Variable, remember to flush the content to the file with GlobalVariablesFlush. This prevents possible data loss if the terminal is closed unexpectedly.
- As for the Windows vs Mac difference, I don't have any experience with a Mac, so there could be another possible reason, but try the previous two points to see if it resolves the issue.
Thanks in advance for any help.
So I tried your code on a Mac. The first run gives 0 and 1, normal. And after I restarted MT5 it gives 1 and 1. So all seems ok.
As suggested by others, most probably your customer didn't close the platform correctly and the GVT was not saved, flush them regularly or each time it's important to not lose a value.
Thank you so much for your help, your advice helped me.
Now everything works as it should.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Thanks in advance for any help.