New MetaTrader 5 Platform beta build 1845: MQL5 functions for operations with bars and Strategy Tester improvements

 

New MetaTrader 5 Platform beta build 1845: MQL5 functions for operations with bars and Strategy Tester improvements

The new beta version of the updated MetaTrader 5 platform will be released on June 8, 2018. We will update our public MetaQuotes-Demo server located at access.metatrader5.com:443. We invite all traders to join testing in order to evaluate updated platform features and help developers fix errors.

To update the MetaTrader 5 platform up to build 1845, connect to access.metatrader5.com server:443.

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

This platform update is only available for terminals running on Windows 7 and later operating systems. Earlier Windows versions are not supported.
It contains the following changes:
  1. Terminal: 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.

    To make the search even more convenient, company logos are additionally shown in the list. 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. MQL5: 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 1845 and later cannot be launched in terminal versions below 1845. Programs compiled in earlier MetaEditor versions can run on new terminals.

  3. MQL5: New functions: iTime, iOpen, iHigh, iLow, iClose, iVolume, iBars, iBarShift, iLowest, iHighest, iRealVolume, iTickVolume, iSpread. These functions are similar to those used in MQL4. These functions help users to easier transfer 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
       );

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



  5. Terminal: The updated terminal features optimized and faster rendering of the Market Depth feature in the extended mode with the enabled spread display.
  6. Terminal: Processing of trade request execution results has been optimized. This optimizations leads to a much faster processing in some cases.
  7. Terminal: Fixed error in Trailing Stop operation, which could occasionally lead to sending of several Stop Loss modification requests for the same position.
  8. Terminal: Fixed setting of minimum and maximum volume, as well as volume step in custom symbol settings.
  9. Terminal: Fixed error, due to which the "Fix Scale" option could be ignored, when applying a template to a symbol chart.
  10. Terminal: Fixed occasional incorrect accumulation of tick history.
  11. MQL5: New TesterHideIndicators function has been added. The function sets the show/hide mode of 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
       );
  12. MQL5: Added generation of the CHARTEVENT_CLICK event at a click on trade levels on the chart.
  13. MQL5: Fixed and optimized operation of CopyTicks functions.
  14. MQL5: Fixed value returned by the SymbolInfoDouble function for the SYMBOL_PROP_LIQUIDITY_RATE property.
  15. MQL5: Fixed copying of string arrays with overlapping memory.
  16. MQL5: Fixed allocation of a string array in the FileReadArray array.
  17. MQL5: Fixed errors in the MQL5 Standard Library.
  18. Tester: 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 optimization 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.

  19. Tester: Added possibility to manually set the deposit currency and leverage for testing and optimization. In earlier versions, these parameters were set in accordance with the connected account. Therefore, one had to connect to other accounts in order to change these parameters.

    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.



  20. Tester: 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.
  21. MetaEditor: Optimized and accelerated work with the MQL5 Storage.
  22. MetaEditor: Fixed resuming of debugging process after a pause in the MQH file.
  23. MetaEditor: Fixed source code highlighting in the editor.
  24. MetaEditor: Fixed navigation through search results.
  25. MetaEditor: Fixed mass text replace function. In some cases, only the first occurrence was replaced instead of all of them.
  26. Documentation has been updated.

The update is available through the LiveUpdate system.

 

build 1845

 
some function not work: iOpen, iClose, iHigh, iLow, iLowest, iHighest
 
Nguyen Nga:
some function not work: iOpen, iClose, iHigh, iLow, iLowest, iHighest

Do you have an example ?

What is the error ?

Please try replacing: 

   int              timeframe,       // Period

By:

   ENUM_TIMEFRAMES      timeframe = PERIOD_CURRENT;   // Period

Overall the support for these functions in MQL5 in a MQL4 fashion is a very, very large milestone.

It seems they finally listened to the community.

 

This is my scripts for testing, then you get wrong result.

#property copyright "Copyright 2016, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property script_show_inputs

//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---  
   Print("iOpen = " + iOpen(_Symbol,PERIOD_CURRENT,1));
   Print("iHigh = " + iHigh(_Symbol,PERIOD_CURRENT,1));
   Print("iLow = " + iLow(_Symbol,PERIOD_CURRENT,1));
   Print("iClose = " + iClose(_Symbol,PERIOD_CURRENT,1));
   Print("iLowest = " + iLowest(_Symbol,PERIOD_CURRENT,MODE_LOW,15,1));
   Print("iHighest = " + iHighest(_Symbol,PERIOD_CURRENT,MODE_HIGH,15,1));
  }




 
How download new version MT5 build 1845
 
Sari Amelia:
How download new version MT5 build 1845

Open a demo account at MetaQuotes-Demo server, and your terminal will download the update automatically.

 

It works from build 1846 


 
MetaQuotes Software Corp.:

New MetaTrader 5 Platform beta build 1845: MQL5 functions for operations with bars and Strategy Tester improvements

The new beta version of the updated MetaTrader 5 platform will be released on June 8, 2018. We will update our public MetaQuotes-Demo server located at access.metatrader5.com:443. We invite all traders to join testing in order to evaluate updated platform features and help developers fix errors.


Are we going to get native mysql connectivity?

I know that this is something thousands of users want, but we still have to rely on third party .dll files for it.

Reason: