Download MetaTrader 5

I cant get either of these MQL4 program protections to work Please help!!!!

To add comments, please log in or register
Forex Trader
114280
Forex Trader  

Greetings,

I've tried using both of the MQL4 program protections from the metatrader development

course and neither one works in my indicators. One is for account protection and the other

is for trials. I'm thinking maybe recent updates may have changed something since 2005. If

someone could make the necessary corrections to these it would greatly be appreciated.

Thanks

Carl

Limited account number protection:

In this method of protection you will ask the user to give you his account number and you write the following code to prevent the program to work with another accounts:

int start()
{

int hard_accnt = 11111; //<-- type the user account here before compiling
int accnt = AccountNumber();

if (accnt != hard_accnt)
{
Alert ("You can not use this account (" + DoubleToStr(accnt,0) + ") with this program!");
return(0);
}
// your normal code!
return(0);
}

Trial period protection:

If you want to give the user of the program a try-before-buy program you can limit the usage of your program by limited period of time and after this period the program will not work.
Use the code below to limit your program for period of time.

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);
}

Thanks

Carl

To add comments, please log in or register