I am using some Global Variables in my MT4 EA to store values which should be retained if, for example, the server re-boots. In the OnInit() method, the existence of these is checked using GlobalVariableCheck() for each variable. If not present, the variable is re-initialized, and a message is written to the log.
This all works fine when running on a local machine, but when migrated to an MQL5 Hosted server, the logs indicate that all of the Global Variables are always unknown. The variables are being re-initialized every time I migrate even though the same variable names were present from the previous migration.
Is it that the migration process always clears the Global Variables, or is there something else possibly going wrong?
Why did you post your MT4 question in the MT5 General section instead of the MQL4 section, (bottom of the Root page?) General rules and best pratices of the Forum. - General - MQL5 programming forum? Next time post in the correct place. The moderators will likely move this thread there soon.
1. Ok, we all make mistakes! Thanks for replying anyway.
2. No I'm not but as I understand it the GlobalVariablesFlush() method is only to force a premature saving of the variables? They should still get saved periodically without that call, I believe. Yet on re-migrating to the host, my Global Variables are apparently unknown even though the EA has been running for days. I'll try sticking in a 'flush' and report back. Maybe by then the question will be in the correct section ;-).
EDIT: Nope, calling GlobalVariablesFlush() now but still when the EA is migrated (twice), GlobalVariablesCheck(varName) is returning false for all variables. I can only conclude that migration causes the Global Variables to be cleared.
That is true
That is true.
1. Ah, that was my original question! So, Global Variables on the hosted server are cleared on migration - thanks.
2. Indeed it was not, I was trying to be helpful answering someone else's question which did ask whether Global Variables were copied from the terminal to the hosted terminal - not my question at all.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.