Download MetaTrader 5
To add comments, please log in or register
Interessiert am Partnerprogramm MQL5.community? Veröffentliche Links und verdiene Geld damit!
barnacle7
376
barnacle7 2014.04.24 12:31 

When using arrays or Static variables which are calculating values needed to be kept for processing in an EA,

Is there away to constantly back up those values calculated somewhere so that if the MT4 Terminal is unexpectedly closed the EA can retrieve those values ?

Any links where I can read more on it would be helpful.

Thanks

whroeder1
13610
whroeder1 2014.04.24 13:27  
barnacle7: Is there away to constantly back up those values calculated somewhere so that if the MT4 Terminal is unexpectedly closed the EA can retrieve those values ?
  1. Persistent storage. Write them to a file, read the file OnInit.
  2. Or recalculate the values on startup.
    double arrays[n];
    void Calculating(int i){
      array[0] = Close[i]; 
      :
    }
    OnTick(){
       Calculating(0);
       :
    }
    OnInit(){
       for(int i=Bars-1; i>0; i--) Calculating(i);
       :
honest_knave
961
honest_knave 2014.04.24 13:33  

Another option, depending on your needs, are global variables. However, they do have some shortcomings.

https://docs.mql4.com/globals

/
To add comments, please log in or register