How to lock and giving expiration to Expert Advisor? - page 2

 
Ashkan Hazegh Nikrou:

Thanks sergey

I am reading this link and try to find my answer :

https://www.mql5.com/en/market/rules

from the rules:

Products must not contain deliberate operation restrictions or change their functionality depending on the type of account, account number, name of a trading server and other similar conditions under which they are used.

 
2482492:

Hello. I made an expiration date for my expert. But it gives an error for the expiration date I made. Thank you for your help. thank you



datetime expiryDate = D'20.10.2022 00:00:00'; //change as per your requirement

int OnStart()

  {

   if(TimeCurrent() > expiryDate)

     {

      Alert("Expired copy. Please contact vendor.")

      return(0);

     }

Hi you need one more closing bracket.

datetime expiryDate = D'20.10.2022 00:00:00'; //change as per your requirement

int OnStart()

  {

   if(TimeCurrent() > expiryDate)

     {

      Alert("Expired copy. Please contact vendor."); <-- and a semicolon here.

;



;



      return(0);

     }
   } <---
 

Thank you very much. Thank. But even though I put in a new bracket, I still got the error؟

It is known in the file that I put.

نماد «مورد تأیید انجمن»

نماد «مورد تأیید انجمن»

Files:
vgn5.PNG  187 kb
 

Hello friends. Thank you for guiding me. I want to set an expiration date for my expert. I will also attach an indicator to it. I want the indicator to stop working after the expiration date I coded. I do not see an error in expert writing, but when I put the date last year, does the indicator still work? While it should not work according to the coded date. Can anyone help?

 


datetime expiryDate = D'10.04.2015 00:00:00'; //change as per your requirement

int OnStart()
  {
   if(TimeCurrent() > expiryDate)
    
      Alert("Expired copy. Please contact vendor.");
      return(0);
     }    
 

No now there are two under if(TimeCurrent)

     {} it only needs to be one {

You need one opening bracket { then some code; } and then a closing bracket.
 

Thank you. I think this is the best programming site.

نماد «مورد تأیید انجمن»

 
2482492: I want to set an expiration date for my expert.

OnStart is the event for scripts.

Reason: