Get Trial

MetaTrader 4 Trading Terminal build 600 with Updated MQL4 Language and Market of Applications Released

MetaQuotes Software Corp.

3 February 2014

Over the past 7 months since the release of the public build 509, we put in a lot of effort to improve MetaTrader 4 client terminal. MQL4 programming language for developing trading strategies has undergone the most significant changes - program execution speed has been increased, while the language itself has been brought closer to MQL5 to the maximum possible extent. This means that MQL4 trading robot developers can now also enjoy all the advantages of OOP: classes and structures, inheritance, Standard Library, resources and much more.

New MetaEditor provides such features as debugging, profiling, personal storage, autosubstitution of function names, snippets, inserting resources and intelligent code management.

The new MetaTrader 4 terminal features the Market - store of protected applications for MetaTrader 4 terminal. Now, any developer can put his or her own trading programs for sale on the unified application store, while traders can buy any product right from the terminal. All EX4 application files downloaded from the Market have the high level of protection similar to that of MQL5. MQL4 application developers can set the number of activations and prices for their products without worrying about the technical issues related to sales process - MetaTrader 4 Market will take care about the latter.

Due to changes in the file structure and location of the directory for storing custom files (indicators, Expert Advisors, scripts, templates, logs, etc.), all these data will be automatically moved to the new place during the update. Not a single custom file will be deleted during the process, and all original files will remain in their appropriate locations becoming backup copies. 

All custom executable EX4 files created by old MQL4 compiler will be automatically moved to the new Navigator directory and will work in the new terminal the same way as before.

Trading Terminal

  1. MQL4 language for programming trading strategies has been substantially revised and its functionality has been brought closer to that of MQL5. Classes and structures have been added and the language syntax has been extended up to С++ level allowing developers to implement all the advantages of object-oriented programming. It means that trading robots and technical indicators can be created much easier and faster now, while Expert Advisor developers have gained new opportunities in a single MetaEditor development environment - debugging, profiling, code completion, etc. Find out more details on the new features in a separate section of MetaEditor article on MQL5.

    Increased operation speed of MQL4 apps, provided built-in support of DLL and Visual Studio, implemented access to MQL5 Storage and much more.

  2. Added Market tab for buying and downloading paid and free Expert Advisors, signals and scripts from MetaTrader 4 Market. Now, any MQL4 developer can become a Seller and offer products to millions of traders using MetaTrader 4.

    You can download a demo version or buy a full-featured paid MQL4 application on MetaTrader 4 Market directly from the terminal. Each purchase is completely secure allowing a user up to 5 activations on different PCs and has no limitations on working time, account type or a broker. Each paid indicator or an Expert Advisor can be launched in MetaTrader 4 strategy tester in visual mode before purchasing in order to evaluate the product.

  3. MetaTarder 4 build 600 features the new structure and location of the client terminal files. Now, MQL4 applications are placed in separate directories according to the program type (Expert Advisors, indicators or scripts). In most cases, the terminal data is now stored in a special data folder separated from the terminal installation location. In this article, we will describe in details how data is transferred, as well as the reasons for introducing the new storage system.

    Why Has the New Data Storage System Been Implemented

    Microsoft Windows XP released 13 years ago allows applications to write their own data at the place of their installation even if the latter took place in Program Files system folder. A user should only have an administrator permission to write data to any folder.

    When working in 64-bit systems, separate installation directories are provided for 32 and 64-bit programs: Program Files and Program Files (x86). Operation features described in the article apply to both directories.

    Starting from Windows Vista, Microsoft has introduced a restriction on writing to Program Files directory. If User Account Control (UAC) system is enabled, programs are not allowed to store their data in Program Files folder. All data should be located in a separate user directory. This limitation has been introduced in order to protect users against malicious programs and to prevent applications under one user account to change or damage the same program's data necessary for another user account. Since that time, security requirements in Microsoft operating systems have been tightening further. In particular, starting with Windows 8, UAC system cannot be disabled even if "Never notify" option is selected in its settings.

    Microsoft has implemented virtualization process in order to provide compatibility with older applications when using UAC. If a program tries to save its data to Program Files directory, the data is actually (physically) saved to a separate folder having the following look - C:\Users\<user-name>\AppData\Local\VirtualStore\Program Files, while Windows File Explorer shows the files as if they are saved in the installation directory. Microsoft claims that this mode has been provided only for compatibility and can be removed later.

    In order to comply with Microsoft recommendations, the data storage structure has been changed in MetaTrader 4 client terminal starting from build 600. Now, the terminal will also save its data in a user directory.

    User Data Directory

    In the new version, all data of a certain user working with a certain copy of MetaTrader 4 terminal are stored in a special place called terminal data folder. This folder can be found on a system disk (a disk with installed Windows operating system) along the following path

    • С: - name of a system disk;
    • User_account_name - user's account for working in Windows;
    • Instance_id - unique name of the folder where all the user's data for working with a certain copy of MetaTrader 4 terminal is stored. A unique name consists of 16 characters. The name is generated based on the path to the terminal installation directory, since the path to the terminal installation directory cannot be explicitly used as a folder name. Significant length of the unique name is explained by the fact that multiple copies of the terminal can be installed on a single PC.

    "Open Data Folder" command has been added to File menu of the terminal for searching and opening the data folder.

    The root of each terminal data folder also contains origin.txt file where you can find the path to the installation folder of the terminal this data refers to. This allows users to match each terminal data folder with a certain terminal installation directory, for example, in case when several copies of MetaTrader 4 terminal are installed by a user. This type of working with the terminal when the data folder is separated from the installation one is the main mode.

    For more convenience, an entry containing the path to the data folder is made in the terminal's journal each time the terminal is launched. For example:

    2014.02.10 12:48:28.477 Data Folder: C:\Users\JohnSmith\AppData\Roaming\MetaQuotes\Terminal\9F86138A4E27C7218E9EC98A5F8D8CA1

    Copying MQL4 Application Files When Updating to MetaTrader 4 Build 600 and Higher

    When the newly updated terminal is launched, it checks if the data folder is present. If the data folder is not present yet, then it is created. If that folder is different from the installation one, the terminal's regular data (standard MQL4 programs, historical data, configuration files, templates, etc.) is copied into it. The files that are not changed during the terminal operation (executable files, mql.dll compiler, sound files, etc.) are left in the installation directory. The terminal data folder is different from the installation one in the following cases:

    • UAC system is enabled. The exception is when the terminal is installed on a portable device (external hard drive, usb flash drive, etc.).
    • Current PC user has limited rights to write data to the installation directory.
    • A user is working via remote connection (RDP).

    If none of the above conditions is satisfied, the terminal data is stored in the installation directory.

    Then, the user files are moved to the data folder. At this stage, the directory where the terminal's user data has been stored is determined. If the data has been stored in the terminal installation folder, they are copied the following way:

    Source folder in the installation directory
    Contents Destination folder in the terminal data directory
    Expert Advisors (trading robots)
    Note: only files from the root \experts directory are copied. No subdirectories are copied, since it is impossible to reliably determine their contents
    \experts\indicators Custom indicators
    Scripts (MQL4 applications for a single run on the chart) \MQL4\Scripts
    experts\include Source code MQH and MQ4 files implemented into other programs \MQL4\Include
    experts\libraries Libraries in the form of MQ4 source codes and EX4 executable files compiled from them. They are used for the dynamic call of the functions contained there by other MQL4 programs \MQL4\Libraries
    experts\files Special "file sandbox". MQL4 applications are allowed to execute file operations only within this directory \MQL4\Files
    Log files of MQL4 applications
    Files of presets for MQL4 applications
    Image files for being used in resources \MQL4\Images

    Next, it is checked whether the client terminal has stored data in virtualization directory (the operating system's virtual storage described above). If the terminal has been installed in Program Files directory and the operating system is Windows Vista or higher, the terminal data is most probably stored in that directory. If the data is found, it is copied according to the above table.

    The files are copied and not moved during the migration. The copied files are not deleted from the source folders.

    During the migration, the entries containing source and destination paths of the copied files are made in the terminal's journal. To view all the logs, open Journal tab of Terminal window and execute Open command in the context menu. The folder containing the terminal log files will open.

    If the migration has been completed successfully for the current terminal copy, it is not repeated any more during subsequent MetaTrader 4 terminal updates. If the data folder is different from the installation one, and custom MQL4 applications have been copied together with the standard files during the migration, the following dialog window appears:

    Portable Mode

    Portable launch mode is provided for the terminal operation on portable devices and non-system directories, as well as for working in Windows XP. When launched in this mode, the terminal tries to save its data in the installation folder. However, using Portable mode does not guarantee that an operating system will allow storing data in the installation folder (for example, if the terminal is installed in Program Files directory and UAC system is enabled).

    The following conditions should be met for working in Portable mode:

    Installation directory
    Operating system
    Program Files or another system directory (for example, Windows)
    Windows XP
    Permission to write to the installation folder
    Another non-system directory
    Windows XP
    Permission to write to the installation folder
    External hard drive, usb flash drive, etc. Windows XP The terminal will always be launched in Portable mode.
    Program Files or another system directory (for example, Windows) Windows Vista\Windows 7
    Launching the terminal as administrator and disabled UAC
    Another non-system directory Windows Vista\Windows 7
    Permission to write to the installation folder
    External hard drive, usb flash drive, etc. Windows Vista\Windows 7 The terminal will always be launched in Portable mode.
    Program Files or another system directory (for example, Windows)
    Windows 8 and higher
    It is impossible to use Portable mode, as UAC system cannot be disabled
    Another non-system directory Windows 8 and higher
    Permission to write to the installation folder
    External hard drive, usb flash drive, etc. Windows 8 and higher The terminal will always be launched in Portable mode.

    • It is not recommended to use Portable mode in case you use Windows Vista or higher, and the terminal is installed in Program Files. This mode is provided for the terminal operation on portable devices and Windows XP.
    • If you have updated the terminal and all the data has been copied to a separate user data folder, it is also not recommended to switch to Portable mode.
    • You should manually copy the data to the installation folder in order to use Portable mode after copying the data in the user data folder. Launching the terminal in Portable mode does not copy the data from the data folder to the installation one.

    In order to launch the terminal in Portable mode, use "/portable" key. For more convenience, you can create an additional terminal launch shortcut with the appropriate name on your desktop and add the key directly to the shortcut:

  4. Changed the algorithm of placing trade requests. In previous builds, an additional network connection has been created when placing trade requests. This connection has remained active for some time after a last trade request was sent in order to provide fast sending of a large number of trade requests.

    Now, when placing trade requests, all of them are passed via the main connection with the trade server. Thus, the time of processing the trade requests (especially the first one) has been considerably reduced as there is no need to wait for connection to the trade server being established any more. In order for the new request sending algorithm to be operable, the trade server should also be updated - requests are still set in a separate connection on older trade servers.

    Due to transition to the new model of requests processing, the ability to cancel the trade requests not yet accepted by the server (Cancel button in the trade request status dialog) has been disabled.

  5. Changed RateInfo history data storage format. RateInfo structure was presented as follows in the old version:
    struct RateInfo
       unsigned int      ctm;  // bar open date
       double            open; // Open price
       double            low;  // Low price
       double            high; // High price
       double            close;// Close price
       double            vol;  // volume

    In the new format, RateInfo structure features fields for storing spread and trading volume:

    //--- Standard quote presentation in the new terminal version
    struct RateInfo
       INT64             ctm;               // open date and time
       double            open;              // Open price (absolute value)
       double            high;              // Low price
       double            low;               // High price
       double            close;             // Close price
       UINT64            vol;               // tick volume
       INT32             spread;            // spread
       UINT64            real;              // trade volume

    Thus, if MQL4 programs contain DLLs for passing/accepting price data, the corresponding functions in the source codes should be rewritten and recompiled considering format changes to ensure proper operation.

    Old EX4 applications and DLLs based on old RateInfo format will not work in the new terminal. Conversion to the new format is required.
  6. Added global search in MetaTrader 4 client terminal and at The search in the terminal allows you to quickly find information in all sections of the client terminal, Code Base, as well as on and websites.

    Word-by-word search with regard to Russian and English morphology is used. The search is performed in the sections specified by a user in the settings:

    The context menu of the search results tab contains additional commands depending on the type of results:

  7. Added the command of placing an instant order for the development of MQL4 applications in Jobs section. Now, each trader can not only download any code from the free library but also find a programmer able to develop a necessary indicator or a trading robot according to the user algorithm. The process of an order execution is described in the article How to Order an Expert Advisor and Obtain the Desired Result and provides protection for bother parties - a developer and a customer.

  8. Added ability to send push notifications of transactions occurring on the client account: placing, changing and removing orders, activation of pending orders and SL-TP, Margin Call and Stop Out events. Push notifications are sent to the mobile terminals installed on iOS and Android powered devices, do not depend on the phone number and can be delivered if Internet connection is available. Find out the details in the article MetaQuotes ID in MetaTrader Mobile Terminal.

  9. Added display of alerts on the chart. The alerts can be managed via drag'n'drop. Also, the ability to set an alert expiration time has been implemented.

    When management of trading levels from the chart is allowed, alert's price value can be changed by its dragging to a new price level. Alerts can be disabled or removed using a context menu on the appropriate chart level.

  10. Added search for a server by a company name in the demo account opening window.
    Just enter a company name (or a fragment of a server name) and the terminal will automatically add all servers of the company (the servers containing the specified line in their names) to the list:

  11. Added display of subfolders and the structure of Expert Advisors, scripts and indicators in Navigator window.

  12. Improved accuracy of opening and closing time of trade orders and positions displayed in the lists of open orders and positions, trading history and trade reports - seconds have been added.

  13. Improved accuracy of the last quote's time displayed in Market Watch and Popup Prices windows - the last quote's time is shown up to seconds (instead of minutes).

  14. Added automatic terminal restart request after changing the interface language. The client terminal should be restarted in order for the change to take effect. Previously, users had to close and launch the terminal for themselves. Now, after changing the interface language, users are immediately prompted to restart the terminal - it can be closed and restarted at a single click.

  15. Fixed tooltips of trading levels in case the indicators using a separate subwindow are present on the chart. When hovering the mouse cursor over Stop Loss or Take Profit level on the chart, a tooltip containing profit/loss (in points and currency) to be received in case of the level's activation is displayed. Previously, if an indicator working in a separate subwindow (for example, standard MACD) was present on the chart, that tooltip was not displayed sometimes.

  16. Added automatic update of the client terminal built-in user guide files similar to the one implemented in MetaTrader 5. Now, help files are not included in the terminal's installation and LiveUpdate packages reducing the traffic volume. The user guide is downloaded the first time a user opens it. In all subsequent cases, the system checks if the new versions are present. If there is a new version available, the user is prompted to update:

    The new system of working with help files also reduces the traffic consumption due to the fact that the language version of the downloaded user guide corresponds only to the language specified for the client terminal's interface (no excessive language versions are downloaded). This system also provides regular update of the user guide regardless of the client terminal update.

  17. Added fast registration dialog in case a user has no account. Now, an account can be created without the need to leave the terminal.

    Specify login and email address in the registration window. After clicking Register, an email for account activation is sent to the specified address. account allows traders to use additional powerful services:
    • MetaTrader 4 AppStore - users can buy MetaTrader 4 apps or download them for free directly from the terminal. MetaTrader 4 AppStore offers hundreds of various applications and their number is constantly increasing.
    • Signals service - users can subscribe to trading signals provided by professional traders and make profit. Trading operations are automatically copied from provider's account to subscriber's one. The service also allows selling your own trading signals. A trading account can be connected to the monitoring system in a few clicks.

  18. Trading accounts are now displayed much clearer in Navigator window:
    • Accounts are grouped by their appropriate trade servers.
    • If an account is subscribed to trading signals, the icon with a signal name is displayed nearby. When hovering the mouse cursor over the signal, subscription expiration date is shown.

  19. If the current trading account is subscribed to a signal, the appropriate icon is displayed in Trade tab of Symbols window. When hovering the mouse cursor over the icon, the data on the signal is shown. There have been cases when traders forgot that their account was subscribed to a signal. That could happen, for example, when subscription has been made to check the service's operation. The subscription icon makes working with signals more convenient.

  20. Added new graphical objects: Button, Bitmap, Bitmap Label, Rectangle Label. These objects cannot be manually installed on the charts and are designed for organizing a user interface for MQL5 applications: Expert Advisors, scripts and indicators.
  21. Optimized work with in case of slow Internet connection. Now, you can work with Trading Signals, Code Base library and the version MQL5 Storage conveniently even at low connection speed.
  22. Improved accuracy of the time displayed in the client terminal's Journal - milliseconds have been added.
  23. Fixed One Click closing of positions in the list of open orders and positions (by clicking Cross button) - now the value of the acceptable price deviation from the trading settings is used in Instant Execution mode.
  24. Added ability to copy to clipboard on Company tab.
  25. Fixed arranging chart windows by commands.
  26. Fixed saving profiles when switching between full-screen charts.
  27. Fixed display of a number of dialogs when using the Japanese interface.
  28. All client terminal components require support for SSE2 instruction set by PC's processor for efficient operation and high performance.
  29. Optimized scanning for the best access point.
  30. Fixed looping errors that occurred during the update in case of refusal from elevating the rights when using UAC.
  31. Fixed display of the news header and contents, as well as of internal e-mails using UTF-8 encoding.
  32. Fixed an error that in some cases could lead to incorrect display of Margin and Free Margin fields in the list of open orders and positions. This error might occur when a user declined to accept "One-Click Trading" agreement.
  33. Updated the list of countries in the appropriate dialog when opening a demo account.
  34. Updated and enhanced translation of the interface into Swedish, Hungarian, Japanese, Italian and Bulgarian.
  35. Fixed time in the bar dialog of the quotes Archive. Previously, bar time was displayed incorrectly when re-opening the bar dialog. The quotes Archive allows managing the terminal's price data - download, edit and delete bars of various timeframes.
  36. Fixed downloading history data via the quotes Archive. The error could occur if the number of characters on the current account is different from that of downloaded quotes (for example, if the current account's prices have four decimal places, while the prices downloaded from the archive have five ones).
  37. Fixed displaying hedged margin in the symbol specification dialog. Previously, values have always been rounded up to the integer part:

Trading Signals

  1. Expanded information about a trading signal:
    • added information about the date of the latest trade and the number of trades for the last week.
    • added Equity chart of the trading signals source account.
    • added Distribution diagram displaying trading activity by symbols.

  2. Added the option for unconditional synchronization of positions between a signal source and a subscriber's account. If enabled, synchronization of subscriber's and signal source's accounts (including closing open positions not related to the signal) is performed without subscriber's additional confirmation.

    This option is necessary when using signals on VPS (Virtual Private Server). It can also be used to increase the synchronization reliability when working with the already selected signal.

  3. Added legend for equity, growth, balance and distribution graphs. Also, marks displaying funds depositing and withdrawal have been added to the equity graph. When hovering the mouse cursor over the balance operation triangle, a tooltip with the operation sum is displayed:

  4. Added display of the number of new trading signals submitted over the past 3 days on the signals tab.
  5. Added consideration of the minimum allowed volume and minimum volume step during the initial synchronization of trading positions. If the size of the local position is less than the estimated volume at the signal's side, increase in the local position is not performed, as it would be necessary to re-open the position. This might lead to the loss of the spread.
  6. Fixed opening and closing trade positions by symbols with the execution type being changed from Instant Execution to Request Execution when the threshold order volume value is exceeded.
  7. When symbols of a signal source and a subscriber are compared and a number of appropriate symbols at the subscriber's side are found, permission to trade them is now considered.
  8. Added History and Reviews tabs to the information about a trading signal.
  9. Added signal's rating column to the signal list.
  10. Removed display of tickets of signal's orders and positions from the information about a trading signal.
  11. Fixed an error of trading signals synchronization that occasionally occurred in case of the large number of unidirectional positions having the same volume.
  12. Added automatic conversion of trading symbols GOLD <=> XAUUSD and SILVER <=> XAGUSD.
  13. Added prohibition to subscribe to trading signals for the accounts compatible with NFA FIFO regulations.
  14. Fixed subscription to signals when working under Wine (Linux and Mac).
  15. Removed "Show full list of signals" option from Signals tab of Symbols window. If this option is disabled, only signals provided from the accounts of the same broker are displayed in the the terminal's signal showcase. Now, all signals are displayed in the showcase, regardless of a broker. As a result, traders always have a wide selection of signals available for subscription allowing them to choose the best offers.

Strategy Tester

  1. Fixed consideration of a tick spread set in the testing parameters when optimizing using a tick cache.
  2. Fixed testing error that could occasionally lead to incorrect calculation of a trading deal commission. During the tests, charged commission settings are taken from the appropriate trading symbol parameters. Previously, if the commission value was charged as a percentage per annum, it was calculated incorrectly in the strategy tester.

MQL4 Language

  1. Fixed an error that occasionally prevented closing and opening trading positions from MQL4 apps. This error could occur when dealing with trading symbols of Market Execution type when sending big volume orders.

Fixed errors reported on the forum and in crash logs.

What's New in MQL4

MQL4 programming language has been completely revised reaching the level of MQL5 - now you can develop trading robots in MQL4/5 using the unified MetaEditor development environment, single style, libraries and debugging tools.

MQL4 is popular among automated system developers due to the ease of learning and a huge amount of code generated for many years of using MetaTrader 4 terminal. However, the language also has some drawbacks arising from its main advantage - a simple programming language does not allow development of complex systems and hinders porting of debugged libraries from high-level languages. Therefore, we decided to implement in it the maximum possible amount of MQL5 language functions and features fully preserving MQL4 functionality. In other words, all powerful MQL5 functions, including ООP and the native code compiler, will become available in MQL4.

To achieve this, we have developed a unified compiler that automatically supports both MQL4 and MQL5 languages. MetaEditor will also become a unified application both for MetaTrader 4 and MetaTrader 5 platforms. Thus, it will be possible to compile both MQL4 and MQL5 from any version. MQL5 Storage also becomes available for work.

Protection of MQL4 applications rises to MQL5 level. New EX4/EX5 files are provided with a serious and completely revised protection. This means that the Market of secure EX4 applications also becomes available to MetaTrader 4.

Besides, MQL4 now features new graphical objects and new functions for working with charts. MQL5 Standard Library is to be ported to MQL4 providing developers with new possibilities in creating their own graphical interfaces and trading libraries. Now, you can create full-fledged applications in MetaTrader 4 using the resources.

Changes in MQL4 Language

The table of differences between compilers

Old MQL4 compiler
New MQL4 compiler
New MQL4 with #property strict
init(), start() and deinit() entry points may have any parameters and any return type init(), start() and deinit() left intact for the sake of compatibility
and new OnInit(), OnStart(), OnCalculated, OnTick(), OnTimer(), OnChartEvent(), OnTester() and OnDeinit() should exactly match their signatures
Virtually any variable names (except for the reserved words) are possible, including special characters and points
Variable names cannot have special characters and points.
The list of the reserved words has been expanded. Thus, such widespread words as short, long, const, etc. cannot be used as names
Variable scope is from declaration (even in the nested block) to the function end
Variable scope is from declaration to the end of the block, in which the variable is declared
Implicit initialization of all the variables (both global and local ones) by zero
Only global variables are initialized. Only strings are initialized implicitly in local variables.
Local arrays are not released when exiting the function
Local arrays are released when exiting the function
Local arrays are released when exiting {} block
"Array out of range" does not cause a critical error *
Ditto, except for the arrays of structures and classes, for which this error is critical one
"Array out of range" is a critical error causing the program to stop
No structures and classes
Structures and classes are present. Additional data types are implemented
Strings are single-byte.
datetime is a 32-bit integer.
Predefined Volume variable is of double type
Strings are unicode ones.
datetime is a 64-bit integer.
Predefined Volume variable is of ulong type
ArrayCopyRates() performs virtual copying to double[][6] array ArrayCopyRates() performs virtual copying to MqlRates[] array. Copying to double[][6] array has remained intact for the sake of compatibility, however, that copying is real, not virtual
The functions may not return values even if they have a type. To do this, return(0) is automatically inserted by the compiler in the function end
Functions of any type should return a value
The number of simultaneously opened files is 32
The number of simultaneously opened files is 64
The files are always opened in shared use mode **
Shared use mode should be specified explicitly using FILE_SHARE_READ and/or FILE_SHARE_WRITE

* Please pay special attention to "Array out of range" error - many old custom indicators will display this error in strict mode of the new compiler when launched on the chart. It is recommended to find the cause and eliminate it.

** In the new MQL4 and MQL5, FILE_SHARE_READ and FILE_SHARE_WRITE flags are responsible for the files shared use mode. There were no such files in the old MQL4.

The update to MetaTrader 4 build 600 is available through the LiveUpdate system.