Documente Academic
Documente Profesional
Documente Cultură
The primary objective of MQL4 and MQL5 is automation of trading and First appeared 2005
facilitation of operational analysis. MQL4 and MQL5 comprises an Filename .ex4, .mq4, .mqh,
extensive codebase source code library used for developing trading robots. extensions .ex5, .mq5
Contents
1 History
2 Compiler
3 Differences between MQL4 and MQL5
4 Capabilities
5 The MQL4 and MQL5 Syntax and their Difference from ++
6 Data types
7 Operations and expressions
8 Criticism
9 References
10 Bibliography
11 External links
History
On July 1, 2005 MetaQuotes Software released MetaTrader 4 - a platform for trading on financial markets.[1] MQL4 -
an object-oriented programming language, was written specifically for work on this platform. Initially, its syntax was
based on C. Another platform, MetaTrader 5, was released in 2010 together with MQL5 - a new language created for
it.[2]
The release of MetaTrader 4 600 build in 2014 was a major update of the language.[3] That brought it to the level of the
more modern MQL5. The development environment MetaEditor became unified for both languages.
The updated MQL4 features new graphical objects and new functions borrowed from MQL5 and used for analyzing
charts. The protection system was completely modified for the executable files EX4. The MQL5 Standard library was
transferred almost entirely with the only exception of the trade subsystem, which required adaptation. New data types
were added and the micro substitution system expanded (conditional compiling #ifdef, #ifndef, #else, #endif),
allowing the use of code from other languages based on /C++. Structures, classes and object pointers were added as
well (it should be noted that object pointers in MQL4/MQL5 are not similar in every way to the ones in ++). The
updated MQL4 features the mode of strict compiling, which prevents a lot of potential programming errors. In MQL5
this mode is default and cannot be disabled.[4]
https://en.wikipedia.org/wiki/MetaQuotes_Language_MQL4/MQL5 1/4
1/11/2017 MetaQuotes Language MQL4/MQL5 - Wikipedia
Both languages support nearly all standards of object-oriented programming except multiple inheritance:
encapsulation and extensibility of types, inheritance, polymorphism, overload, virtual functions.
Compiler
To develop programs in MQL4 and MQL5, MetaEditor - a compiler embedded in the development environment - was
created. It is integrated in the MetaTrader 4/MetaTrader 5 trading terminals. MetaEditor allows convenient editing of
program source code, automatic generating projects by a template, profiling code and remotely developing joint
applications in conjunction with other people.
MQL5 comprises an expanded list of trading functions for work with open orders, a list of open positions, order
history and deal history. In MQL4, different functions such as OrderSend(), OrderClose(), OrderCloseBy(),
OrderModify(), OrderDelete() were initially incorporated for performing each trade operation. These functions can be
used to open/close and delete pending orders.
In MQL5 all trading operations are carried out by sending trade requests using only one function - OrderSend(). As a
parameter, the function gets passed a request either to place a pending order, or to open by the market, or to cancel a
previously placed order. Introducing the new function OrderSendAsync() to MQL5 enabled asynchronous trading
operations.
An important novelty in MQL5 is Depth of Market and a new event type of handling Depth of Market information.
Capabilities
MQL4/MQL5 aims to directly address traders' needs and requirements. It was developed for writing trading programs
and is used only for that purpose. Functions for performing trade operations OrderSend(), OrderClose(),
OrderCloseBy(), OrderModify(), OrderDelete() have been initially incorporated in the language and are used for
changing the state of a trading account.
Expert Advisors. Automatic systems trading by specified parameters and following a coded algorithm. Occurrence
of a previously specified event like receiving a new tick, an alert about a new trading operation or even pressing a
button or clicking a mouse, triggers the Expert Advisor to perform a programmed action.
Custom Indicators. Written by users, they are used along the ready-made indicators integrated in the terminals.
Their function is purely analytical. Indicators do not perform trading nor carry out operations that slow down the
interface stream such as sending emails or performing a random delay. The main task of indicators is to monitor a
situation, reflect and interpret it and then submit to a trader for analysis.
Scripts. A script is a program intended for a single execution of an action. The start event is the only event type
processed by the script.
Custom Function Libraries. In addition, there is an opportunity to create include files (#include). Include files allow
you to include most frequently used functions and classes without directly pasting their source code into its
program. Using functions and classes simplifies creating, debugging and compiling because when using dynamic
libraries, functions load only when they are called directly.
https://en.wikipedia.org/wiki/MetaQuotes_Language_MQL4/MQL5 2/4
1/11/2017 MetaQuotes Language MQL4/MQL5 - Wikipedia
Text formatting. Any number of space symbols such as spaces, tabs, empty strings can be used to make the
code more readable and convenient to work with. There are exceptions, however. A line break symbol must not
be used immediately after a hash and space symbols cannot be used inside constants, identifiers and key words.
Comments. As with the C/C++, MQL4/MQL5 comments can be both single-line and multi-line. A single-line
comment starts with the // symbols and ends with the new line character. Multi-line comments start with the /*
symbols and end with */ ones. They cannot be nested.
Identifiers. Identifiers are used as names for variables and functions. The length of an identifier cannot exceed
63 characters. The following characters can be used in writing an identifier: numbers 0-9, Latin upper and lower
case letters Z, recognized as different characters and the underscore character (_). A number can not be used as
the first character.
Data types
Main data types used in MQL4/MQL5:
Criticism
The major disadvantage of the languages of the MQL family is the impossibility of creating independent applications
as each language is attached to its corresponding platform (MetaTrader 4/MetaTrader 5), and the programs EX4/EX5
only work in them.
References
1. "MetaTrader 4 Official Release" (https://www.metaquotes.net/en/metatrader4/news/3433). MetaQuotes Software
Corp. July 1, 2005. Retrieved August 23, 2017.
https://en.wikipedia.org/wiki/MetaQuotes_Language_MQL4/MQL5 3/4
1/11/2017 MetaQuotes Language MQL4/MQL5 - Wikipedia
Bibliography
"MetaTrader - investicn platforma pre obchodovanie" (http://is.muni.cz/th/324627/fi_b_a2/thesis.pdf) (PDF).
Is.muni.cz. Retrieved 14 November 2014.
"Evaluating the Effectiveness and Sensitivity of Forex Trading Robots" (http://unitec.researchbank.ac.nz/bitstrea
m/handle/10652/1925/Yu%20Gu%20MComp.pdf?sequence=1&isAllowed=y) (PDF). Unitec.researchbank.ac.nz.
Retrieved 14 November 2014.
"Forex Analysis and Money Management : Interactive Qualifying Project" (http://www.wpi.edu/Pubs/E-project/Avai
lable/E-project-022912-001013/unrestricted/IQP_Final_Report.pdf) (PDF). Wpi.edu. Retrieved 14 November
2014.
"INVESTMENT AND TRADING : An Interactive Qualifying Project Report Submitted to the Faculty of
WORCESTER POLYTECHNIC INSTITUTE" (http://www.wpi.edu/Pubs/E-project/Available/E-project-031212-1800
59/unrestricted/Investment_and_Trading_IQP.pdf) (PDF). Wpi.edu. Retrieved 14 November 2014.
External links
"MQL4 documentation" (http://docs.mql4.com). Docs.mql4.com. Retrieved 14 November 2014.
"MQL5 documentation" (https://www.mql5.com/en/docs). Docs.mql5.com.
Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using
this site, you agree to the Terms of Use and Privacy Policy. Wikipedia is a registered trademark of the Wikimedia
Foundation, Inc., a non-profit organization.
https://en.wikipedia.org/wiki/MetaQuotes_Language_MQL4/MQL5 4/4