MQL4 - automated forex trading   /  

Forum

Login | Register | Language: ru cn en
Write an Article and Earn Money

MetaTrader 4 Build 600 with Updated MQL4 Language and Market of Applications Released

Back to topics list  | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 > >> To post a new topic, please log in or register
avatar
Moderator
71693
MetaQuotes 2014.02.03 21:12
 

MetaTrader 4 Build 600 with Updated MQL4 Language and Market of Applications Released

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. Find out more about that in the section Automatic Copying of MQL4 Programs When Updating from Older Builds below.

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.


MetaTrader 4 Client Terminal

  1. Terminal: 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. Terminal: 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. Terminal: 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

    C:\Users\User_account_name\AppData\Roaming\MetaQuotes\Terminal\Instance_id
    where:
    • С: - 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.

    Open 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
    \experts
    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
    \MQL4\Experts
    \experts\indicators Custom indicators
    \MQL4\Indicators
    \experts\scripts
    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
    experts\logs
    Log files of MQL4 applications
    \MQL4\Logs
    experts\presets
    Files of presets for MQL4 applications
    \MQL4\Presets
    experts\images
    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:

    Migration completed successfully


    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
    Requirements
    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:

    Launching MetaTrader 4 in Portable mode


  4. Terminal: 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. Terminal: 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. Terminal: Added global search in MetaTrader 4 client terminal and at MQL4.com. The search in the terminal allows you to quickly find information in all sections of the client terminal, Code Base, as well as on MQL4.com and MQL5.com 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. Terminal: 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. Terminal: 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. Terminal: 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. Terminal: 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. Terminal: Added display of subfolders and the structure of Expert Advisors, scripts and indicators in Navigator window.




  12. Terminal: 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. Terminal: 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. Terminal: 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. Terminal: 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. Terminal: 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. Terminal: Added MQL5.community fast registration dialog in case a user has no account. Now, an MQL5.community 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 MQL5.community account activation is sent to the specified address.

    MQL5.community 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. Terminal: 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. Terminal: 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. Terminal: 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. Terminal: Optimized work with MQL5.community 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. Terminal: Improved accuracy of the time displayed in the client terminal's Journal - milliseconds have been added.
  23. Terminal: 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. Terminal: Added ability to copy to clipboard on Company tab.
  25. Terminal: Fixed arranging chart windows by commands.
  26. Terminal: Fixed saving profiles when switching between full-screen charts.
  27. Terminal: Fixed display of a number of dialogs when using the Japanese interface.
  28. Terminal: All client terminal components require support for SSE2 instruction set by PC's processor for efficient operation and high performance.
  29. Terminal: Optimized scanning for the best access point.
  30. Terminal: Fixed looping errors that occurred during the update in case of refusal from elevating the rights when using UAC.
  31. Terminal: Fixed display of the news header and contents, as well as of internal e-mails using UTF-8 encoding.
  32. Terminal: 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. Terminal: Updated the list of countries in the appropriate dialog when opening a demo account.
  34. Terminal: Updated and enhanced translation of the interface into Swedish, Hungarian, Japanese, Italian and Bulgarian.
  35. Terminal: 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. Terminal: 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. Terminal: Fixed displaying hedged margin in the symbol specification dialog. Previously, values have always been rounded up to the integer part:




  38. Signals: 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.




  39. Signals: 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.

  40. Signals: 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:




  41. Signals: Added display of the number of new trading signals submitted over the past 3 days on the signals tab.
  42. Signals: 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.
  43. Signals: 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.
  44. Signals: 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.
  45. Signals: Added History and Reviews tabs to the information about a trading signal.
  46. Signals: Added signal's rating column to the signal list.
  47. Signals: Removed display of tickets of signal's orders and positions from the information about a trading signal.
  48. Signals: Fixed an error of trading signals synchronization that occasionally occurred in case of the large number of unidirectional positions having the same volume.
  49. Signals: Added automatic conversion of trading symbols GOLD <=> XAUUSD and SILVER <=> XAGUSD.
  50. Signals: Added prohibition to subscribe to trading signals for the accounts compatible with NFA FIFO regulations.
  51. Signals: Fixed subscription to signals when working under Wine (Linux and Mac).
  52. Signals: 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.
  53. Tester: Fixed consideration of a tick spread set in the testing parameters when optimizing using a tick cache.
  54. Tester: 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.
  55. MQL4: 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.
  56. Fixed errors reported on the forum and in crash logs.


MetaTrader 4 MultiTerminal

  1. Fixed occasional incorrect update of the list of orders after their removal.
  2. Fixed display of the current floating profit on an account - the profit value has not included accumulated swaps at open positions.
  3. The accuracy of the last quote's time displayed in Market Watch and Popup Prices windows has been improved.
  4. Fixed display of the news header and contents, as well as of internal e-mails using UTF-8 encoding.
  5. Improved accuracy of the time displayed in the terminal's Journal - milliseconds have been added.
  6. Fixed errors reported in crash logs.

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


What's New in MQL4

MQL4 programming language has been completely revised and brought to 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

  • Added new char, short, long, uchar, ushort, uint, ulong and double data types. This will allow transferring codes from other C++ like languages. Data of various type is processed at different rates. Integer data is the fastest one to be processed. A special co-processor is used to handle the double-precision data. However, due to the complexity of the internal representation of floating-point data, it is processed slower than integer one. Typecasting has also been implemented.
  • Strings are now presented in Unicode format, though they were in ANSI format (single byte ones) before. That should be considered if the program uses DLLs and passes string variables to them. When calling Windows API functions, Unicode versions of these functions should be used.
  • Predefined Volume variable is now of long type. The time series for accessing the volumes also consist of long type arrays. It is recommended to use explicit casting of data having this type to the target type in old MQL4 programs to avoid type overflow error.
  • Structures and classes, object pointers, void type and this key word allowing an object to receive a reference to itself have been added. All object-oriented programming standards are supported:
  • ООP allows developing programs using classes. This facilitates debugging and development of large applications, as well as provides ability to reuse previously generated code multiple times due to inheritance. However, that does not mean that you cannot generate your MQL4 code in procedure-oriented style as before. You can develop your programs as you did in the past if you don't need the new features.

  • init(), deinit() and start() predefined functions have remained for compatibility, however, OnInit(), OnDeinit(), OnStart(), OnCalculate() and OnTick() ones can now be used instead. Besides, new OnTimer(), OnChartEvent() and OnTester() predefined handler functions have been added. In the previous MQL4 versions, predefined functions could have any parameters and any return type. These functions were called by their names, not signatures. In the new MQL4, all predefined functions should exactly match their signatures. In other words, they should have a clearly defined set of parameters and a return type.

  • Now, variable names cannot contain special characters and points, and new MQL4 language keywords cannot be used as names. Old MQL4 programs can be recompiled with the new compiler in order to easily correct all such errors while following the compiler's messages.

  • The Precedence rule now matches C language standards. If you are unsure, you can insert parentheses in old MQL4 apps to clearly indicate the priority to increase reliability.

  • Shortened conditions check is now used in logical operations, unlike the old MQL4 version where all expressions have been calculated and the check has been performed afterwards. Suppose there is a check of two conditions with the use of logical AND
      if(condition1 && condition2)
        {
         // some block of operations
        }
    If condition1 expression is false, calculation of condition2 expression is not performed, as false && true result is still equal to false.

  • Changed ArrayCopyRates() behavior - in the old MQL4 version, this function copied price series to double[][6] array. Now, the array from MqlRates structure elements should be used in order to receive time series:

    //Structure for storing data on prices, volumes and spread.
    struct MqlRates
      {
       datetime time;         // period start time
       double   open;         // Open price
       double   high;         // High price for the period
       double   low;          // Low price for the period
       double   close;        // Close price
       long     tick_volume;  // tick volume
       int      spread;       // spread
       long     real_volume;  // exchange volume
      };

    The new format of the function also performs virtual copying. In other words, the actual copying is not performed. When the copied values are appealed to, the price data is accessed directly.

    int  ArrayCopyRates(
       MqlRates&  rates_array[],   // MqlRates array passed by reference
       string     symbol=NULL,     // symbol
       int        timeframe=0      // timeframe
       );

    In order to maintain compatibility with old MQL4 applications, the old call format is also preserved. However, a real copying of data to double type array is now performed.

    int  ArrayCopyRates(
       void&     dest_array[][],    // array passed by reference
       string    symbol=NULL,       // symbol
       int       timeframe=0        // timeframe
       );
    This means that the necessary data should be copied to dest_array[][] again when changing values in time series (adding new bars, restructuring or updating the last bar's Close price). In this case, the receiver array will be automatically distributed according to the necessary amount of the copied bars even if it has been declared statically.

  • In file operations, the number of simultaneously opened files can now reach 64 ones, while there could be no more than 32 ones in the old MQL4. Until recently, the files were always opened in FILE_SHARE_READ or FILE_SHARE_WRITE mode. Now, the necessary opening mode should be specified explicitly.

  • Working with functions, scope of variables and memory release in local arrays has also been changed. Since the number of changes is large enough, the new #property strict property has been introduced to provide maximum compatibility with the previous approach to developing MQL4 programs. When creating new MQL4 application using MQL wizard, this property is always added to the template. The table below contains the differences between MQL4, new MQL4 without using strict and new MQL4 with specified strict compilation mode
    #property strict
  • The string representation of datetime type now depends on compilation mode:
      datetime date=D'2014.03.05 15:46:58';
      string str="mydate="+date;
    //--- str="mydate=1394034418" - old compiler/new compiler without #property strict
    //--- str="mydate=2014.03.05 15:46:58" - new compiler with #property strict

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 long 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 flags in the old MQL4.


Automatic Copying of MQL4 Programs When Updating from Older Builds

In the previous builds of MetaTrader 4 client terminal (509 and older), all MQL4 applications were stored in the following subdirectories of <terminal_installation_folder>\experts\ root directory:

  • \experts - Expert Advisors (trading robots),
  • \experts\indicators - custom indicators,
  • \experts\scripts - scripts (MQL4 applications for a single run on the chart),
  • \include - source code MQH and MQ4 files implemented into other programs,
  • \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,
  • \files - special "file sandbox". MQL4 applications are allowed to execute file operations only within this directory.

In the new MQL4 version, the file structure for storing the source codes has changed. Now, all MQL4 applications should be located in the appropriate folders of <data_catalog>\MQL4\ directory:

  • \experts - Expert Advisors (trading robots),
  • \Indicators - custom indicators,
  • \Scripts - scripts (MQL4 applications for a single run on the chart),
  • \include - source code MQH and MQ4 files implemented into other programs,
  • \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,
  • \Images - image files for using in resources,
  • \files - special "file sandbox". MQL4 applications are allowed to execute file operations only within this directory.

When updating MetaTrader 4 terminal from build 509 to the newer version, all MQ4, MQH and EX4 files from standard root directories of the previous version are automatically copied and relocated to the appropriate folders. Subfolders additionally created by a user, as well as files contained there are not processed. They should be relocated to the new place manually if necessary .

No files or folders are deleted during the update! All file copy operations including used file paths are fixed in the terminal Journal during the update.

No automatic re-compilation of the old EX4 files to the new version is performed during the update. Users are free to decide what source codes should be compiled to the new EX4 version. All old EX4 will work in the new MetaTrader 4 terminal. EX4 libraries compiled by the new compiler can be called only from the EX4 programs that have also been compiled in the new version.

In some cases, you may need to edit the path in #property include for included files (if relative paths have changed) in the source files. Please note that MetaEditor's root directory is now <data_folder>\MQL4\. All programs should be located in the correct subdirectories.

You can find the data folder (<data_folder>) for each copy of MetaTrader 4 terminal on your computer via the terminal menu or in MetaEditor: File - Open Data Folder.


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

The Test!!
The Test!!
Gary Comey | 19 November 2014, 23:26 | Views: 106
You can now copy my trades with a one week free trial Today I reached a significant personal goal. To move ahead of Siam FX Directional in this eight week test. My account is now up 97% and so is within a stone’s throw of a significant psychological 100% return. The test demo account which is following my live account is now up 41% since October 31st and the test continues.
avatar
1252
onewithzachy 2014.02.04 01:51 #
 

Please change the version numbering, Currently, MT version numbering gives no idea which MT is stable and which one is beta.


And BTW, My Windows Title still showing different broker, and I still have to close and open after live update instead of restart.

Is it just me or anybody else have the same problem ?


I have no problem setting Portable, but please, change this picture below to the English one, most of us here does not understand Russian and can't use online translator for that picture anyway.



 
avatar
37
d.saravana21 2014.02.04 03:27 #
 
I was using the Code
file_src_path = TerminalPath()+"\experts\files\

which code should i have to use for file path?


with Regards

Saravana

avatar
1252
onewithzachy 2014.02.04 04:40 #
 
d.saravana21:
I was using the Code

which code should i have to use for file path?


with Regards

Saravana


Open new MetaEditor, click Help menu and click MQL4 Reference. Use "CheckUp > TerminalInfoString.


 
avatar
37
d.saravana21 2014.02.04 05:13 #
 
onewithzachy:

Open new MetaEditor, click Help menu and click MQL4 Reference. Use "CheckUp > TerminalInfoString.



I got you bro.. thank you so much..
avatar
4
kwang1 2014.02.04 06:17 #
 

Is it possiable to compile the same Standard Library as MQL5, same file structures, same functions? so we can complie mq5 it to .ex4 under mql4 easily.


//+------------------------------------------------------------------+
//| Include                                                          |
//+------------------------------------------------------------------+
#include <Expert\Expert.mqh>
//--- available signals
#include <Expert\Signal\SignalBullsPower.mqh>
//--- available trailing
#include <Expert\Trailing\TrailingFixedPips.mqh>
//--- available money management
#include <Expert\Money\MoneyFixedRisk.mqh>
 
avatar
Moderator
136
alexvd 2014.02.04 06:23 #
 
d.saravana21:
I was using the Code

which code should i have to use for file path?


with Regards

Saravana


The best way is

TerminalInfoString(TERMINAL_DATA_PATH)+"\MQL4\Files"
avatar
37
d.saravana21 2014.02.04 06:26 #
 

Hey friends I was using this code well before MT4 updated to build 600.. but now it's not working well.

kindly guide me some one..


   string file_src_path = TerminalPath()+"\MQL4\files\*.csv";
   string file_dst_path = "C:\Data";
   string file_path = "/c move /y "+"\""+file_src_path+"\""+" "+"\""+file_dst_path+"\"";
   string cysymbol = Symbol();
   int cytfs[] = {PERIOD_D1,PERIOD_W1};
   int num_tfs = ArraySize(cytfs);
   int cur_tf,j;
   for (j=0; j<num_tfs; j++)
   {
      cur_tf = cytfs[j];
      exportfle (cysymbol,cur_tf);
   }
   ShellExecuteA(0, "Open","cmd.exe", file_path , "", 1);
   return(0);
 
avatar
4
avatar
Moderator
136
alexvd 2014.02.04 06:55 #
 
topikuning:

I'm updated my MT4, but my anti virus detected this threat.

I have tried to re-download the update from another broker. but same threat came up.

any suggestion?


Please check digital signature of the terminal.exe file. You have to see something like this


avatar
Moderator
136
alexvd 2014.02.04 06:57 #
 
d.saravana21:

Hey friends I was using this code well before MT4 updated to build 600.. but now it's not working well.

kindly guide me some one..



Please read post above. You have to correct path
Back to topics list   | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 > >>  

To add comments, please log in or register