How To Add Password On EA

 

Hi , i have an own ea , its working on monthly 30% to 50% , so am sell my ea , so how to set password , like ,  my ea are buy 1 person , use 1 account and 1 person only , don't set unlimited accounts , 

Please help me

 

Call this on initialization function

bool licence()
{
int i;
int password_status = -1;
int name_status = -1;
bool test=MQLInfoInteger(MQL_TESTER);
if(!test)
{
string  expirydate = "2020.01.15 10:59"; //Expire Date                    //
datetime stme;
bool expr = false;
bool acct=false;
bool acctname=true;
if (expr) {
stme = StringToTime(expirydate);
if (TimeCurrent() >= stme) {
Alert("EA has expired! Please, Contact t.me/ask4abusaidu or ask4abusaidu@gmail.com");
ExpertRemove();
}}
//+------------------------------------------------------------------+
const long allowed_accounts[] = { 30511194, 436290, 646490, 225690, 279260 };
const string account_name[] = 
{"Abubakar abu Saidu","Saidu Abubakar abu","Abubakar Abu Saidu","Saidu Abubakar Abu","Abu Saidu","Saidu Abu","Abubakar Saidu","Saidu Abubakar",};
//+------------------------------------------------------------------+
long account=NULL;
string name;
account = AccountInfoInteger(ACCOUNT_LOGIN);
 name= AccountInfoString(ACCOUNT_NAME);

   printf("Account Name =  %d", name);
   printf("Account Number =  %d", account);
if(acct)
   {   for ( i=0; i<ArraySize(allowed_accounts); i++)
       if (account == allowed_accounts[i]) { 
         password_status = 1;
         Print("EA Account Number verified");
         break;
       }
   if (password_status == -1)
      {  Alert("Account Number not verified: EA is not allowed to run on this account Number."); 
    ExpertRemove(); }
    }
//+------------------------------------------------------------------+
if(acctname)
   {  for ( i=0; i<ArraySize(account_name); i++)
       if (name == account_name[i]) { 
         name_status = 1;
         Print("EA Account Name verified");
         break;
       }
   if (name_status == -1)
      {  Alert("Account Name not verified: EA is not allowed to run on this account Name."); 
    ExpertRemove(); }
    }
}
return true;
}
 
Abubakar Saidu:

Call this on initialization function

Thank you so much for reply bro , but which place paste on this code , please explain bro 

 
Home Tech:

Thank you so much for reply bro , but which place paste on this code , please explain bro 

int OnInit()

paste code on this function 
Reason: