want to create a serial key for my ea that works only in one account per serial key

 

Good Day Friend, I'm having a challenge Try to Create Serial key for my new ea, a serial key that work one only one account per serial key. I got this example from mql4 code base but it doesnt show how on serial key is restricted to one account here is the code :


//--------------------------------------------------------------------
// сheck.mq4
// The code should be used for educational purpose only.
//--------------------------------------------------------------- 1 --
extern int Parol=12345;
//--------------------------------------------------------------- 2 --
int start()                            // Special function 'start'
  {
   if(Check()==false)                  // If the using conditions do not..
      return;                          // ..meet the requirements, then exit
 
   // The main code of the program must be specified here
   Alert("Program execution");      // Alert example
 
   return;                             // Exit start()
  }
//--------------------------------------------------------------- 3 --
bool Check()                           // User-defined function of..
  {                                    // .. use conditions checking
   if (IsDemo()==true)                 // If it is a demo account, then..
      return(true);                    // .. there are no other limitations
   if (AccountCompany()=="SuperBank")  // The password is not needed
      return(true);                    // ..for corporate clients
   int Key=AccountNumber()*2+1000001;  // Calculating key
   if (Parol==Key)                     // If the password is correct, then..
      return(true);                    // ..allow the real account to trade
   Alert("Wrong password. EA does not work.");
   return(false);                      // Exit user-defined function
  }
//--------------------------------------------------------------- 4 --
 
  1. Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum 2019.05.06
              Messages Editor

  2. If you sell it on the Market, you don't have to worry about such things.

  3. pek4christ: but it doesnt show how on serial key is restricted to one account
    The hash of the account number must match your key. Your posted code shows exactly "how on serial key is restricted to one account."
 
William Roeder:
  1. Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum 2019.05.06
              Messages Editor

  2. If you sell it on the Market, you don't have to worry about such things.

  3. The hash of the account number must match your key. Your posted code shows exactly "how on serial key is restricted to one account."

I will check it out Thanks

 

This is not a serial control, just password protection.

You need to do more. :)

 
pek4christ:

I will check it out Thanks

William Roeder is not working in the Real account, but it trade on demo account
 
  what is the meaning of this: 
 int Key=AccountNumber()*2+1000001;  // Calculating key
   if (Parol==Key)                     // If the password is correct, then..
      return(true);                    // ..allow the real account to trade
Can the key be equal to the Parol
Reason: