GlobalVariablesDeleteAll time does not work

 

Run this Expert.

It should delete all variables that are older than 60 sec, but it deletes ALL variables.

The parameter

int  GlobalVariablesDeleteAll(
   string     prefix_name=NULL,     // All global variables with names beginning with the prefix
   datetime   limit_data=0          // All global variables that were changed before this date
   );

does not work.


#property copyright "Copyright 2022, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   GlobalVariableTemp("ddd");
   GlobalVariableTemp("sss");
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   GlobalVariableGet("sss"); // update date
   GlobalVariablesDeleteAll("ddd",TimeCurrent()-60); // delete this after 60 sec
   GlobalVariablesDeleteAll("sss",TimeCurrent()-60); // never delete this
  }
//+------------------------------------------------------------------+
 

Addressing a variable for its value, for example using the GlobalVariableGet() and GlobalVariableCheck() functions, also modifies the time of last access.
GlobalVariableGet - Global Variables of the Terminal - MQL4 Reference
GlobalVariableGet - Global Variables of the Terminal - MQL4 Reference
  • docs.mql4.com
GlobalVariableGet - Global Variables of the Terminal - MQL4 Reference
 
teset #:

Addressing a variable for its value, for example using the GlobalVariableGet() and GlobalVariableCheck() functions, also modifies the time of last access.

fair enough, I checked it on MT4 it does ignore the datetime value