Don't limit the functionality of Market products based on the programme name or path.

 

To all users that seem to want to ask questions in private instead of the forum, please don't. Ask your questions in the forum, not in private. Reserve the private messages for truly private interactions only, not generalised questions about MetaTrader, MQL or other generalised queries.

Anyway, I recently received a question via private message, which should have been placed in the forum and not in private, and I have decided to post a redacted summary transcript here, because it may benefit others with similar queries.

Unnamed user:

Do you know what MQL_PROGRAM_NAME resolves to when uploading a program to the MQL5 Market tester for validation?

Me:

I have never tried it myself, but I would assume one of two possibilities for the name returned by the MQLInfo property “MQL_PROGRAM_NAME”:

  • Either it is the name of the executable file you upload for the validation test, …
  • … or it would be the exact name you give your Market product (as that is the name given to the executable file that is placed in “Market” folder in MetaTrader).

So, in my opinion, for the validation test, the first option seems to be the most probable answer.

Unnamed user:

I was hoping for a definite answer. I cant get it to pass for MT5. I have not tried adding the ex5 extension. The Title and name as it passes in 'normal' mode wont work.

Me:

It does not include the file extension.

However, if you are using it as a condition in your program, then know that it is probably a violation of the Market rules, as you are not allowed to place limitations on the product.

Unnamed user:

I am compiling/uploading as '[redacted name].ex5', then MQLInfoString(MQL_PROGRAM_NAME)==''[redacted name]"' which results false. I does work for MT4 and MT5 in any other condition, only for MT5 for MQL5 Market validation it does not.

Me:

It seems you did not understand my statement. I am stating, that you should not be placing such a condition in your code, as that would violate the Market rules.

This is because users are free to rename the file, or even move it to a different folder. I have done this myself on occasion, so your condition would invalidate the product if the user did this. So, your "program name" condition is violating the Market rules. You should remove that condition.

This concludes the summary transcript. Feel free to ask questions and discuss the subject.