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

Completely redesigned built-in Virtual Hosting management options. All information about the rented terminal, as well as environment migration, stop

5 October 2019

Terminal

  1. 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 under 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 the 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 hand side window section. Based on the displayed information, you will be able to respond in a timely manner if your Expert Advisor or indicator utilizes 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 it 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. 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. 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 if the appropriate information is provided by the broker.

    Exchange
    The name of the exchange in which the security is traded. The category 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 the 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 between 0 to 10 lots, a commission of 1.2 USD is charged per operation. If the deal volume is between 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. Additional options related fields have been added to symbol specification:

    • Option type — call or put
    • Underlying — the underlying symbol of the option
    • Strike price — option strike price

  5. Added support for the delivery of options "Greeks": delta, gamma, vega, theta, rho. Brokers can provide additional information related to such instruments. The data is displayed under the Details section of the Market Watch window and it can be used for advanced trade analysis:




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




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




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

MQL5

  1. The scope operation has been revised and thus MQL5 is 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 even though they belong to different classes. In earlier versions such a 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;
      }
    Upon execution the following result is displayed as 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

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

  3. Added support for the "=delete" attribute. It allows prohibition on 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&)'

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

  5. 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 the 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:

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

  6. Added options for parameter grouping via "input group". This enables visual separation of parameters based on their underlying logic.

    In the below Expert Advisor code,input parameters are grouped according to their purpose:
    input group           "Signal"
    input int             ExtBBPeriod    =20;         // Bollinger Bands period
    input double          ExtBBDeviation =2.0;        // deviation
    input ENUM_TIMEFRAMES ExtSignalTF    =PERIOD_M15; // BB timeframe
    
    input group           "Trend"
    input int             ExtMAPeriod    =13;         // Moving Average period
    input ENUM_TIMEFRAMES ExtTrendTF     =PERIOD_M15; // MA timeframe
    
    input group           "ExitRules"
    input bool            ExtUseSL       =true;       // use StopLoss
    input int             Ext_SL_Points  =50;         // StopLoss in points
    input bool            ExtUseTP       =false;      // use TakeProfit
    input int             Ext_TP_Points  =100;        // TakeProfit in points
    input bool            ExtUseTS       =true;       // use Trailing Stop
    input int             Ext_TS_Points  =30;         // Trailing Stop in points
    
    input group           "MoneyManagement"
    sinput double         ExtInitialLot  =0.1;        // initial lot value
    input bool            ExtUseAutoLot  =true;       // automatic lot calculation
    
    input group           "Auxiliary"
    sinput int            ExtMagicNumber =123456;     // EA Magic Number
    sinput bool           ExtDebugMessage=true;       // print debug messages
    When such an Expert Advisor is launched in the Strategy Tester, input parameter blocks can be collapsed or expanded by a double click on the group name, as well as all parameters within a group can be selected for optimization with a single check box.




  7. 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 versions, the following error 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() );
      }
  8. Fixed specification of time in economic calendar news. Now events are delivered by taking into account the time zone of the trade server to which the terminal is connected, instead of the local computer time zone.
  9. Fixed excessive memory consumption in the Copyticks and CopyTicksRange functions.

Signals

  1. Fixed display of signal charts when working in Wine (Mac OS and Linux).

Tester

  1. 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 we have added them in 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, if 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.




  2. The optimization chart can now be displayed in the main working area of the terminal, instead of displaying in a separate strategy tester section. This way, much more space becomes available for data analysis. The 3D visualization system has also been updated.

  3. Added saving of optimization cache for the "All symbols in Market Watch" mode.
  4. 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, using which users can return to previous calculations and 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:




  5. Significantly accelerated testing and optimization, including operations performed using the MQL5 Cloud Network.
  6. Fixes and optimized operations with frames.

MetaEditor

  1. 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;
     }

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




  3. Fixed display of the 'union' keyword in tooltips.

The user interface has been additionally translated into 18 new languages:

  • European Region — Swedish, Lithuanian, Danish, Latvian, Estonian, Serbian, Slovenian, Slovak, Finnish, Georgian
  • Asian region — Javanese, Marathi, Bengali, Punjabi, Tamil, Telugu
  • African Region — Swahili, Hausa

The platform interface is now available in 50 languages, which are spoken by more than 4 billion people.

To set you language for the interface, navigate to the "View / Language" menu at the top of the terminal.

Documentation has been updated.

Fixes based on crash logs.

The update will be available through the Live Update system.