EA locking

 
Hello

I'm using the following part of code to lock a certain EA


//Date Lock
bool use_demo=True;
int demo_year=2015;
int demo_month=7;
int demo_day=30;
//Account Number Lock
int acc_number=11223344;

int start() {
  //demo
if(use_demo)
{
if((Year()>demo_year || (Year()==demo_year && Month()>demo_month) || (Year()==demo_year && Month()==demo_month && Day()>=demo_day)) || IsTesting())
{
Alert("License Expired, Contact Seller: example@example.com");
return(0);
}
}

  //acc number
  if(acc_number!=0 && acc_number!=AccountNumber())
  {
  Alert("EA Not Licensed For Your Account Number, Contact Seller: example@example.com");
  return(0);
  }

My question is how can I output an ex4 file to work on several accounts instead of producing 1 ex4 file for each account ie: 11223344, 124578, 458789, 87859.
 

I'm using the following code ...

//===============================================
int      LiveAccountNo = 1234567890;
datetime   Demo_Expiry = D'2015.09.30 00:00';
//===============================================

In the Start() ... Type the following ...

   if(!IsDemo() && AccountNumber()!=LiveAccountNo){
      Comment("The EA is not licenced to this live account ...",
              "\nContact .......@gmail.com to get a license ...");
      return(0);        
   }
   
   if(IsDemo() && TimeCurrent()>Demo_Expiry){
      Comment("The EA Demo test copy has expired...",
              "\nContact .......@gmail.com to renew the license ...");
      return(0);        
   } 

You can play around the live or demo expiry date ...

 

For using the EA for multiple live accounts ... use ...

   if(!IsDemo() && (AccountNumber()!=LiveAccountNo1 || AccountNumber()!=LiveAccountNo2 || AccountNumber()!=LiveAccountNo3)){
      Comment("The EA is not licenced to this live account ...",
              "\nContact ........@gmail.com to get a license ...");
      return(0);        
   }
 
Looking for documentation on how to lock EA's for rental but not allow them to be shared or copied?
 

how can i use this code for mql5 files ?

 

Securing MQL5 code: Password Protection, Key Generators, Time-limits, Remote Licenses and Advanced EA License Key Encryption Techniques  

In this article I presented a few ways to protect MQL5 code. I also introduced remote license concept via MQL5-RPC call and added base64 encoding support. I hope the article will serve as a basis to further ideas on how to secure MQL5 code. All source code is attached to the article.

Most developers need to have their code secured. This article will present a few different ways to protect MQL5 software. All examples in the article will refer to Expert Advisors but the same rules can be applied to Scripts and Indicators. The article starts with simple password protection and follows with key generators, licensing a given brokers account and time-limit protection. Then it introduces a remote license server concept. My last article on MQL5-RPC framework described Remote Procedure Calls from MetaTrader 5 to any XML-RPC server.

I will make use of this solution to provide an example of a remote license. I will also describe how to enhance this solution with base64 encoding and provide advice for PGP support to make ultra-secure protection for MQL5 Expert Advisors and Indicators. I am aware thatMetaQuotes Software Corp. is providing some options for licensing the code directly from the MQL5.com Market section. This is really good for all developers and will not invalidate ideas presented in this article. Both solutions used together can only make the protection stronger and more secure against software theft.

MetaTrader 5 Trading Platform for Forex, Stocks, Futures
MetaTrader 5 Trading Platform for Forex, Stocks, Futures
  • www.metatrader5.com
MetaTrader 5 allows you to enjoy the freedom of movement to the full extent — you can stay active while trading from smartphones and tablets. The Web Platform provides even more possibilities and allows you to work from any web browser and any device. By choosing the most convenient way from a variety of options, you can trade 24 hours a day...
 
Amin EL-HAKIM:
Hello

I'm using the following part of code to lock a certain EA



My question is how can I output an ex4 file to work on several accounts instead of producing 1 ex4 file for each account ie: 11223344, 124578, 458789, 87859.
Hello you can just put // on Account Number facility and below there on Account code.

E.g //int acc_number=1233444

And from //if(acc_........
Reason: