Give my variables eternal life
-
My ea collects info from the chart for several hours before making a trade.
The problem is, when I (accidentally) close the terminal, all variables disappear and the ea would start at 0.What is the best way to store the variables somewhere, so the newly started ea could load the previous variable values?
-
this is problem with metatrader, because variables are deleted when EA is closed ... so idea may be store these variables as "global" or terminal variables, this:
https://docs.mql4.com/globals
as you can read, they are stored for one month and than automatically deleted, and also they are shared with tester and all EAs in terminal ... so be careful

next option can be save variables into file, and than read this file (but it needs specific custom code) ...
-
Yeah, I went with the global variables, but it feels a bit clumsy solution, and makes a really weird interference in my backtest.
The file approach would be better, I guess its time to learn some actual MQL coding