-
Notifications
You must be signed in to change notification settings - Fork 16
DevelopmentStyle
Metatrader has been a great international success, putting into the hands of end-users the ability to do programmed trading, something that was only previously available to large trading houses. It has been widely adopted, provides a credible platform for Forex trading, and there are a huge number of "experts" and programs that have been developed for it.
However, Metatrader as a language is not without some significant drawbacks. The language is very rudimentary from the computer science point of view, and is a closed sole-source product. Very importantly for writing robust, well-tested and easily maintained code, it lacks proper error handling flow-of-control constructs, such as are found in Java, Python or Lisp. This leads to poor quality code, as can be seen by much of the MQL code in existence, including the code from the manufacturer, MetaQuotes. The poor nature of the language combines with the very poor coding practices of the community (e.g. not checking error codes and no documentation or testing) to create a very poor programming environment.
We prefix all variable, function and method names with a lowercase letter that indicates the type; it helps you anticipate what type a quantity is, and to make explicit type conversions. This is not a rigid requirement, but it helps cut down on a very common type of mistake, pun intended.
If the type changes, give it a new name with the initial letter changed. In Mql, this scheme has the added advantage of avoiding any naming conflict with Mql built-ins, or most Python standard library modules.
Choose the initial letter from the following list:
| Prefix Letter | Variable Type | |||
| a | array | |||
| b | boolean | |||
| c | complex (unused) | |||
| d | alist or dictionary | |||
| e | error string return value, empty for success | |||
| f | double | |||
| g | generic - unknown or mutable | |||
| h | hypertext - HTML/XML entity encoded string | |||
| i | integer | |||
| j | json string | |||
| l | list or tuple (unused) | |||
| o | instance or pointer to a class | |||
| r | series | |||
| s | ASCII string | |||
| t | date/time value | |||
| u | Unicode string | |||
| v | void - return value not to be used | |||
| z | non-empty string return - empty is a failure |
Parent: Home