User wants to buy unlimited copy of my EA, but i am affraid of unlicensed copying.
If i could check if the user is logged on his account on MQL5.com, then EA would have protection against using it by other users.
Is it possible?
i want to do a single check at EA start (recheck every x seconds, if user not logged in to avoid problems while mql5 is down)
I think it is possible. Check this out:
TERMINAL_COMMUNITY_ACCOUNT should do the job.
almost. i need to check the username of logged in user. there i can only check bool values if user is logged in and balance. None of this information us useful to confirm username. (it can be in some other manner)
I think in your case you better use
and this one: ACCOUNT_NAME
Which will give you the NAME of the owner of trading account. I think it provides the same level of protection as MQ login name.
Hope this helps.
TERMINAL_COMMUNITY_ACCOUNT is just a flag indicating that current terminal is logged in into some MQL5 account, but the information about this account is not available. You can't check from EA if terminal is connected to a predefined MQL5 account. The OP asked even more - to identify a situation when MQL5 account is already logged in from some other terminal and if so - prevent execution.
What you suggested next - to bind EA to a specific trader account - this is indeed one of commonly used protection scheme. But bear in mind that it limits the user significantly in the sense that the user may have many accounts, and the developer may want to provide the user with a single sign on. This is why he asked about MQL5 account to my undestanding (this could allow running the same EA on all user's accounts). And this all is impossible at the moment.