Expiry date in EA - page 3

 
Andreas Bauer:

The above shown code works well for indicators, but what about EAs...

tried it in an EA and it didn't compile; in EA I do not have the function  int onInit ()  but  void onInit ()

Why are you trying to lock down an EA while it is very clear that you do not have any understanding about coding ?

I never understand this.

It makes me think that someone is trying to lock down and sell stolen products.

The code can be changed to suit your needs anywhere.

   datetime Expiry=D'30.08.2018';
   if(TimeCurrent()>Expiry)
     {
      Alert(WindowExpertName()+" Trial Expired");
      ExpertRemove();
     }
 
Andreas Bauer:

The above shown code works well for indicators, but what about EAs...

tried it in an EA and it didn't compile; in EA I do not have the function  int onInit ()  but  void onInit ()

There is no such void function. OnInit always returns an integer whether in an indicator or EA.

 


Marco vd Heijden:

It makes me think that someone is trying to lock down and sell stolen products.

The code can be changed to suit your needs anywhere.

I did not steal anyting.

 
Andreas Bauer:


I did not steal anyting.

I did not say that you did.

I just don't understand why you want to lock down an EA if you don't even know how to code it.

 
Keith Watford 

Thanks you :) It works very well

 
Keith Watford #: There is no such void function. OnInit always returns an integer whether in an indicator or EA.

Not true. Both are valid. (As I learned yesterday.)
          OnInit - Event Handling - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
          Event Handling Functions - MQL4 Reference