MetaTrader 4 Help
MetaTrader 4 HelpAuto TradingMQL4

MQL4

MetaQuotes Language 4 (MQL4) is the language for programming of trade strategies built in the client terminal. It allows to write custom expert advisors that automate trade processes and ideally suit for implementation of traders' own strategies. Moreover, traders' own custom indicators, scripts and DLL's can be created in MQL4.

Syntax of MQL4 is quite similar to that of C language. A large amount of functions necessary to analyze quotes, manage positions, call technical indicators, and others, are included in MQL4. The MetaEditor, an editor for expert advisors, is used for writing the source code of programs. The MetaQuotes Language Dictionary that contains descriptions of all language constructions and functions is built in the editor.

Programs written in MQL4 are different in tasks and properties:

  • Expert Advisor is a mechanical trading system (MTS) to be run when a new tick incomes. It can work not only in the mode alerts, but also perform trade operations independently. Terminal allows to test trading strategies on history data in order to detect the expert features under different market conditions;
  • Custom Indicator is a technical indicator written individually. Custom indicators are used only for analyzing of price changes;
  • Script is a program that is intended for a single execution of some actions. Unlike experts, scripts are launched not tick by tick, but on a command.