How to validate an EA to run per live account?

 

Hi,
How can i code for my EA, and to make sure it is only run on 1 MT4 live account?

i have 1 EA and going to sell for public, but i'm only allow 1 copy of EA will able to run on 1 particular Live account, how to accomplish this?

thanks.

 
10265293:

Hi,
How can i code for my EA, and to make sure it is only run on 1 MT4 live account?

i have 1 EA and going to sell for public, but i'm only allow 1 copy of EA will able to run on 1 particular Live account, how to accomplish this?

thanks.

Hi,
You can use the function IsDemo().

 
IsDemo() would be appropriate to select to run only on live or only on demo accounts.

If you wish it to run on a PARTICULAR account, then I'd suggest using both of:
AccountCompany() and AccountNimber()

CB
 
cloudbreaker:
IsDemo() would be appropriate to select to run only on live or only on demo accounts.

If you wish it to run on a PARTICULAR account, then I'd suggest using both of:
AccountCompany() and AccountNimber()

CB

A few months ago my broker changed AccountCompany() with no prior notice or apparent reason. After discussing this with the broker, they said they were sorry and in the future they will try to give prior notice. Bottom line - I think using AccountCompany() is not very reliable. But I imagine no broker would change your account number without telling you, so AccountNumber() should be safe.

 

thanks for all of your reply, i would use 1 more layer of protecton which is Hardware Key, is anyone have idea how to do it? can use c# dll?

If any of you know how to do, can share how is the source code? thanks

 
10265293:

thanks for all of your reply, i would use 1 more layer of protecton which is Hardware Key, is anyone have idea how to do it? can use c# dll?

You can get hardware details via API calls in MQL4, or you can do the check in an external DLL. The singlest simplest "hardware key" to use in this context is probably the MAC address (of the wired network card). A c# DLL will make it easy to get this information, but you'll need a bridge between it and MQL4. AFAIK there's no way of using c# to create a DLL which can be called directly from MQL4 (because c# can only create COM-visible DLLs, and MQL4 can't use COM objects).

However, none of this is going to prevent someone from decompiling your .ex4 file and removing the protection - either the block of MQL4 code which queries the hardware, or the bit of the code which calls a DLL.

Reason: