How to put a time limit on an ex4 ?

 

Hello,

I've seen (and used) some ex4 files that have a time limit, that is, they stop working at a certain date/time.

I am interested in having that feature in some of my developments (I have a minimum understanding of mql4, enough to develop some EA's using internal and custom indicators).

But I do not know how do put that time limit. Can someone help (an example of code would be great).

Thanks

MD

 
An often used technique is testing current time at the beginning of start() and simply return if the current time has past certain date.
init start() {
    if( TimeCurrent() > D'2008.01.01' ) return(-1);
    // not yet expired, continue with normal logic
    .
    .
    .
}
 

Thanks fireflies!

Will try that!

MD

Reason: