EA Runtime Variables

 

Hi,

I'm developing an EA that keeps in variables several "dynamic" parameters. In case of a crash or just a shutdown how should I "save" these parameters?

1-"dump" the variables into a text file and load it at startup/init section?

2-Using global variables?


Any sugestions?

Best regards


Paulo

 
What kind of crash?
 
forexCoder:
What kind of crash?


Power fail, HDD Fail, Hardware errors

 
psousa:

Hi,

I'm developing an EA that keeps in variables several "dynamic" parameters. In case of a crash or just a shutdown how should I "save" these parameters?

1-"dump" the variables into a text file and load it at startup/init section?

2-Using global variables?

In case of a power failure, HDD fail, or hardware errors you usually won't have enough time to instantly dump variables into some file on disk as the errors happen instantly.

However it is entirely possible that during the EA execution, every time your EA does something, you write it to file. It's safe(r) that way, but you still won't be able to 100% guarantee your data in case of HDD failure, lightning strikes, rain in your PC, stuff like that.

For a higher chance of succesfully saving your data, I suggest having another program back up your files to multiple locations. I'd suggest RAID field as well, but i have had bad experience with it.

 

another option ('off-site backup') is to email yourself the variables every so often

*edit* from the EA, that is

Reason: