How to detect the current license of a paid EA? - page 2

 
Stanislav Korotky:

Your code:

should work correctly for experts and indicators. It did not work for scripts and libraries in past, and I don't have an updated information.

Your attept to read license from a file (in else branch) violates the Market rules, not to mention it seems having a flaw (a user can craft a file).


Thank you. This was the type of an answer I expected.

There are two reasons the server response is saved to a file:

1. If a person has bought the expert, decides to use it in backtest, has downloaded the chart data, but has no internet connection at the moment.

In such a case, there can't be an answer from server about the current license of the expert - full, demo, etc. If the last valid server response is not stored somewhere on the local computer, I should provide a default hardcoded answer i.e. either to allow all features, or to restrict them to demo mode. The both options are not good -the first is a way to work round the protection, and the second can drive mad somebody, who bought the expert, but can't use its full features if there is no internet connection. Let me remind, that the main expert functionality is in tester mode, so there the restrictions should take place when it is in demo mode.


2.I am not sure(and I asked that in the opening post), if in tester mode the usage of  MQLInfoInteger(MQL_LICENSE_TYPE) works. If the concept of the Mql5 marketplace is that in tester mode all features of the EA should work fine, there is no need for this communication between expert and server in tester mode. So, I'll be glad to know if this is the case, or no matter if in real or tester mode MQLInfoInteger(MQL_LICENSE_TYPE) will bring an answer from the server. Because if not, except reading the last known answer from a file, only the hard coded approach mentioned above is available.

About user crafting the file which stores the license. The file is a binary one, and there is no way for the user to know what is saved in it, i.e. what data stands for demo or full. But now I get to the idea, that she/he may use someone other's file, and use the expert offline in tester mode. In such a  case, the number of the broker account may be written, along with the last server response.

Anyway, if this is prohibited(which I didn't know), then it seems that an internet connection is a must in order the expert to be used in full mode.

But once more, does MQLInfoInteger(MQL_LICENSE_TYPEwork in tester mode?

 

Yes it does work in tester mode.

Those restrictions are rare and have to be discussed on forehand.

They are possible for products that otherwise would have full operation even in demo mode.

It's specific.

 
I don't believe MQLInfoInteger(MQL_LICENSE_TYPE) reads the information from the server. License state is encoded inside EX4 file and can be read even if no internet connection
 
Vadim Larionov:
I don't believe MQLInfoInteger(MQL_LICENSE_TYPE) reads the information from the server. License state is encoded inside EX4 file and can be read even if no internet connection

Yes, I also think it's hardcoded in the file itself.

 

Well, it seems that in the posts here, I found the answers I searched for. At least for now.

Thanks guys, for the information, covering this specific case. It was helpful a lot!

Reason: