MetaTrader 4 Programming Language, MetaEditor Overview
This lesson will cover the following
- Programming Language use
- The MetaEditor
Some traders, who still havent developed the discipline needed to draw emotions out of their trading sessions, find it much easier to create a tool that will automatically execute orders in accordance with predefined parameters. Thus, by using a mechanical trading system, a trader will rule out emotions from his trading results.
Additionally, other users have ideas of custom-made indicators that they think will suit their trading strategies better than the standard indicators incorporated in the MetaTrader 4 platform. The terminal allows you not only to import indicators designed by other users, but also to create such of your own. Both the automated mechanical systems, called expert advisors, and the custom indicators, as well as scripts, can be designed using the platforms built-in programming language, the MetaQuotes Language 4, in the MetaEditor feature, and can be tested using the MT4 Strategy Tester tool.
MQL 4 is MetaTrader 4s programming language used to create three types of tools.
– Expert advisors that automate the trading process. They are a mechanical trading system which runs each new tick. It can be set to either alert you, when action needs to be taken, or it can perform these actions automatically and independently. They can be programmed to execute the entire routine work of technical analysis for each security and time frame. Experts are created, or purchased, then set up with the desired parameters. Launching experts is done by adding them to the chart and they will begin executing with the next new tick, while removing it from the chart will shut it down.
As we have explained in the respective article, the Strategy Tester tool is used to test and optimize the features of expert advisors.
– Custom indicators are modified standard indicators or new indicators built from scratch. Each indicator can be modified by selecting the Modify context menu command after right-clicking on the indicator in the Navigator window.
– Scripts are programs that can be executed only once, on request. Unlike expert advisors, scripts are launched on a command, not tick by tick. DLLs can also be created.
The MQL 4 language contains a large amount of functions necessary to analyze quotes, manage positions, call technical indicators, and its syntax is similar to that of the C language. Using the MQL 4 languages design capabilities is executed in the MetaEditor, which contains descriptions of all language constructions and functions. Thus, everything related to the creation, modification and compilation of expert advisors, custom indicators, scripts and DLLs is done using the MetaEditor.
The MetaEditor can be brought up via the F4 button or by clicking the in the “Standard” toolbar. In case there isnt one, you can add it by customizing the Standard toolbar by executing the respective context menu command. Alternatively, you can launch the MetaEditor by clicking Tools >>> MetaQuotes Language Editor.
New MQL 4 programs creation is aided by the Expert Advisors Wizard within the MetaEditor. You can also use templates to write an MQL 4 program. Having started to write the program, the user can find a full description of the language in the MQL 4 Dictionary. After the program has been written, it needs to be compiled in the MetaEditor. Once it has been compiled, it can be launched, tested and optimized in the terminals Strategy Tester feature.