EA Locking to prevent illegal distribution

 

Hello! I'm working on several projects and for some of those I require to be restricted without having to buy/rent a server to make kind of a every 6 hours check for license numbers or something like that.

I came up with a fairly simple idea, and I just wanted to get opinions on that and other walk-around methods that can be taken

if(AccountNumber() != [Account number of the authorized user])
 {
   Alert("Unauthorized account, contact [My project contact mail] to get an authorized copy");
    //I'm not sure if I should use 
   ExpertRemove();
   //Or just use
   return(1);
   }

I would be placing the code on the OnInit() part of the Expert Advisor but I'm not sure if I should use just ExpertRemove() function or return 1 so the expert won't be initialized correctly, any advise on this?

Also, how would be a proper syntax to set an expiry date? I haven't worked with dates data so I'm not sure if I should pass the expiration date as a string and compare it to server time, any suggestions?

 
FernandoBorea:

Hello! I'm working on several projects and for some of those I require to be restricted without having to buy/rent a server to make kind of a every 6 hours check for license numbers or something like that.

I came up with a fairly simple idea, and I just wanted to get opinions on that and other walk-around methods that can be taken

I would be placing the code on the OnInit() part of the Expert Advisor but I'm not sure if I should use just ExpertRemove() function or return 1 so the expert won't be initialized correctly, any advise on this?

Also, how would be a proper syntax to set an expiry date? I haven't worked with dates data so I'm not sure if I should pass the expiration date as a string and compare it to server time, any suggestions?

It's indeed better than a password - with sources' deletion it's unassailable. You can use ExpertRemove(), you can also call a dll and bomb the computer or whatever. On the other hand, if you go so far, think about using several brokers and accounts.

For time expiration, as a string it's feasible, but best is to do it with timetostruct : 

https://www.mql5.com/en/docs/dateandtime/timetostruct

Documentation on MQL5: Date and Time / TimeToStruct
Documentation on MQL5: Date and Time / TimeToStruct
  • www.mql5.com
Date and Time / TimeToStruct - Reference on algorithmic/automated trading language for MetaTrader 5
 
Icham Aidibe:

It's indeed better than a password - with sources' deletion it's unassailable. You can use ExpertRemove(), you can also call a dll and bomb the computer or whatever. On the other hand, if you go so far, think about using several brokers and accounts.

For time expiration, as a string it's feasible, but best is to do it with timetostruct : 

https://www.mql5.com/en/docs/dateandtime/timetostr

I want to be able to lock my EA's and have the purchaser only get up to 2 downloads, without being able to copy and share?

 
Jonathan Mcbrine:

I want to be able to lock my EA's and have the purchaser only get up to 2 downloads, without being able to copy and share?

You will need to communicate with some server, which means to own access rights to a server and then approach it from the EA to get/send data, including user registrations etc.

If you have such access, you can add a code inside the EA to update your server when the user downloads from a specific link you give him. and limit it to 2 downloads only.

 
You can also use the Blockchain to register and block accounts.
 
change that acc number you get and make it to generated string, make that generated string as your key, so you don't need to compile again every new user.
Reason: