Download MetaTrader 5

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

To add comments, please log in or register
Your conversation partner speaks foreign language? Automatic translation will help you!
MetaQuotes Software Corp.
Moderator
181428
MetaQuotes Software Corp. 2013.12.09 08:49 

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

Over the past six months since the release of the public build 509, we put in a lot of effort to improve all the components of MetaTrader 4 online trading system. MQL4 programming language for developing trading strategies has undergone the most significant changes. These changes have provided new features for developing trading robots and made possible the launch of MetaTrader 4 Market - secure app store for MetaTrader 4 terminal.

We start the public test of the new MetaTrader 4 terminal and invite all traders to join it in order to try all its features and help developers to correct the errors.

Simply connect to special demo.metaquotes.net:444 server in order to update MetaTrader 4 client terminal to build 555.

After the public beta test is complete, the final build of the new MetaTrader 4 terminal will be released. You can find out what's new in MQL4 below the list of changes.

MetaTrader 4 Client Terminal build 555

  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: Changed the terminal data structure and storage location - now, the data of each installed terminal is stored in a separate terminal data folder.

    Since the release of MetaTrader 4 platform in 2005, selected terminal installation directory was also the place where all data necessary for work (terminal logs, templates, profiles, quotes, etc.) has been stored. But with the release of Windows Vista in 2008, all Microsoft operating systems implement serious limitations of user privileges in order to protect them 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.

    Starting with Windows Vista, User Account Control (UAC) mechanism was introduced. The main idea of implementing the mechanism is that the application's unchangeable data stored in the installation directory should be separated from user's data modified by this application during its operation. Thus, all data of each user should be stored in a separate folder. You can find more information about UAC in Windows help or the Wikipedia article.

    In the new version all data of a certain user working with MetaTrader 4 terminal from a separate installation directory are stored in the 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.

    "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 reversely 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 and highly recommended for security reasons.

    The terminal can also be launched in the so-called portable mode (as in previous MetaTrader 4 builds). In that mode, the data is stored and recorded in the installation folder. To do this, 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. 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 processing 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: 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:




  6. 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.






  7. 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.






  8. 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.


  9. 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:







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



  11. 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.


  12. 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).



  13. Terminal: Added new graphical objects: Button, Bitmap, Bitmap Label and Rectangle Label. These objects cannot be manually installed on the charts and are designed for organizing a user interface for MQL4 applications: Expert Advisors, scripts and indicators.

  14. Terminal: Improved accuracy of the time displayed in the client terminal's Journal - milliseconds have been added.
  15. 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.
  16. Terminal: Added ability to copy to clipboard on Company tab.
  17. Terminal: Fixed arranging chart windows by commands.
  18. Terminal: Fixed saving profiles when switching between full-screen charts.
  19. Terminal: Fixed display of a number of dialogs when using the Japanese interface.
  20. Terminal: All client terminal components require support for SSE2 instruction set by PC's processor for efficient operation and high performance.
  21. Terminal: Optimized scanning for the best access point.
  22. Terminal: Fixed looping errors that occurred during the update in case of refusal from elevating the rights when using UAC.
  23. Terminal: Fixed display of the news header and contents, as well as of internal emails using UTF-8 encoding.
  24. 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.
  25. Terminal: Updated the list of countries in the appropriate dialog when opening a demo account.
  26. Terminal: Updated and enhanced translation of the interface into Swedish, Hungarian, Japanese, Italian and Bulgarian.
  27. 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.




  28. 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.

  29. Signals: Added display of the number of new trading signals submitted over the past 3 days on the signals tab.
  30. 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.
  31. 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.
  32. 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.
  33. Signals: Added History and Reviews tabs to the information about a trading signal.
  34. Signals: Added signal's rating column to the signal list.
  35. Signals: Removed display of tickets of signal's orders and positions from the information about a trading signal.
  36. Signals: Fixed an error of trading signals synchronization that occasionally occurred in case of the large number of unidirectional positions having the same volume.
  37. Signals: Added automatic conversion of trading symbols GOLD <=> XAUUSD and SILVER <=> XAGUSD.
  38. Signals: Added prohibition to subscribe to trading signals for the accounts compatible with NFA FIFO regulations.
  39. Signals: Fixed subscription to signals when working under Wine (Linux and Mac).
  40. Tester: Fixed consideration of a tick spread set in the testing parameters when optimizing using a tick cache.
  41. Fixed errors reported on the forum and in crash logs.


MetaTrader 4 MultiTerminal build 555

  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. Improved accuracy of the last quote's time displayed in Market Watch and Popup Prices windows.
  4. Fixed display of the news header and contents, as well as of internal emails 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 live update is available through the LiveUpdate system.


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

  • 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 types 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.
  • Predefined Volume variable is now of ulong type. The time series for accessing the volumes also consist of ulong 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 predefined OnTimer(), OnChartEvent() and OnTester() handler functions have been implemented. In the previous MQL4, predefined functions could have any parameters and any return type, and they could be called by their names, not signatures. In the new MQL4, all predefined functions should strictly correspond to their signatures. In other words, they should have precisely defined set of parameters and 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.
  • ArrayCopyRates() has also changed its behavior. Instead of virtual copying to double[][6] array, it now 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.
  • 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 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() have been remained intact for compatibility,
while new OnInit(), OnStart(), OnCalculated, OnTick(), OnTimer(), OnChartEvent(), OnTester() and OnDeinit() should strictly correspond to 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 provide 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.

cyclops993
115
cyclops993 2013.12.09 17:11  

Old .ex4 files still don't reliably re-initialize and get ticks when a chart's period (or symbol) is changed. Sometimes it works. But most of the time there is a call to deinit(), and then... nothing. No new call to init(), and no new calls to start().

New .ex4 files are okay, but often - again not always - there are two calls to OnDeinit() and two calls to OnInit() when an EA is reloaded because of a period change.

Mladen Rakic
54751
Mladen Rakic 2013.12.09 17:58  

An example

First the "_master string" indicator

#property indicator_chart_window
#property indicator_buffers 1

extern string param = "whatever I pass";
double firstBuffer[];

int init()   { SetIndexBuffer(0,firstBuffer); return(0); }
int deinit() {                                return(0); }
int start ()
{
   firstBuffer[0] = iCustom(NULL,0,"_slave string",param,0,0);
   return(0);
}

And the "_slave string" indicator

#property indicator_chart_window
#property indicator_buffers 1

extern string dummy = "I am in a called indicator";

double firstBuffer[];

int init()   { SetIndexBuffer(0,firstBuffer); return(0); }
int deinit() {                                return(0); }
int start()
{
   firstBuffer[0] = 0; Comment("from a slave : "+dummy);
   return(0);
}

When you run the "_master string" indicator as a result you will get an empty string that was "passed" to the "slave" indicator. Did anybody actually test the beta at all? Not a single iCustom() call with string parameters will work. Which means that any code depending on such indicators is worthless. And this is just one example of what happens when you try to use just the iCustom() call. If things like these are not correct, what can we expect from stuff that is more complicated?

Ex Ovo Omnia
3156
Ex Ovo Omnia 2013.12.09 20:20  
mladen:

An example

First the "_master string" indicator

And the "_slave string" indicator

When you run the "_master string" indicator as a result you will get an empty string that was "passed" to the "slave" indicator. Did anybody actually test the beta at all? Not a single iCustom() call with string parameters will work. Which means that any code depending on such indicators is worthless. And this is just one example of what happens when you try to use just the iCustom() call. If things like these are not correct, what can we expect from stuff that is more complicated?


Well, I bet that the IndicatorCreate() does not have the problem... It may be better to avoid stuff from the recent MQL4 and prefer the MQL5 equivalents, they look more mature in the current build.

But it does not mean that I excuse the malfunction - once it is implemented and released, it must pass tests.
Jon Grah
367
Jon Grah 2013.12.09 21:04  

MetaQuotes:

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

Is there a 'refresh' button or right-click option in the navigator that allows users to add expert advisors, indicators, etc and have them show up in the list without having to restart the terminal? This is very annoying in old mt4 to have to restart a terminal only to show new indicator. I should be able to refresh the display and mt4 can search the experts [sub]folders and return/remove any new EAs

And what happens if the user installs the program outside of the 'program files' folder? are they forced to use the '/portable' switch in order to keep user added material and logs in one folder? I always installed mt4 outside of the program files folder and I never had UAC issues. Everything is in one folder.

-----

Congrats outside of this. This is quite a significant improvements made to mt4. No multiprocessor support, and symetric order processing on the same symbol. But we will see what happens.

Ex Ovo Omnia
3156
Ex Ovo Omnia 2013.12.09 22:05  

Fix needed: Within an indicator source, if there are both OnStart() and OnCalculate() (a single one) functions, the compiler fails with

I suppose that OnStart should be ignored in indicators the same way as it is in experts.

Mladen Rakic
54751
Mladen Rakic 2013.12.09 22:16  
Ovo:


Well, I bet that the IndicatorCreate() does not have the problem... It may be better to avoid stuff from the recent MQL4 and prefer the MQL5 equivalents, they look more mature in the current build.

But it does not mean that I excuse the malfunction - once it is implemented and released, it must pass tests.

Don't understand me wrong. If I want metatrader 5 then I code using metatrader 5. But when I use metatrader 4 I do not want to use metatrader 5 (for more than one reason). If metatrader 4 is going to be discontinued then they should say so and we all can make our decisions and find ourselves convenient trading platforms. But having something done half way (and half functional) is not good for anybody (mainly it is not good for metaquotes)
cyclops993
115
cyclops993 2013.12.09 22:27  

BTW, the MetaQuotes email to brokers says that the launch date for this is "mid-January".

A lot of work still to do...

Ex Ovo Omnia
3156
Ex Ovo Omnia 2013.12.10 06:19  
mladen:

Don't understand me wrong. If I want metatrader 5 then I code using metatrader 5. But when I use metatrader 4 I do not want to use metatrader 5 (for more than one reason). If metatrader 4 is going to be discontinued then they should say so and we all can make our decisions and find ourselves convenient trading platforms. But having something done half way (and half functional) is not good for anybody (mainly it is not good for metaquotes)

I do agree. But I am not a fan of mql5. I just wanted to point out, that they replaced mql4 by mql5, and added a new (??) implementation of the old set of mql4 functions. So I would expect more bugs in the original mql4 set, which I am trying to avoid right now. I do not want to be a volunteer beta-tester, I only need it working.
Ian Venner
2584
Ian Venner 2013.12.10 07:03  

ENUM_APPLIED_PRICE still not recognised by the compiler.

Ahmad Mehdiyev
478
Ahmad Mehdiyev 2013.12.10 07:26  
Being conservative is good in morals and maybe politics but not in business. Wait a little and you will see all the benefits of this move. There will be options and opportunities that were not there in mt4, making both programming and, more importantly, trading much more efficient. I am personally working on a product that would have been impossible before.
12345678...14
To add comments, please log in or register