MetaTrader 5 platform beta build 2155: MQL5 scope, global Strategy Tester and built-in Virtual Hosting updates

 

The beta version of the updated MetaTrader 5 platform will be released on September 20, 2019. We invite traders to join the testing of the new platform, to evaluate all its features and to help developers fix errors.

To update the MetaTrader 5 platform up to build 2155, navigate to Help \ Check Desktop Updates \ Latest Beta Version:


The final build of the new MetaTrader 5 platform will be released after the public beta testing.

The new version features the following changes:

  1. Terminal: Completely redesigned built-in Virtual Hosting management options. All information about the rented terminal, as well as environment migration, stop and start functions, are now available in a separate tab of the Toolbox window.

    In earlier versions, Virtual Hosting functions were available in the context menu of the Navigator window. Now all the necessary information and control commands are conveniently arranged in the "VPS" tab:




    Basic subscription information appears on the left side:

    • Connection data: comparison of network delays between your terminal on the hosting server and a terminal running on a local PC.
    • Trading account for which hosting was rented and the payment plan.
    • Unique subscription identifier. A click on the ID opens the Hosting section in the MQL5.community user profile, from which subscription can be managed.
    • Registration date and current state. If the hosting service is stopped, an appropriate status will instantly appear here.

    Using the Start/Stop button, the virtual terminal can be quickly started or stopped.

    Data about hosting server hardware and CPU consumption charts are displayed in the right window part. Based on the displayed information, you will be able to respond in a timely manner if your Expert Advisor or indicator uses excessive memory or CPU time.

    Information about the last trading environment migration as well as migration commands are also available here. These commands enable fast environment migration after purchasing a subscription.

    A virtual platform can be rented from the "VPS" tab. The renting process has not changed and is still fast and easy. You only need to select a plan and a suitable payment method. The best server for connecting to your broker will be selected automatically.




  2. Terminal: Added ability to quickly switch to deposit/withdrawal operations on the broker website.

    There is no need to search for appropriate functions in a trader's room on the broker site. Fast navigation commands are available directly in terminals: in the accounts menu in Navigator and in Toolbox > Trade tab:



    • Deposit/withdrawal operations are only available if appropriate functions are enabled for the trading account on the broker side.
    • The trading terminal does not perform any account deposit/withdrawal operations. The integrated functions redirect the user to the appropriate broker website pages.
  3. Terminal: New fields in the trading symbol specification:

    Category
    The property is used for additional marking of financial instruments. For example, this can be the market sector to which the symbol belongs: Agriculture, Oil & Gas and others. The category is displayed only of the appropriate information is provided by the broker.

    Exchange
    The name of the exchange in which the security is traded. The exchange name is displayed only if the appropriate information is provided by the broker.

    Commissions
    Information on commissions charged by a broker for the symbol deals. Calculation details are displayed here:

    • Commission may be single-level and multilevel, i.e. be equal regardless of the deal volume/turnover or can depend on their size. Appropriate data is displayed in the terminal.
    • Commission can be charged immediately upon deal execution or at the end of a trading day/month.
    • Commission can be charged depending on deal direction: entry, exit or both operation types.
    • Commission can be charged per lot or deal.
    • Commission can be calculated in money, percentage or points.

    For example, the following entry means that a commission is charged immediately upon deal entry and exit. If the deal volume is from 0 to 10 lots, a commission of 1.2 USD is charged per operation. If the deal volume is 11 to 20 lots, a commission of 1.1 USD is charged per each lot of the deal.
    Commission | Instant, volume, entry/exit deals
    0  - 10  | 1.2 USD per deal
    11 - 20  | 1.1 USD per lot



  4. Terminal: The Crosshair tool now shows the distance between price levels in percentage, in addition to previously available pips:




  5. Terminal: Added the display of a resulting price in trading dialogs during Market and Exchange execution operations, if this price is available at the time a response is received from the broker:




  6. Terminal: Fixed occasional error due to which the "Show All" command in the Market Watch window could fail to show the list of all available trading instruments.

  7. MQL5: The scope operation has been revised and thus MQL5 has become even closer to C++. This provides MQL5 programmers with wider possibilities in operations with third-party libraries. The update eliminates the need to modify libraries and to unify identifiers.

    Example: Code contains declaration of two structures with the same name, which though belong to different classes. In earlier versions such declaration produced a compilation error: "identifier already used". Now this code will be successfully compiled and executed. For a proper access to the desired variable/structure/function from outside of its scope, you should specify a class (in this case it is CBar::Item).
    class CFoo
      {
    public:
       struct Item { int x; };
      };
    //+------------------------------------------------------------------+
    class CBar
      {
    public:
       struct Item { int x; };
      };
      
    CBar::Item item;  // proper declaration of the Item structure from the Bar class
    Item       item;  // incorrect declaration
    Added namespace support which provides more possibilities when using third-party code/libraries in MQL5 applications.

    #define PrintFunctionName() Print(__FUNCTION__)
    
    namespace NS
    {
    void func()
      {
       PrintFunctionName();
      }
    
    struct C
      {
       int               x;
                         C() { PrintFunctionName(); };
      };
    }
    
    struct C
      {
       int               x;
                         C() { PrintFunctionName(); };
      };
    
    //+------------------------------------------------------------------+
    //|                                                                  |
    //+------------------------------------------------------------------+
    void func()
      {
       PrintFunctionName();
      }
    //+------------------------------------------------------------------+
    //| Script program start function                                    |
    //+------------------------------------------------------------------+
    void OnStart()
      {
       func();
       NS::func();
    
       C c;
       NS::C ac;
      }
    As a result of execution the following result is output:
    2019.09.18 13:39:35.947    TestScript (AUDCAD,H1)    func
    2019.09.18 13:39:35.949    TestScript (AUDCAD,H1)    NS::func
    2019.09.18 13:39:35.949    TestScript (AUDCAD,H1)    C::C
    2019.09.18 13:39:35.949    TestScript (AUDCAD,H1)    NS::C::C

  8. MQL5: New version features faster access to timeseries data using the following function: iTime, iOpen, iHigh, iLow, iClose, iVolume, iTickVolume, iSpread.

  9. MQL5: Added support for the "=delete" attribute. It allows prohibiting the use of certain class methods.
    class A
      {
       void              operator=(const A &)=delete;    // prohibit object copying operator
      };
    
    class B : public A
      {
      };
    
    //+------------------------------------------------------------------+
    //| Script program start function                                    |
    //+------------------------------------------------------------------+
    void OnStart()
      {
       A a1,a2;
       B b1,b2; 
      
       a1=a2;
       b1=b2;
      }
    In this example, the compiler will return errors for "a1=a2" and "b1=b2":
    attempting to reference deleted function 'void A::operator=(const A&)'
       function 'void A::operator=(const A&)' was explicitly deleted here

    attempting to reference deleted function 'void B::operator=(const B&)'
       function 'void B::operator=(const B&)' was implicitly deleted because it invokes deleted function 'void A::operator=(const A&)'

  10. MQL5: The following values have been added to the ENUM_SYMBOL_INFO_STRING enumeration:

    • SYMBOL_CATEGORY — symbol category. It is used for additional marking of financial instruments. For example, this can be the market sector to which the symbol belongs: Agriculture, Oil & Gas and others.
    • SYMBOL_EXCHANGE — the name of the exchange in which the symbol is traded.

  11. MQL5: Added support for position closure by FIFO rule.

    • ACCOUNT_FIFO_CLOSE value has been added to ENUM_ACCOUNT_INFO_INTEGER. It indicates that positions can be closed only by FIFO rule. If the property value is true, then positions for each instrument can only be closed in the same order in which they were opened: the oldest one should be closed first, then the next one, etc. In case of an attempt to close positions in a different order, an error will be returned. The property value is always 'false' for accounts without hedging position management (ACCOUNT_MARGIN_MODE!=ACCOUNT_MARGIN_MODE_RETAIL_HEDGING).
    • New return code: MT_RET_REQUEST_CLOSE_ONLY — the request is rejected, because the rule "Only closing of existing positions by FIFO rule is allowed" is set for the symbol

    There are three main methods to close a position; the rule behavior will be different for each of the methods:

    • Closing from the client terminal: the trader closes the position manually, using a trading robot, based on the Signals service subscription, etc. In case of an attempt to close a position, which does not meet the FIFO rule, the trader will receive an appropriate error.
    • Closing upon Stop Loss or Take Profit activation: these orders are processed on the server side, so the position closure is not requested on the trader (terminal) side, but is initiated by the server. If Stop Loss or Take Profit triggers for a position, and this position does not comply with the FIFO rule (there is an older position for the same symbol), the position will not be closed.
    • Closing upon Stop Out triggering: such operations are also processed on the server side. In a normal mode, in which FIFO-based closing is disabled, in case of Stop Out positions are closed starting with the one having the largest loss. If this option is enabled, the open time will be additionally checked for losing positions. The server determines losing positions for each symbol, finds the oldest position for each symbol, and then closes the one which has the greatest loss among the found positions.

  12. MQL5: Fixed import of DLL functions with names matching MQL5 function names. Example:
    #import "lib.dll"
    int func();
    #import
    //+------------------------------------------------------------------+
    //|                                                                  |
    //+------------------------------------------------------------------+
    int func()
      {
       return(0);
      }
    //+------------------------------------------------------------------+
    //| Script program start function                                    |
    //+------------------------------------------------------------------+
    void OnStart()
      {
       Print(func());
      }
    In earlier version, the following error was returned during compilation:
    'func' - ambiguous call to overloaded function with the same parameters
    could be one of 2 function(s)
       int func()
       int func()
    Now, instead of the error, the built-in MQL5 function with a higher priority will be used by default. The imported function can be called by explicitly specifying the scope:
    void OnStart()
      {
       Print( lib::func() );
      }
  13. MQL5: Fixed specification of time in economic calendar news. Now events are delivered taking into account the time zone of the trade server to which the terminal is connected, instead of the local computer time zone.
  14. Signals: Fixed display of signal charts when working in Wine (Mac OS and Linux).
  15. Tester: Big Strategy Tester update. New start page, redesigned settings page, improved usability.

    Start page
    Now, after tester launch, instead of multiple settings the user sees a list of standard tasks, by selecting which they can quickly start testing. The new design is primarily intended for unexperienced users.

    We have selected the most frequent strategy testing and optimization tasks and have added them to the start page. In addition, one of the previously performed tasks can be restarted from the start page. If you have run a lot of tasks and they do not fit into the start page, use the search bar. You can find a test by any parameter: program name, symbol, timeframe, modeling mode, etc.




    Hiding irrelevant parameters
    After selecting a task, the user proceeds to further testing parameters: selection of an Expert Advisor, symbol, testing period, etc. All irrelevant parameters which are not required for the selected tasks are hidden from the setup page. For example, mathematical calculations are selected, only two parameters should be specified: selection of a program to be tested and the optimization mode. Testing period, delay and tick generation settings will be hidden.




    Convenient testing setup
    For convenience some of the parameters on the setup page have been rearranged. Extended explanations have been added for the delay and visualization parameters. In addition, testing settings can now be saved and uploaded manually, and thus a trader can quickly return to previous settings.





    Using the same tab you can quickly open the program for editing in MetaEditor.

    Profit calculation in pips
    Using the settings, you can enable profit calculation in pips. This mode accelerates testing while there is no need to recalculate profit to deposit currency using conversion rates (and thus there is no need to download the appropriate price history). Swap and commission calculations are eliminated in this mode.



    Please note that when calculating profit in pips, the deal volume does not matter. Only the number of won/lost pips is calculated for each deal. Also margin control is not performed in this mode. Use it only for quick and rough strategy estimation and then check the obtained results using more accurate modes.

    General improvements
    Testing start/stop button and progress bar have been moved to the tabs bar. Thus, the user can control the process from any Strategy Tester section. Testing start/stop commands have also been added to context menus of settings and inputs sections.




  16. Tester: The optimization chart can now be displayed in the main working area of the terminal. A new visualization system has been added for 3D charts:




  17. Tester: Added saving of optimization cache for the "All symbols in Market Watch" mode.
  18. Tester: Added saving of test cache.

    In earlier versions, executed task results were saved to files only when optimizing Expert Advisors. Now, cache files are also saved during single tests, allowing you to return to previous calculations and to view statistics, balance, equity and deposit loading graphs, at any time. In future releases, this option will enable comparison of testing results.

    To load previous test results, use the new Tester start page: click "Previous results" and select the desired site:




  19. Tester: Significantly accelerated testing and optimization, including operations performed using the MQL5 Cloud Network.
  20. Tester: Fixes and optimized operation with frames.
  21. MetaEditor: Added ability to configure code styler.

    The MetaEditor includes a built-in code styler, which enables automatic formatting of program text in accordance with the adopted standard. Now in addition to common style, you can use other popular standards. To do this, open MetaEditor settings and select the desired style:




    The following parameters can be additionally set for the styler:

    Spaces per indent
    Sets the number of spaces used in aligning of nested constructions:
    if(condition)
      {
       //---
      }

    Replace tabs with spaces
    If this option is enabled, the styler will replace all tabs in the code with spaces. The number of characters per tab is set in the General section.

    Delete empty lines
    When this option is enabled, the styler will delete all lines having only a line break character.

    Insert spaces after commas and semicolons
    When this option is enabled, the styler will visually separate constructions with element enumerations. Example:
    // before styling
    ParameterGetRange("InpX",enable,x_cur,x_start,x_step,x_stop);
    // after styling
    ParameterGetRange("InpX", enable, x_cur, x_start, x_step, x_stop);

    Insert spaces around declaration operators
    When this option is enabled, the styler will insert spaces around the assignment, equality, comparison, and other operators. Example:
    // before styling
    if(x==1&y!=2)
      {
       int a=0;
      }
    // after styling
    if(x == 1 & y != 2)
     {
      int a = 0;
     }

  22. MetaEditor: "Show in Navigator" command has been added to the file bookmarks context menu. Thus, the user can easily find a file opened for editing among the editor's folder structure.




  23. MetaEditor: Fixed display of the 'union' keyword in tooltips.
  24. The user interface has been additionally translated into Georgian.
  25. Documentation has been updated.

The update will be available through the Live Update system.

 

21. MetaEditor: Added ability to configure code styler.

Is it possible to fix that behaviour please :

// Original 
  if(condition1)
   {
   }
  else if(condition2)
   {
   }
  else if(condition3)
   {
   }
  else
   {
   }

Become :

// After styler applied (Metaquotes style)
  if(condition1)
   {
   }
  else
    if(condition2)
     {
     }
    else
      if(condition3)
       {
       }
      else
       {
       }

There should not have additional indentation here.

See also this example, which is even worst.

//---
   int try
         =3;
   while(try
            >0)
        {
         try
            --;
         if(try
               ==2)Print("i==2");
        }

I can't imagine you will say it's a feature !

Tested with ME build 2146.

 

Here is an other one, only 1 space when you set 2 (or 2 if you set 3, etc...) :

All in all the Styler is now, more or less, became unusable. Please fix it.

 

Dear MetaQuotes Software Corp.!

I make software development and I want to make a report about an error issue with the MQL5 programming language. Please submit my report to the MetaTrader 5 and MQL5 software developer team! Many thanks for considering my request! The following code is not compilable and the preprocessor and the compiler do not operate as the programmers expect. The code example is the following.

#define p_paste(arg_0, arg_1, arg_2) arg_0##arg_1##arg_2
#define p_evaluate_paste(arg_0, arg_1, arg_2) p_paste(arg_0, arg_1, arg_2)
#define apple 11
#define mouse 12
#define table 13

void f()
{
    int i = 10 + p_evaluate_paste(apple, mouse, table);
    PrintFormat("%d\n", i);
    return;
}

This code is not compilable. The compiler error message is: "'111213' - undeclared identifier". This is not an identifier but just an integer literal. This does not have to be a valid identifier token. This is an obvious error of the implementation of the preprocessor. With GNU CPP this kind of programming constructions are compilable. I have a huge and bigger and bigger MQL5 software framework for my trading system and I could not compile some of my solutions with concatenating just an `arg_type' and a `&' to create a plain reference variable for objects. Please fix this issue ASAP! Many thanks for considering my request! Please, please, finish the implementation of the multiple inheritance from interfaces facilities ASAP! This is important for the future achievements. MetaTraders are otherwise excellent products and I have installed 250 instances in my virtual machine of the MetaTrader 5 client application. I would like to operate serious trading with your and my softwares.

Yours faithfully and best wishes: László Müller (voyevoda), Dombóvár, Hungary.

 
Dear MetaQuotes Software Corp.!

Please implement the `typedef' and `using' features. This would be very usable with
complex template instantiations. This is a must for usable template programming.
Many thanks for considering my request!

Yours faithfully and best wishes: László Müller (voyevoda), Dombóvár, Hungary.


 
Dear MetaQuotes Software Corp.!

Please increase the maximum count of the entries in the server selector
subwindow of the MetaTrader 4 client terminal application software.
Perhaps this maximum currently was set to 120. I think the practically
unlimited number is much more appropriate. Please fix this issue in the
next release. You can fix this with some minutes of programming!

There is another issue with the MetaTrader 4 client terminal software
application. In the `Market Watch/Tick Chart' subwindow the graphical
plot of the fluctuating price charts is always limited to the first some

grid cells horizontally. Why? The plot should fill the entire plot region
of the subwindow.

Please fix these issues as soon as possible!

Many thanks for considering my request!

Yours faithfully and best wishes: László Müller, Dombóvár, Hungary.


 
Dear MetaQuotes Software Corp.!

I have another feature request now. Please implement some facility
with which a programmer can code file includes with multiple times
inside the translation unit. For example `#pragma include_multi'.
This is neccesary for some more complex programming solutions. In
C/C++ include files there are the "include guard" preprocessor directives
and the `#pragma once' pragmas. Please, please implement this small
feature. This is a must for some source code generation automation.

Many thanks for considering my request!

Yours faithfully and best wishes: László Müller, Dombóvár, Hungary.


 
Dear MetaQuotes Software Corp.!

It would be very useful if we can programming with non-type template arguments like
integer literals and compilation time computable expressions of them. For example
for arrays and template metaprogramming. Please implement these facilities for the

MQL4 and MQL5 programming languages.

Many thanks for considering my request!

Yours faithfully and best wishes: László Müller, Dombóvár, Hungary.

 

Dear MetaQuotes Software Corp.!

I think that your developers must implement the functions of the MQL preoprocessor
as the C/C++ CPP functions. With the following code snippet the second macro for the
indirection is now not necessary.

#define p_paste(arg_0, arg_1, arg_2) arg_0##arg_1##arg_2
#define p_evaluate_paste(arg_0, arg_1, arg_2) p_paste(arg_0, arg_1, arg_2)
#define apple 11
#define mouse 12
#define table 13

void f()
{
    int i = 10 + p_evaluate_paste(apple, mouse, table);
    PrintFormat("%d\n", i);
    return;
}

After the recent updates the `p_evaluate_paste' macro is not necessary anymore.
But why? Now it is not possible to pass for example the `apple' argument as a string
to a macro without the replacement of it. The solution is not complete now and not
a good solution. You have to implement the MQL preprocessor facilities and functions
to operate similar as the facilities and functions of the C/C++ CPP, the C preprocessor.

Please consider this issue too! You have to program the preprocessor with the above
mentioned possibility. The correct solution is the usage for example the `p_paste' and
the `p_evaluate_paste' macros, whichever you need!

Please fix these issues as soon as possible! I have at least 400,000 lines of MQL code
in my ATS framework now and I have to program with some advanced features like
this.

Many thanks for considering my request!

Yours sincerely: László Müller, Dombóvár, Hungary.

 

Dear MetaQuotes Software Corp.!

There is another small issue with templates. Consider the following code snippet and create a
compilable `.mq4' or `.mq5' file with it. Why is the `main_1' not compilable? I think it should be.

#property strict

int func_0 (int x)
{
    return 5 + x;
}

int func_1(int x)
{
    return 8 + x;
}

typedef int (*funcs_type)(int);

template<typename value_type, typename func_0_type, typename func_1_type>
value_type apply(value_type x, func_0_type func_0, func_1_type func_1)
{
    return func_1(func_0(x));
}

//This is compilable with 0 errors, 0 warnings.
void main_0()
{
    funcs_type f_0 = func_0;
    funcs_type f_1 = func_1;
    int x = 10;
    PrintFormat("%d\n", apply(x, f_0, f_1));
    return;
}

//This is not compilable! Why it is necessary to
//create a function type with a `typedef' and to
//create 2 variables with that type? Please fix
//this issue!
void main_1()
{
    int x = 10;
    PrintFormat("%d\n", apply(x, func_0, func_1));
    return;
}

//This is not compilable! Just for trying something.
void main_2()
{
    int x = 10;
    PrintFormat("%d\n", apply(x, &func_0, &func_1));
    return;
}

Please fix these issues! With the template metaprogramming and the multiple inheritance
from interfaces your MQL4 and MQL5 languages (MQL) will be really useful with many many
functions and opportunities! This is a must.

Many thanks for considering my requests!

Yours sincerely and best wishes: László Müller, Dombóvár, Hungary.

 
László Müller:

Dear MetaQuotes Software Corp.!

There is another small issue with templates. Consider the following code snippet and create a
compilable `.mq4' or `.mq5' file with it. Why is the `main_1' not compilable? I think it should be.


Try casting the arguments...

void main_1()
{
    PrintFormat("%d\n", apply(10, (funcs_type)func_0, (funcs_type)func_1));
}
Reason: