The development of MetaTrader 5 started in 2007. MetaTrader 5 was conceived as a revolutionary, multi-market platform that can run on Forex, as well as on any other financial market. A lot of work has been done since then, and the result of this work is the platform that provides unlimited opportunities to traders. In this article we will talk about all the key features of MetaTrader 5 and carry out a comparative analysis with the previous version of the trading platform.
We will start with one of the obvious advantages of the MetaTrader 5 platform – its analytical part. Real-time price charts provide a much wider functionality as compared to MetaTrader 4.
1.1. Customization and 21 Timeframes
Charts in the platform have a variety of different settings, so that traders can customize them and adapt to their personal needs. MetaTrader 5 supports three types of charts: a broken line, a sequence of bars and Japanese Candlesticks. You can set a separate color to any item in the chart to create the most comfortable workspace for long-term work. In comparison with the 4th version of the platform, MetaTrader 5 supports more that twice as many chart periods. Now 21 timeframes are available.
1.2. Advantage of 1-Minute Bars
MetaTrader 5 offers an entirely new principle of storing and passing price data. In previous version, data on different timeframes were transmitted to the terminals separately. Now the data is transmitted and stored only in the form of 1-minute bars, while higher timeframes are built based on them in client terminals. This approach allows to substantially save traffic, because the history is downloaded only once and applies to all periods. After downloading the price history, the terminal will only download new data.
Now opening of charts is much faster: constructing a chart of any timeframe out of one-minute bars takes a few seconds. Built timeframes are cached on your hard disk. Thus, the next time the chart with this period will be opened immediately, only new data will be additionally calculated.
Working with the one-minute history also provides full synchronization (matching) of data on all timeframes, since they all use the same one-minute data as a source.
Another advantage of working with the price history is that it is transmitted to client terminals in a compressed format, which saves bandwidth and reduces the download time. For comparison, a 10-year price history of one-minute bars for one symbol is about 10 MB in a compressed form.
The standard MetaTrader 5 delivery pack includes 38 technical indicators. They are conveniently grouped in the Navigator window based on their type: Trend Indicators, Oscillators, Volume Indicators, and Bill Williams’ Indicators. Available indicators include Bollinger Bands, Envelopes, Moving Average, Parabolic SAR, Standard Deviation, Ichimoku Kinko Hyo, MACD, Bulls Power, Bears Power, Alligator, Awesome Oscillator, and many others.
1.4. Analytical Tools
The list of available analytical tools has been greatly expanded. Now MetaTrader 5 offers 46 objects, including Elliott, Fibonacci and Gann tools, graphical objects (including objects for interactivity with MQL5 programs), shapes, channels, lines, etc.
Each object has its individual settings – color, line width, additional levels, as well as display on different timeframes.
1.5. Precise Time Scale
The precise time scale can be enabled for charts – now graphical objects are not necessarily linked to bars. Object anchors can be placed in any position between the chart bars. Moreover, when switching between timeframes, the accurate positioning of the control points of the object is preserved.
1.6. Economic Calendar
One of the new features of MetaTrader 5 is the Economic Calendar, which allows to perform the fundamental analysis of the markets. Macroeconomic indicators are updated in real time. In addition, the economic calendar events can be easily displayed on the price chart.
1.7. More Market Data
In the fourth version, only five values are available for each symbol in real time – Bid, Ask, High, Low and Time. In MetaTrader 5 the amount of information available has increased several times. In addition to the main symbol statistics, you can analyze the real volume and the price of the last deal. Moreover, in the Market Watch tab over 20 statistical values can be available for each symbol, and all of them are updated in real time:
An important feature is the availability of real spread and volume values in historical data. These values are stored in each 1-minute bar, and thus can be used for testing and optimization of Expert Advisor in the multicurrency strategy tester of MetaTrader 5.
1.8. Publishing Charts Online
The ability to publish the charts online has been introduced to MetaTrader 5. Now the terminal allows you not only to save screenshots on your local PC but also to share them with other traders instantly via special MQL5 Charts service, which is part of MQL5.community. If you have specified your MQL5.community account in the terminal, a screenshot will be assigned to it. Now you can create your own image gallery and manage it easily via your profile.
You can also share your images via the most popular social networking websites.
The interface of the MetaTrader 5 terminal is now even more convenient. The Navigator window allows you to manage many operations in the terminal, like opening a new demo account or attaching Expert Advisors, indicators and scripts to charts.
2.1. Find a Server by the Broker’s Name
Another convenient new feature of MetaTrader 5 is adding brokers’ servers by their names. With the previous version, you had to contact your broker to find out the IP address of the trade server or download a special client terminal. Now you simply enter the name of the broker. The system automatically finds the server at the specified name and adds it to the list:
Then you can open an account.
2.2. Grouping of Programs
Another convenience of the Navigator is grouping of programs. The technical indicators available in the standard delivery pack are grouped based on their type: Trend Indicators, Oscillators, Volume Indicators, and Bill Williams’ Indicators. Custom Indicators, Expert Advisors and scripts are also grouped into separate branches. Moreover, a hierarchy similar to the folder structure on a disk is supported within the branches. For example, you can arrange your custom indicators into subfolders /MQL5/Indicators/My, /MQL5/Indicators/CodeBase, etc. You’ll see the same storage structure in the Navigator window.
MQL5 programs purchased through the Market are automatically placed in the appropriate subcategory Market in Expert Advisors, Custom Indicators and Scripts.
2.3. Further Development of Programs
If you need to modify an application (in case its source code is available), select it and press Enter. The source code of the application will be immediately opened in the MetaEditor.
2.4. Downloads from the Code Base
Through the tight integration of the MetaTrader 5 trading terminal with the MQL5.community services, right from the Navigator you can start downloading an Expert Advisor, an indicator or a script from the Code Base in just one click. A special command “more” is available in each category of applications. The figure in the command indicates the number of applications available for download:
In MetaTrader 5, trading mechanisms have undergone significant changes as compared to MetaTrader 4. All these changes are aimed at enhancing the use of the trading platform. With MetaTrader 5 you can trade on any stock exchanges and through any ECN. The MetaTrader 5 platform has already received the status of an independent software vendor (ISV) for a number of stock exchanges, including SMX, GBOT, CitiBank, Currenex, DGCX, Integral, etc. Further plans are aimed at integration with the major stock exchanges around the world.
3.1. Net Positions
The so-called “netted” accounting of positions is adopted in the MetaTrader 5, which meets the requirements of all modern exchanges. The meaning of netting is that for one financial instrument only one position can exist at any given time. Differently directed positions (buy and sell) are not allowed.
Thus, if you have a position to buy 1 lot of a financial instrument and sell one lot of this instrument, the position will be closed. If you have a position to buy 1 lot of a financial instrument and buy one more lot, you will have one position of 2 lots. In this case the open price is re-calculated – a weighted average open price is calculated for the position: (Price of the 1st deal*Volume of the 1st deal + Price of the 2nd deal*Volume of the 2nd deal)/(Volume of the 1st deal + Volume of the 2nd deal).
3.2. Six Types of Pending Orders
In addition to the market, limit and stop orders, the MetaTrader 5 platform supports two more types of pending orders – Buy Stop Limit and Sell Stop Limit. When such an order triggers, the appropriate type of the limit order is placed. New types of orders enhance the possibilities of implementing trading strategies.
3.3. One-Click Trading
The speed of conducting trade operations is very important in trading. MetaTrader 5 provides the possibility of instant trading in just one click. This feature is available in the Market Watch window:
3.4. Modification of Trade Levels on the Chart
MetaTrader 5 provides the opportunity to change the price of pending orders, as well as of Stop Loss and Take Profit orders directly on the chart. Now, seeing the current situation in the market, you can easily drag a trade level using your mouse in the desired area and then adjust its value more precisely:
3.5. Asynchrony and Multithreading
As compared with MetaTrader 4, in the fifth version of the platform traders have more opportunities to implement multiple trading operations at a time. With the previous version, traders could have the error “Trade context is busy”, for example, when trading using multiple Expert Advisors simultaneously. In MetaTrader 5 the trade context is wider allowing to send up to 16 trade requests to the server without waiting for the result of their processing.
3.6. Execution of Operations on the Stock Exchange
Through the integration of the MetaTrader 5 trading platform with other systems, now traders can access the leading exchanges around the world. The system allows the direct execution of trade operations in external trading systems (Straight Through Processing). Trade operations are executed without an intermediary broker (in the Non-Dealing Desk mode).
3.7. Trading from the Depth of Market
An integral part of stock trading is the Depth of Market (DOM). In the DOM a trader can see the current requests that are really present in the market, as well as see his or her own trade requests. In MetaTrader 5, trade operations can be executed right from the Depth of Market:
3.8. Additional Execution Terms
For each trading operation, a trader can specify additional terms of execution by the broker – Fill or Kill (FOK), or Immediate or Cancel (IOC). In the FOK mode the requested operation should be performed in the specified volume. If the volume of the security is not available in the market, the request should not be processed. The IOC mode implies that the trading operation can be performed for the maximum volume available in the market within the volume specified in the order. If the request cannot be filled completely, an order with the available volume will be executed, and the remaining volume will be canceled.
3.9. Push Notifications
Currently, mobile trading is becoming more and more popular. Traders often need to have access to their accounts 24 hours a day, 7 days a week, from anywhere in the world. The mobile part of the MetaTrader 5 trading platform is in step with the times. The MetaTrader 5 mobile terminals for iPhone and Android are available to traders absolutely free of charge.
One of the most important functions of the mobile terminals is the option of receiving push notification. Push notifications are short text messages that can be sent to mobile devices from the PC version of the client terminal, and from various services of the MQL5.community. Such notifications are never lost, and arrive immediately, regardless of whether the application is running or not.
The MQL5 language provides a special SendNotification function, which allows MQL5 programs to send push notifications. Also the terminal allows you to create signals for alerting you of events in the market. One of the event notification types is push notifications.
Push notifications can also be used to obtain information about the updates on the MQL5.community site. To do this, specify your ID in the user profile in “Contacts” tab.
Push notifications allow traders to always stay informed and react to market changes, even when away from the computer.
The Toolbox window, which was available in the fourth version of the terminal, now provides even more functions.
Now the trader can see the summary information about the state of assets for all open positions.
As already mentioned in section 1, MetaTrader 5 now has the calendar of economic events. Macroeconomic indicators are available for more than 10 leading economies of the world, and are updated in real time. All events can be displayed on the charts of the appropriate currency pairs.
MetaTrader 5 is tightly integrated with the MQL5.community services for traders. Market is a store of MQL5 applications, where anyone can buy a product to use in the terminal. For your convenience, the Market service is integrated into the client terminal.
In the Toolbox window, the trader can see the entire range of applications available in the Market. Before purchasing you can download a trial version and test it in the strategy tester. In addition, many free applications can be downloaded from the Market.
The list of purchases and downloads is conveniently represented in the Purchases tab. The downloaded/purchased applications are automatically sorted by their type in the Navigator, from which you can run them.
4.4. Code Base
The Toolbox window also provides access to the huge base of free MQL5 source codes. Directly from the terminal, you can download any code. If this is an Expert Advisor, an indicator or a script, this code will be automatically placed in the appropriate folder and compiled. After that, you will be offered to immediately run the application.
Number of published source codes is gradually approaching 1000 and will continue to grow.
5. Testing and Optimization
One of the most important and expected updates in MetaTrader 5 is the multicurrency strategy tester. Now, traders have unlimited possibilities for testing and optimizing the Expert Advisors that trade several symbols.
5.1. Advanced Testing Report
MetaTrader 5 provides an expanded report on the EA testing results. It includes additional statistics, allowing to better evaluate a trading strategy. Now you can analyze the recovery factor, the Sharpe ratio, position holding time and many other characteristics. Over 40 characteristics are available in the tester report.
The graphical component of the testing report has also expanded considerably. In addition to balance and equity graphs, the tester visualizes the time distribution of position entering and profit/loss (hourly, weekly and monthly):
In addition, it generates graphs of distribution of profits and MAE/MFE, as well as distribution of profits and position holding time.
5.2. Increased Accuracy of Every-Tick Testing
The Strategy Tester of the MetaTrader 5 terminal uses only one price simulation mode in testing – the generation of ticks on the basis of the available one-minute data. Using the M1 timeframe in the tester allows for a very accurate simulation of the price movement with a minimum number of errors, in contrast to the simulation of ticks based on higher timeframes in MetaTrader 4. As a result, the errors in the modeling of prices in the MetaTrader 5 strategy tester are trivial, and the differences between the simulated price and the real price can only be within the scale of a one-minute bar.
5.3. More Testing Modes
MetaTrader 5 has four modes of testing: Every Tick (the most accurate method), 1 minute OHLC (testing on the bar support points), Open Price Only (a rough method for rapid testing), Mathematical Calculations (for mathematical computations in the strategy tester without the use of historical data and generation of ticks).
5.4. Custom Optimization Criterion
In MetaTrader 4 the trader was able to optimize an Expert Advisor by one of the five available criteria. In the fifth version, one more standard criterion is available (the product of the balance and the Sharpe ratio). However, the main new feature is the possibility to use a custom optimization criterion. By selecting the Custom max value in the tester settings, you can optimize your Expert Advisor by the maximum value returned by OnTester().
5.5. Optimization Cache and XML Report
The testing results are stored by the terminal into a special cache of results (which is an XML file), for a quick access to them when they are needed. During a test or an optimization, for each set of input parameters the terminal searches the result cache for already available results from the previous runs, in order to avoid re-runs. If the result with such a set of parameters is not found, the agent is given the task to run the testing.
Since the optimization result cache is a standard XML file, you can analyze it in external applications (e.g. MS Excel).
5.6. Automatic Download of History and Synchronization of Timeframes
The MetaTrader 5 Strategy Tester provides the availability of all the necessary historical data. Before testing, it downloads all the available historical data for the required symbol. This is done only before the first run. Further only the new data are loaded. If during testing an Expert Advisor (a multi-currency one) requests data for other symbols, they are also automatically loaded from the trade server.
5.7. Forward Testing
MetaTrader 5 offers the new forward testing mode. Forward testing is a re-run of the best optimization results on a different time period. This feature allows you to avoid parameters fitting in certain areas of historical data.
5.8. Stress Testing
To make the EA testing conditions close to real, use the Random Delay mode in MetaTrader 5. From the moment of request sending till its execution the price can change. Depending on the deviation set in the order it can be executed at the current price (if it is within the deviation) or a requote can be sent. Testing in this mode allows you to correctly code processing of such situations.
5.9. Multi-threaded Optimization
The Strategy Tester is multi-threaded and allows to use all available computer resources. Testing and optimization are carried out using special computing agents that are installed as services on the user’s computer (one agent on each core). Agents work independently and allow parallel processing of optimization passes.
5.10. Testing Clouds of Remote Agents
You can connect an unlimited number of remote agents, i.e. the agents installed on other computers, to your strategy tester. Use the special application MetaTester to install testing agents on each test computer in your local network, and then connect them to the strategy tester in one client terminal. The agents will receive computation tasks over the network and return the results to the client terminal. Thus, you can significantly expand the capabilities of parallel computing, and several times accelerate the optimization process.
5.11. MQL5 Cloud Network
The MQL5 Cloud Network allows organizing the exchange of computing resources between those who need them, and those who can provide idle CPU time of their computers. With the MQL5 Cloud Network a trader can use the computing power of thousands of agents around the world. Optimization, which would take several years if using only one computer, can now be run in a few hours.
To use the network, just open the strategy tester and enable the use of cloud agents.
In addition to using the MQL5 Cloud Network, you can provide your CPU computing power in the network and earn money. To do this, you do not even need to install the MetaTrader 5 client terminal. Download the specially created installer that allows you to quickly and easily install MetaTester, an application for managing remote agents on the computer. After a simple setup you join the MQL5 Cloud Network and start earning. Statistics on the use of the network and your earnings for the CPU power provided is conveniently collected in your profile on the MQL5.community website. Information about agents will appear in your profile immediately after they fulfill their first task.
5.12. Ease of Agents Management
You can easily manage testing agents via the context menu. In a couple of clicks you can enable/disable any types of agents: local, remote or MQL5 Cloud Network. Also here you can control connected remote agents, as well as import and export configurations of agents.
5.13. Mathematical Calculations
The features of the strategy tester combined with the possibilities of the MQL5 Cloud Network are not limited to testing and optimization of Expert Advisors. The “Mathematical calculations” testing mode allows you to perform any calculations. In this mode, the strategy tester does not load or use the price history and information about the symbols, but simply performs calculations, calling the OnInit(), OnTester() and OnDeinit() functions. Mathematical computations are useful for calculating an extremum of a mathematical function, whose value should be returned from OnTester(). Optimization is conducted for finding the maximum value of the function.
5.14. 2D and 3D Visualization of Optimization Results
Better to see once than hear a hundred times. In the strategy tester you can analyze optimization results in visual mode. Here is the two-dimensional visualization of the optimization. The darker the shade of green is, the higher is the value of optimization criterion:
Below is a three-dimensional mode of visualization of mathematical calculations in the strategy tester. The picture shows the search for the maximum of the function f(x,y)=MathSin(x^2+y^2)+k*MathExp(-p*x^2-p*y^2):
5.15. Visual Testing
The visual testing mode allows to visualize exactly how the Expert Advisor performs trade operations during testing on historical data. The visualizer was available in MetaTrader 4, but in the fifth version of the terminal its functionality has been greatly expanded. First, the visualizer was available only separately from the terminal. Now it runs as a separate process. Trade operations are not only displayed on the chart of the symbol tested. In separate tabs you can follow the current account balance, open positions and current orders, the history of trade operations, as well as a detailed log.
5.16. Any Custom Results during Optimization. Each time you start an Expert Advisor in the strategy tester, you can create your own data array. This data set can be saved using the FrameAdd() function in a special structure called a frame. During the optimization of an Expert Advisor, each agent can send a series of frames to the terminal. All the received frames are written in the file *.MQD in the folder terminal_directory/MQL5/Files/Tester named as the Expert Advisor. They are written in the order they are received from the agents. Receipt of a frame in the client terminal from a testing agent generates the TesterPass event that can be handled using the OnTesterPass() function. This allows to dynamically process the results of optimization without having to wait for its completion.
6. Integration with MQL5.community
The MetaTrader 5 client terminal is tightly integrated into the MQL5.community. The MQL5.community provides unique services to traders and developers:
Right from the terminal you can purchase any ready-made application in the store of MQL5 programs. Before purchasing you can download a trial version and test it in the strategy tester.
Anyone can become a seller in the Market service. You only need to submit an application. After the registration of your Seller status is approved, you can sell your products and earn money.
6.2. MQL5 Cloud Network
The powerful distributed computing network is available for testing and optimization of your Expert Advisors in the strategy tester. Thousands of optimization sessions can now be performed in a few minutes. In addition to using the network, you can provide your own computing capacities and earn.
6.3. MQL5 Storage
The MQL5 Storage is a personal storage of source codes integrated into the MetaEditor. It allows you to keep your code safe and access it from anywhere in the world. The MQL5 Storage stores the entire history of changes to the uploaded files, which can be viewed at any time. In addition, you can revert to any previous versions of a file.
6.4. Code Base
With one click, you can download any code published in the Code Base section of the MQL5.community site. The code is automatically placed in the correct directory and compiled. You should just run the application from the Navigator window.
The Signals service allows users to subscribe to trading signals from professional traders, get them directly in their client terminal and execute trade operations based on them. The service is under development now.
Various useful articles on the MQL5 programming language and the platform have been published on the website of the MQL5.community. Find the required article in the convenient list of subjects and descriptions that is available in a separate tab of the Toolbox window right in the MetaEditor.
6.7. MQL5 Charts
MetaTrader 5 allows traders to publish their screenshots online via MQL5 Charts service. Your screenshot can be automatically published online right after you have made it. You will also get the link to share your image via one of the most popular social networking websites.
If you have specified your MQL5.community account in the terminal, a screenshot will be assigned to it. This will allow you to create your own image galleries and manage them via your profile easily.
7. MetaEditor 5
The built-in programming language has always been one of the most important parts of the MetaTrader trading platform. Application development is not just the MQL5 programming language, whose undoubted advantages will be proved below, but this is also the editor in which you work with the source code. MetaEditor 5 provides a lot of new features that were unavailable from the MetaTrader 4 users.
7.1. The new file system
As in the previous version, MetaEditor can only work within its own file system sandbox – the /MQL5 folder that is inside the data folder of the terminal. For better convenience, each type of source files has its own directory (Experts, Indicators, Scripts, Include, etc.). The structure of folders and files that store executable programs (Expert Advisors, indicators and scripts) is displayed in the Navigator window of the client terminal.
7.2. The MQL5 Wizard
MetaEditor 4 includes a Wizard for creating Expert Advisors allowing to generate templates for developing various applications. In the fifth version of MetaEditor this component has been significantly redesigned. Its new name is the MQL5 Wizard. It still allows you to create templates of programs that are already properly designed and contain the necessary event handlers. However, the main new feature is the possibility to generate ready-to-use Expert Advisors. The trader must choose which signals the Expert Advisor will use, its money management strategy and the way it will be protected from losses (type of trailing stop).
Now the trader does not necessarily need to know how to program in MQL5, to get a ready-to-use Expert Advisor. An EA is generated in a few easy steps. Then you can start optimizing your Expert Advisor in the strategy tester.
7.3. MQL5 Storage
The MQL5 Storage is a personal MQL5 source codes storage designed for the versioned storing of files and project management directly from MetaEditor in a handy manner.
The source code is stored in a secure remote repository, which can be accessed through your MQL5.community account. In case of hard disk failure, your local copy of codes can be quickly restored from the storage.
You can access your storage from any computer. Just log in using your MQL5.community account in MetaEditor. You work with the storage using the convenient context menu of the Navigator window.
Each transaction of changes in the storage is logged. Later you can view the entire history of changes, compare versions of files using a special tool, as well as revert to any previous version.
The options of the MQL5 Storage will continue to expand. It will enable joint work with projects using the storage by giving permissions to the required MQL5.community accounts.
7.4. Fast Compilation of C++ DLL
Many developers use third-party DLLs when developing applications in MQL5. With MetaEditor 5 you do not need to use MS Visual Studio for compiling DLL. The editor supports standard cpp and h-files and compiles them as easily as the MQL5 source code. If MS Visual Studio is installed on your computer, its compiler is used. Otherwise, the required files are sent to a special compilation server via a secure connection. After compilation the ready DLL file is sent back to you.
Like with the MQL5 source code, all compilation results, including errors and warnings, appear in the Error tab of the Toolbox window.
7.5. Intelligent Code Control
MetaEditor 5 provides various tools that allow you to speed up the process of code writing, make navigation easier and help prevent errors:
Snippets. For ease of writing code, MetaEditor provides the possibility to insert snippets – small template fragments of source code describing a particular construction of the MQL5 language. Insertion of a snippet is initialized by typing the keyword.
Autosubstitution of function names. It is the possibility to view the variants of names of built-in and custom functions, constants, variables, class members, keywords, etc. to insert when writing a code. The variants of names are determined by the first characters typed.
Tips on the function parameters. With this feature the developer does not need to read the documentation of every function when writing a code. When describing a function, just press a certain key combination and the MetaEditor will display a hint with the function parameters and types of these parameters.
List of functions. In the MetaEditor you can view the list of all functions declared in the current file and quickly move to any of them.
7.6. Code Styler
A beautiful and correct design of the source code makes work with such a code much easier. A carefully formatted code looks professional. MetaEditor provides the styler function. Any code can be transformed into a well-designed one by a single click. The formatting rules used in the styler have been developed by professional programmers with years of experience.
7.7. Code Highlighting
Compared to version 4, MetaEditor 5 provides wider opportunities of highlighting different elements of the source code (keywords, function names, variables, etc.). Each user can create an individual code highlighting.
7.8. Support for Unicode
The previous version of the editor does not support source code files in Unicode. This causes problems when viewing and compiling files that contain characters, which are not supported in the current locale of the operating system. In MetaEditor 5, this problem is completely solved. Any source file can be saved in the Unicode format using the standard editor features, and then you can work with it and compile it with any language of your operating system.
7.9. Inserting Resources
The MetaEditor 5 focuses on the maximum ease of the programming process. The routine operation of inserting the resource file into the program is performed with a single command:
7.10. Global Search and Integration with MQL5.community
When developing a program, you often need to access a variety of information. MetaEditor solves this problem by integrating with MQL5.community. Articles and source codes published on mql5.com are conveniently tabbed in the Toolbox window. However, for a really effective use of available information, a Search system is require.
MetaEditor 5 includes the global search system:
You type your request in the single search box, choose where to search and get results in a separate tab of the Toolbox. In addition to search separately in the current document, files, articles or Code Base, you can search on the entire MQL5.community site. It includes Forum, Articles, Documentation and Code Base.
Without exaggeration, everyone who used the MetaEditor 4 wanted the debugging function. The appearance of the debugger in the fifth version has raised the development of MQL5 applications to a new level. All standard functions are available for debugging applications:
Breakpoints. Place breakpoints in the source code lines, where the process of program execution must be interrupted to study the behavior of the program.
Watching Expressions. Follow the values of any expressions during debugging in a separate tab of the Toolbox.
Stack of Calls. Watch the stack of calls during debugging.
Step-By-Step Debugging. Use the commands of the step-by-step debugging – Step Into, Step Over and Step Out.
One of the many planned features in the MetaEditor 5 is project management. This will facilitate the work by structuring the developer’s programs.
7.13. Code Profiling
Debugging in MetaTrader 5 has greatly simplified the work of programmers. But MetaEditor 5 has another powerful tool for source code optimization. Code profiler detects all application bottlenecks.
Code profiler analyzes execution speed of the application’s individual source code fragments. Analysis results are submitted to a programmer both by individual functions and lines. Thus, it is now possible to find the slowest parts of the code and optimize MQL5 program operation.
8. The MQL5 Programming Language
8.1. Increased Speed
Compared with the MQL4, the speed of execution of the MQL5 code has increased 4-20 times! The speed of execution has almost reached the level of the C++ language, so in MQL5 you do not need to use third-party DLL to speed up calculations. In turn, the lack of DLL improves application security.
8.2. Code Protection
With the MetaTrader 5 you can enjoy a new high level of protection of executable files of MQL5 programs (ex5). Protection against decompilation has increased due to the following factors: new, more complicated encryption algorithms, file integrity checking (checking that the file has not been changed after compilation), the greater complexity of the language. Programs that are sold through the Market service are additionally encrypted and bound to the user’s hardware (computer configuration), which further protects them.
8.3. Similarity to C++
The syntax of the MQL5 language is very similar to one of the most popular programming languages C++. Therefore it is easy to learn, and you can easily translate programs from other modern programming languages into MQL5. MQL5 is object-oriented and allows you to take advantage of this programming approach – encapsulation and extensibility of types, inheritance, polymorphism, overloading and virtual functions.
8.4. Classes and Structures
MQL5 supports complex or abstract data types – structures and classes. They are used to describe not only the object, but also the model of behavior. The fact that the object is responsible for its own behavior greatly simplifies the task of programming for users of this object.
The MQL5 language provides processing of a number of predefined Events. Only three events were available in MQL4, while in the fifth version 13 types of events can be handled, including the events of application initialization and deinitialization, the receipt of a new tick, change of price data and depth of market, timer events, trade events, events of testing, optimization and actions with charts.
8.6. Management of Charts, Objects And Resources Directly from MQL5
Directly from the MQL5 applications you can manage all the chart properties, add, modify and delete objects from the chart. When combined with the possibility to handle events of interaction of a user and a chart, you can create graphic panels of any complexity.
In addition to working with built-in objects, you can use your own graphics and sound resources.
8.7. New Indicator Drawing Styles
In MetaTrader 5, the number of drawing styles of indicators has increased from 6 to 18. You can draw lines, histograms, symbols, filled areas, candlesticks, arrows, etc. Here is the indicator with the filled area between the two lines, drawn in the chart subwindow:
8.8. Ease of Work with Indicators
In MQL4, the direction of indexing in indicator buffers is permanent – from the most recent (0) to the oldest data. This approach is acceptable when working with indicators and scripts. However, when developing indicators, such indexing is inconvenient, since with each new bar the indexing of all elements is shifted by one, and a new element with the 0 index is added at the beginning of the array. In MQL5 the problem has been solved by adding the ArraySetAsSeries function, which allows you to change the direction of array indexing.
In MQL5 the number of indicator buffers used is unlimited, whereas in MQL4 you can use no more than 8 buffers.
Also in MQL5 you can develop indicators, which are based on the values of other indicators. In the fourth version of the platform, an indicator could be built based on another indicator only through a special option in the interface of the client terminal. In MQL5 you can pass to an indicator any handle of another indicator as the input data array price.
8.9. A Huge Standard Library and a Lot of Examples
The standard delivery of MetaTrader 5 includes a large Standard Library written in MQL5. It makes program development easier, providing easy access to the MQL5 functions. The standard library contains classes for organizing data, working with files, strings, graphical objects, charts, indicators and trade classes.
Also MetaTrader 5 includes many examples of the source code of all types of applications – Expert Advisors, indicators and scripts.
8.10. OpenCL Support
MQL5 has native support for OpenCL. To use all of its benefits you do not need third-party libraries. Simply use specialized MQL5 functions. The OpenCL language is used for performing computations on video cards that support OpenCL 1.1 or higher. Modern video cards contain hundreds of small specialized processors that can simultaneously perform simple mathematical operations with incoming data streams. The OpenCL language organizes parallel computing and provides greater speed for a certain class of tasks.
9. Services for Traders and Developers
An integral part of the MetaTrader 5 trading platform is the MQL5.community. In addition to the site where traders and developers can find useful information and discuss issues related to MetaTrader 5, MQL5.community provides participants with a variety of unique services.
The MQL5.community has its own secure payment system, which is used in all the community services. You can deposit money to your account via WebMoney and PayPal, as well as using a credit or a debit card. Withdrawals can be made to a WebMoney or a PayPal account. All transfers are made through a secure encrypted SSL connection.
9.1. Jobs. The Jobs service is useful for both traders and programmers
If a trader needs to implement any trade idea, but does not know how to program in MQL5, he can always contact a professional developer. On the other hand, the developers have an excellent opportunity to capitalize on their knowledge.
The Job service has a user-friendly interface, allowing you to place a public order and choose the most advantageous offer from the programmer, or publish an order for a specific developer. The process of executing the order is divided into several steps that include confirmation to help avoid misunderstandings and disagreements between the customer and the developer.
In the event of a dispute, you can apply to arbitration, which is conducted by MetaQuotes Software Corp.
The service was launched two years ago, and about 1,300 jobs have been fulfilled since then.
The Market service is an open secure site for buying and selling MQL5 applications. The Market is available online at the MQL5.community site and can also be accessed directly from the client terminal. All the applications that are offered for sale are additionally protected. When downloading, the application is encrypted and bound to the configuration of your computer.
9.3. MQL5 Storage
The MQL5 Storage of the source code is designed for the versioned storing of files and project management directly from MetaEditor in a handy manner. With the MQL5 Storage you can access your source code from any computer using an MQL5.community account. If you are working on different computers, with the storage you can easily synchronize the source codes and always work with their latest version.
9.4. MQL5 Cloud Network
The MQL5 Cloud Network allows organizing the exchange of computing resources between those who need them, and those who can provide idle CPU time of their computers. With the MQL5 Cloud Network a trader can use the computing power of thousands of computers around the world. Optimization, which would take several years if using only one computer, can now be run in a few hours.
The Signals service allows users to subscribe to trading signals from professional traders, get them directly in their client terminal and execute trade operations based on them. In addition, this service provides a convenient system for monitoring trading accounts with detailed statistics:
In this article we have tried to list all the key features of the MetaTrader 5 client terminal. Of course, its functionality is even wider. MetaTrader 5 provides a full range of tools necessary for successful trading in financial markets. It should also be noted that the development of the trading platform continues and its opportunities keep expanding. We keep up to date and follow the development of the industry.