How to fix this error

 
datetime allowed_until = D'2012.02.11 00:00'; 
                             
int password_status = -1;

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   printf("This EA is valid until %s", TimeToString(allowed_until, TIME_DATE|TIME_MINUTES));
   datetime now = TimeCurrent();
   
   if (now < allowed_until) 
         Print("EA time limit verified, EA init time : " + TimeToString(now, TIME_DATE|TIME_MINUTES));
   
    
//---
   return(0);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
  if (TimeCurrent() < allowed_until) 
    {        
    }
   else Print("EA expired."); 
  }
Files:
error.PNG  102 kb
 
SatyamGanju:
Please show all the program so that it can be fixed
 
Remove the additional OnInit() and OnDeinit() functions.
 
which functions to use instead ? sorry im new to coding , can you rewrite the source code using other functions than OnInit() and OnDeinit() functions.?
 
SatyamGanju:
which functions to use instead ? sorry im new to coding , can you rewrite the source code using other functions than OnInit() and OnDeinit() functions.?
Keith Watford:
Remove the additional OnInit() and OnDeinit() functions.

You have duplicated the functions.

Show your code if you need more help.

 

 Really ontick();

  if (TimeCurrent() < allowed_until) 
    {        
    }

what is it going to do now?

int OnInit()
  {
//---
   printf("This EA is valid until %s", TimeToString(allowed_until, TIME_DATE|TIME_MINUTES));
   datetime now = TimeCurrent();
   
   if (now < allowed_until) 
         Print("EA time limit verified, EA init time : " + TimeToString(now, TIME_DATE|TIME_MINUTES));
   
    
//---
   return(0);
  }

Note the date set:

datetime allowed_until = D'2012.02.11 00:00'; 

Also password I am sure is meant to be a string, unless you a file or other means.

int password_status = -1;
 
Keith Watford:

You have duplicated the functions.

Show your code if you need more help.


Files:
PivotsX.mq4  41 kb
 

i have uploaded mq4 file .. pls take a look

im trying to make it time bound indicator and if possible password protected also , i was trying to copy code from this source but im facing errors in both method

https://www.mql5.com/en/articles/359

Pls Help , It would be highly appreciated ;-)

Securing MQL5 code: Password Protection, Key Generators, Time-limits, Remote Licenses and Advanced EA License Key Encryption Techniques
Securing MQL5 code: Password Protection, Key Generators, Time-limits, Remote Licenses and Advanced EA License Key Encryption Techniques
  • www.mql5.com
Most developers need to have their code secured. This article will present a few different ways to protect MQL5 software. All examples in the article will refer to Expert Advisors but the same rules can be applied to Scripts and Indicators. The article starts with simple password protection and follows with key generators, licensing a given...
 
GrumpyDuckMan:

 Really ontick();

what is it going to do now?

Note the date set:

Also password I am sure is meant to be a string, unless you a file or other means.

thanks for your reply but im unable to understand what you wishes to tell ... anyways i have upload mq4 file and a link from where im trying to copy code to protect my indicator by adding time bound and password . pls take a look ;-)

 
Your PivotsX file compiles with no errors
 
Yes  I know that it compiles with no error... But when I add above mentioned code to make my indicator time bound it shows the error which is mentioned above.. pls check everything & thanks a lot for helping
Reason: