License control after EA is triggered

 


Hi Guys,


I have the following basic logic for expiration control


//+------------------------------------------------------------------+
//|   Global Variable                                                |
//+------------------------------------------------------------------+
//expiration date 
datetime expiry=D'2020.12.31 12:00:00';  // Equal to D'1980.07.19 12:30:27' yy/mm/dd hh:mm

//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   ExpirationDate(expiry,"EA Expired");
  }


//+------------------------------------------------------------------+
//| ExpirationDate                                                   |
//+------------------------------------------------------------------+
void ExpirationDate(datetime validator,string message)
  {
//Check expiration case if remove EA
   if(validator<TimeCurrent())
     {
      Print(message);
      Alert(message);
      ExpertRemove();
     }
  }

so far it works, but here is the catch, I would like to automate the date process, where when it is the first time that the EA is placed on the chart it captures the date and starts counting the expiration date from the capture time. Even if the EA is removed from the chart or added to other charts, the date of the first time it was placed, need to still remain.


can anyone help me ?

Thanks

 
Davi Silva:

Hi Guys,


I have the following basic logic for expiration control


so far it works, but here is the catch, I would like to automate the date process, where when it is the first time that the EA is placed on the chart it captures the date and starts counting the expiration date from the capture time. Even if the EA is removed from the chart or added to other charts, the date of the first time it was placed, need to still remain.


can anyone help me ?

Thanks

Impossible unless use a remote license control. The local data can be deleted by user and the ea will restart again
 
Xiaowei Yan:
Impossible unless use a remote license control. The local data can be deleted by user and the ea will restart again

That's what I thought, thanks for taking the time to help me