Source Code

 

Does it exist in MQL5 any Naming Convention or coding standards for source code ?

Any Link ?

 

Hi Javier,

I have not seen such, I have been looking for the same. 


I guess MQL coders are more concerned about making more money than standards and conventions. 


Post here if you find one.


Thanks.

 
-Javier-:

Does it exist in MQL5 any Naming Convention or coding standards for source code ?

Any Link ?

There is a de facto standard for style. In MetaEditor, go into Tools -> Styler.

(Personally, I do not like or use this style, but I acknowledge it's existence.)

Apart from that, I haven't seen a specific coding standard for naming conventions. I typically copy the naming conventions I find the the example code and documentation, which I suspect are pretty close to various C++ style guides.

 

I haven't seen any form article about that... The best you could do is to follow the naming conventions on the CODEBASE, searching for the indicators created by MetaQuotes. Just jump to the end page of it and select any indicator.

I personaly don't like the coding conventions they use. I use my own. I.e., I don't like the prefix "m_" for all properties/variables of a Class, for my view, it pollutes the code. I just use the prefix "_", since the MQL language do not use the keyword "self" or similar to refer to properties and methods of a class, making the code harder to read, since you will confuse properties and method with common variables and functions.

Another thing that I do not use to my coding is that polluted comment system with "+"'s  and "-" 's, I just use backslash. BUT, when I post code on the MQL Codebase I use the styler and a blueprint for indicators just to follow their rules of styling before publish.

And etc... Many programmers use Hungarian Notation, which I don't recall if it is a style accepted here... Probably not (I came from other Programming languages).

Since MQL5 is derived from C++ you can rely on its Coding Style rules:

https://gist.github.com/lefticus/10191322

;)

 
Minions Labs: BUT, when I post code on the MQL Codebase I use the styler and a blueprint for indicators just to follow their rules of styling before publish.

I used to do that, also. That is, until they got rid of the human intervention, so now I don't have to.

:-D

 
Thank you every body !!