How to set that ea ex.4 file would expire at my wanted date.
Read this thread https://www.mql5.com/en/forum/174194
and
this Codersguru article http://www.metatrader.info/node/132
I added this code to EA:
Trial period protection:
int start()
{
string expire_date = "2006.31.06"; //<-- hard coded datetime
datetime e_d = StrToTime(expire_date);
if (CurTime() >= e_d)
{
Alert ("The trial version has been expired!");
return(0);
}
// your normal code!
return(0);
}
But it did not give any warning or today is market closed it will not work properly?
Hi jyrik,
1- try this code:
if (TimeCurrent() >= expire_date)
{
Alert ("The trial version has been expired!");
return(0);
}2- CurTime() is abandoned function now, use TimeCurrent() instead.
3- To test the code while the market off put it in init().
I added this code to EA:
Trial period protection:
int start()
{
string expire_date = "2006.31.06"; //<-- hard coded datetime
datetime e_d = StrToTime(expire_date);
if (CurTime() >= e_d)
{
Alert ("The trial version has been expired!");
return(0);
}
// your normal code!
return(0);
}
But it did not give any warning or today is market closed it will not work properly?I always bury the trade logic of my EA's in a companion .dll which also includes a date timer so the unscrupulous rat bastards that like to decompile EA's will be crap outa luck.
Hello
Anyone know how can i add a variable date of expiration like if they start/load the first time the EA it can go for 7 days before it expires.
EA expiration
Does anyone know where I am suppose in place this code in MT4 to make it work.
1- try this code:
PHP Code:
datetime expire_date = D'31.06.2006'; //<-- hard coded datetime
if (TimeCurrent() >= expire_date)
{
Alert ("The trial version has been expired!");
return(0);
}
2- CurTime() is abandoned function now, use TimeCurrent() instead.
3- To test the code while the market off put it in init().
Thanks
Hi MLaden,
Can you help me coding an expire date in indicator code? Do you have an example I can use what works?
Thx Marco
Hi MLaden,
Can you help me coding an expire date in indicator code? Do you have an example I can use what works?
Thx MarcoMarco
You can use something like this at the beginning of the start() :
if (TimeCurrent()>=D'23.06.2014 00:00') return(0);
Is it decompiler proof?
Is it decompiler proof?
So far new metatrader 4 ex4 can not be decompiled
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
How to set that ea ex.4 file would expire at my wanted date.