MetaTrader 5 build 1860: MQL5 functions for operations with bars and Strategy Tester improvements

MetaTrader 5新功能

15 六月 2018

Terminal

  1. The account opening dialog has been completely redesigned. Now, you may select a broker from the list and then choose the desired account type. This update has made the list of brokers more compact, since now it only displays company names instead of showing all available servers.

    Company logos are additionally shown in the list to make the search easier and more efficient. If the desired broker is not shown in the list, type the company name or the server address in the search box and click "Find your broker".




    Descriptions of account types have been added to the dialog to help beginners choose the right account. Also, to align with the General Data Protection Regulation (GDPR), the updated dialog may contain links to brokers' agreements and data protection policies:




    The possibilities for opening real accounts have been significantly expanded. The functionality for uploading ID and address confirmation documents, which was earlier presented in mobile terminals, is now available in the desktop version. Now, MiFID regulated brokers can request any required client identification data, including information on employment, income, trading experience, etc. The new functionality will help traders to open real accounts faster and easier, without unnecessary bureaucratic procedures.




  2. The history of deals now displays the values of Stop Loss and Take Profit. Stop Loss and Take Profit values for entry and reversal deals are set in accordance with the Stop Loss and Take Profit of orders, which initiated these deals. The Stop Loss and Take Profit values ​​of appropriate positions as of the time of position closing are used for exit deals. The latter allows saving and showing information about Stop Loss and Take Profit of a position as of the moment of its closure. This information was not stored in earlier versions, since positions disappear after closure, while the history of positions in the terminal is generated based on deals.




  3. The history of positions now displays the values of Stop Loss and Take Profit. Stop Loss and Take profit values of deals, which open and close appropriate positions, are specified for such positions.




  4. Now, the current volume of pending orders is shown on the chart, instead of the initially requested volume.




  5. The updated terminal features optimized and faster rendering of the Market Depth feature in the extended mode with the enabled spread display.
  6. Processing of trade request execution results has been optimized. This optimizations leads to a much faster processing in some cases.
  7. Fixed error in Trailing Stop operation, which could occasionally lead to sending of several Stop Loss modification requests for the same position.
  8. Fixed setting of minimum and maximum volume, as well as volume step in custom symbol settings.
  9. Fixed error, due to which the "Fix Scale" option could be ignored, when applying a template to a symbol chart.
  10. Fixed occasional incorrect accumulation of tick history.

MQL5

  1. The speed of MQL5 applications has increased due to the additional source code optimization during compilation. Recompile your programs in the new MetaEditor version to make them run faster.
    Unfortunately, new programs will not be compatible with previous terminal versions due to this additional optimization. Programs compiled in MetaEditor version 1860 and later cannot be launched in terminal versions below 1860. Programs compiled in earlier MetaEditor versions can run on new terminals.

  2. New functions: iTime, iOpen, iHigh, iLow, iClose, iVolume, iBars, iBarShift, iLowest, iHighest, iRealVolume, iTickVolume, iSpread. These functions are similar to those used in MQL4. The functions provide for an easier transfer of code of trading applications to the fifth generation platform.

    Earlier, most of tasks performed through these functions could be implemented using Copy* functions. However, users had to implement their own functions in order to find the High/Low values ​​on the chart and to search for bars based on their time. Now, these tasks can be easily executed using iHighest, iLowest and iBarShift functions.

    iTime
    Returns the Open time of the bar (indicated by the 'shift' parameter) on the corresponding chart.
    datetime  iTime(
       string           symbol,          // Symbol
       ENUM_TIMEFRAMES  timeframe,       // Period
       int              shift            // Shift
       );

    iOpen
    Returns the Open price of the bar (indicated by the 'shift' parameter) on the corresponding chart.
    double  iOpen(
       string           symbol,          // Symbol
       ENUM_TIMEFRAMES  timeframe,       // Period
       int              shift            // Shift
       );

    iHigh
    Returns the High price of the bar (indicated by the 'shift' parameter) on the corresponding chart.
    double  iHigh(
       string           symbol,          // Symbol
       ENUM_TIMEFRAMES  timeframe,       // Period
       int              shift            // Shift
       );

    iLow
    Returns the Low price of the bar (indicated by the 'shift' parameter) on the corresponding chart.
    double  iLow(
       string           symbol,          // Symbol
       ENUM_TIMEFRAMES  timeframe,       // Period
       int              shift            // Shift
       );

    iClose
    Returns the Close price of the bar (indicated by the 'shift' parameter) on the corresponding chart.
    double  iClose(
       string           symbol,          // Symbol
       ENUM_TIMEFRAMES  timeframe,       // Period
       int              shift            // Shift
       );

    iVolume
    Returns the tick volume of the bar (indicated by the 'shift' parameter) on the corresponding chart.
    long  iVolume(
       string           symbol,          // Symbol
       ENUM_TIMEFRAMES  timeframe,       // Period
       int              shift            // Shift
       );

    iBars
    Returns the number of bars of a corresponding symbol and period, available in history.
    int  iBars(
       string           symbol,          // Symbol
       ENUM_TIMEFRAMES  timeframe        // Period
       );

    iBarShift
    Search bar by time. The function returns the index of the bar corresponding to the specified time.
    int  iBarShift(
       string           symbol,          // Symbol
       ENUM_TIMEFRAMES  timeframe,       // Period
       datetime         time,            // Time
       bool             exact=false      // Mode
       );

    iLowest
    Returns the index of the smallest value found on the corresponding chart (shift relative to the current bar).
    int  iLowest(
       string           symbol,          // Symbol
       ENUM_TIMEFRAMES  timeframe,       // Period
       int              type,            // Timeseries identifier
       int              count,           // Number of elements
       int              start            // Index
      );

    iHighest
    Returns the index of the largest value found on the corresponding chart (shift relative to the current bar).
    int  iHighest(
       string           symbol,          // Symbol
       ENUM_TIMEFRAMES  timeframe,       // Period
       int              type,            // Timeseries identifier
       int              count,           // Number of elements
       int              start            // Index
      );

    iRealVolume
    Returns the real volume of the bar (indicated by the 'shift' parameter) on the corresponding chart.
    long  iRealVolume(
       string           symbol,          // Symbol
       ENUM_TIMEFRAMES  timeframe,       // Period
       int              shift            // Shift
       );

    iTickVolume
    Returns the tick volume of the bar (indicated by the 'shift' parameter) on the corresponding chart.
    long  iTickVolume(
       string           symbol,          // Symbol
       ENUM_TIMEFRAMES  timeframe,       // Period
       int              shift            // Shift
       );

    iSpread
    Returns the spread value of the bar (indicated by the 'shift' parameter) on the corresponding chart.
    long  iSpread(
       string           symbol,          // Symbol
       ENUM_TIMEFRAMES  timeframe,       // Period
       int              shift            // Shift
       );

  3. New TesterHideIndicators function has been added. The function sets the show/hide mode for indicators used in Expert Advisors. The function is intended for managing the visibility of used indicators only during testing. Set to true if you need to hide created indicators. Otherwise use false.
    void  TesterHideIndicators(
       bool      hide     // Flag
       );
  4. Added generation of the CHARTEVENT_CLICK event at a click on trade levels on the chart.
  5. Fixed and optimized operation of CopyTicks functions.
  6. Fixed value returned by the SymbolInfoDouble function for the SYMBOL_PROP_LIQUIDITY_RATE property.
  7. Fixed copying of string arrays with overlapping memory.
  8. Fixed allocation of a string array in the FileReadArray array.
  9. Fixed errors in the MQL5 Standard Library.

Tester

  1. The system for working with the optimization cache has been updated. The cache stores data about previously calculated optimization passes. The strategy tester stores the data to enable resuming of optimization after a pause and to avoid recalculation of already calculated test passes.

    Changes in the optimization cache storage format
    In earlier versions, optimization cache was stored as one XML file. All Expert Advisor optimization passes with the specified testing settings were added to this file. Therefore, the same file stored results of optimizations with different input parameters.
    Now, the optimization cache is stored as separate binary files for each set of optimized parameters. Strategy Tester operations involving the optimization cache have become significantly faster due to the new format and smaller file size. The acceleration can be especially noticeable when you resume a paused optimization pass.

    Viewing results of earlier optimizations
    Now, the results of earlier optimizations can be viewed right in the Strategy Tester, so there is no need to analyze huge XML files using third-party software. Open the "Optimization results" tab, select an Expert Advisor and a file with the optimization cache:



    The list contains all optimization cache files existing on the disk for the selected Expert Advisor. Optimization date, testing settings (symbol, timeframe, interval) and input parameters are shown for each file. You can additionally filter optimization results by the trade server, on which the results were obtained.

    Recalculation of the optimization criterion on the fly
    An optimization criterion is a certain variable parameter, the value of which determines the quality of a tested set of inputs. The higher the value of the optimization criterion, the better the testing result with the given set of parameters is considered to be.

    Earlier, only one criterion selected before optimization start was calculated during optimization. Now, you can change the optimization criterion on the fly when viewing results, and the Strategy Tester will automatically recalculate all values.




    Manual use of the optimization cache
    In earlier versions, optimization cache was stored as an XML file, which could be opened and analyzed using third-party software. Now it is stored in closed binary files. To get data in XML format, export them using the context menu of the "Optimization Results" tab.

  2. Added possibility to manually set the deposit currency and leverage for testing and optimization. In earlier versions, the currency was set in accordance with the connected account. Therefore, one had to switch to other accounts in order to change the currency. The leverage size could only be selected from a predefined list, now any value can be specified.

    Please note that cross rates for converting profit and margin to the specified deposit currency must be available on the account, to ensure proper testing.




  3. Removed ban on the use of OpenCL in testing agents. Earlier, OpenCL devices were only allowed when testing on local agents. Now, agents are allowed to use all available OpenCL devices (such as processor, video card) when working in the local network and in the MQL5 Cloud Network.

    MetaEditor

  1. Optimized and accelerated work with the MQL5 Storage.
  2. Fixed resuming of debugging process after a pause in the MQH file.
  3. Fixed source code highlighting in the editor.
  4. Fixed navigation through search results.
  5. Fixed mass text replace function. In some cases, only the first occurrence was replaced instead of all of them.

Documentation has been updated.