MetaQuotes Language 4 (MQL4) is a new built-in language for programming of trading
strategies. This language allows to create your own Expert Advisors that make
trading management automated and are perfectly suitable for implementing of one's
own trade strategies. Besides, one can use MQL4 for creation of one's own Custom
Indicators, Scripts, and Libraries.
A large amount of functions necessary for analysis of the current and
previously income quotes, as well as basic arithmetic and logic operations are included in MQL4
structure. There are also basic indicators built in and commands of order
placement and control.
The MetaEditor 4 (text editor) that highlights different constructions of MQL4
language is used for writing the program code. It helps users to orientate themselves in
the expert system text quite easily. We use MetaQuotes Language Dictionary as a Help System for MQL4 language.
An abridged guide contains functions divided into categories, operations, reserved words, and other language
constructions and allows finding the description of every element we use.
Programs written in MetaQuotes Language 4 have different features and purposes:
Expert Advisor is a mechanical trading system (MTS) linked up to a certain chart.
An Advisor starts to run with every incoming tick for a given symbol. The Advisor will not be launched for a new,
tick if it is processing the previous one at this moment (i.e., the Advisor has not completed its operation yet).
The Advisor can both inform you about a possibility to trade and trade at an account automatically sending orders
directly to the trade server. Like most trading systems, the terminal supports testing strategies on history data
with displaying trading in-and-out points in the chart.
Experts are stored in terminal_directory\experts.
Custom Indicator is a technical indicator written independently in addition to those
already integrated into the client terminal. Like built-in indicators, they cannot trade automatically
and are intended for implementing of analytical functions only.
Custom Indicators are stored in terminal_directory\experts\indicators.
Script is a program intended for a single execution of some actions. Unlike
Expert Advisors, Scripts are not run tickwise, but on request.
Scripts are stored in terminal_dictionary\experts\scripts.
Library is a set of custom functions containing programs most frequently used. Libraries cannot start execution by itself.
Libraries are recommended to be stored in terminal_directory\experts\libraries.
Included file is a source text of the most frequently used blocks of custom programs.
Such files can be included into the source texts of experts, scripts, custom indicators, and libraries at the compiling stage.
The use of included files is more preferable than the use of libraries because of additional burden occurring
at calling library functions.
Included files are recommended to be stored in terminal_directory\experts\include