List of changes in MetaTrader 5 Client Terminal builds - page 19

 

Forum on trading, automated trading systems and testing trading strategies

New MetaTrader 5 Platform Build 1755

MetaQuotes Software Corp., 2018.01.17 16:16

New MetaTrader 5 Platform Build 1755

MetaTrader 5 platform update will be released on January 18, 2018. The update will feature the following changes:

  1. Terminal: Fixed an error that caused the terminal and MetaEditor to block Windows shutdown and reboot.
  2. Terminal: Fixed the chart shift when applying a template.
  3. MQL5: Fixed errors that slowed down compilation in some conditions.
  4. Fixed errors reported in crash logs.

The update will be available through the LiveUpdate system.


 

Forum on trading, automated trading systems and testing trading strategies

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

MetaQuotes Software Corp., 2018.06.14 16:06

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

The MetaTrader 5 platform update will be released on June 15, 2018.
This platform update is only available for terminals running on Windows 7 and later operating systems. Earlier Windows versions are not supported.
The updated features 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.

    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. 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 1860 and later cannot be launched in terminal versions below 1860. 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. 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
       );

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




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




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




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

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




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

 

Forum on trading, automated trading systems and testing trading strategies

New MetaTrader 5 build 1870: Adding symbols to Market Watch by ISIN

MetaQuotes Software Corp., 2018.06.25 18:19

New MetaTrader 5 build 1870: Adding symbols to Market Watch by ISIN

The updated version of the MetaTrader 5 platform will be released on June 26, 2018. The new version features the following changes:

  1. Terminal: Search for trading symbols by ISIN (International Securities Identification Number) has been added in the Market Watch window. Now, you can add symbols using three methods: by name, description and ISIN.



  2. Terminal: Fixed user interface slowdown when changing a trading account password.
  3. Terminal: Fixed occasional CPU load increase caused by the client terminal.
  4. MQL5: Fixed passing of custom HTTP headers in the WebRequest function.
  5. MQL5: Fixed behavior of the Bars function in cases when the range beginning and end dates are the same. Now, if there is a bar, the function returns 1. In earlier versions, the function unconditionally returned 0.
  6. Tester: Fixed start of single testing in the visual mode after a forward optimization.
  7. Tester: Fixed sorting of optimization results. Now sorting takes into account passes with incorrect input parameters (INIT_INCORRECT_PARAMETERS) and those having no profit factor.
  8. Tester: Fixed recalculation of genetic optimization graph after changing the optimization criterion.
  9. Documentation has been updated.
The update is available through the LiveUpdate system.

 

Forum on trading, automated trading systems and testing trading strategies

New MetaTrader 5 platform build 1880: Calculation of the complete history of synthetic symbols

MetaQuotes Software Corp., 2018.07.04 16:14

New MetaTrader 5 platform build 1880: Calculation of the complete history of synthetic symbols

The updated version of the MetaTrader 5 platform will be released on July 6, 2018. The new version features the following changes:

  1. Terminal: Added calculation of the price history of synthetic symbols for the entire available data depth.

    The platform calculates the history of one-minute bars based on minute bars of instruments as applied in its formula. Previously, the history was only calculated for the last two months. A deeper history could be created upon an explicit request (when scrolling the chart to the left or calling Copy functions). Now, the history is calculated using all available data unconditionally.




    Each symbol used in the synthetic formula can have price history of different depth. Synthetic history calculation is performed for the shortest available period. For example, the formula uses three financial instruments:

    • EURUSD with the history down to 2009.01.01
    • USDJPY with the history down to 2012.06.01
    • EURJPY with the history down to 2014.06.01

    In this case, the history of the synthetic symbol will be calculated for a period from 2014.06.01 to the present. 100 minutes will be additionally discarded from this date, to ensure the calculation integrity (if any minute bar is not available in history, a previous minute bar is used in the calculation).

    If deep history of used symbols is available, the synthetic symbol history calculation can take quite a long time. To enable immediate synthetic symbol chart view, the history for the last two months is calculated first (similarly to calculations in previous versions). Calculation of an earlier history begins after that.

  2. MQL5: New property ACCOUNT_CURRENCY_DIGITS — the number of decimal places in the account deposit currency. Use the AccountInfoInteger function to get the property. You may use the property when calculating profit on your own, to normalize the values ​​obtained.
  3. MQL5: Fixed delay in the execution of Copy functions and i-functions during operations with the weekly timeframe.
  4. MQL5: Fixed operation of the WebRequest function.
  5. Tester: Added ability to perform a single Expert Advisor test after downloading optimization results from a cache file.
  6. Tester: The new version features a faster initial download of price history by local agents.
  7. Documentation has been updated.
The update will be available through the Live Update system.

 

Forum on trading, automated trading systems and testing trading strategies

New MetaTrader 5 platform build 1930: Floating window charts and .Net libraries in MQL5

MetaQuotes Software Corp., 2018.10.25 17:24

The updated version of the MetaTrader 5 platform will be released on October 26, 2018. The update will feature the following changes:


  1. Terminal: Now you can detach financial symbol charts from the trading terminal window.

    This feature is convenient when using multiple monitors. Thus, you may set the main platform window on one monitor to control your account state, and move your charts to the second screen to observe the market situation. To detach a chart from the terminal, disable the Docked option in its context menu. After that, move the chart to the desired monitor.




    A separate toolbar on detached charts allows applying analytical objects and indicators without having to switch between monitors. Use the toolbar context menu to manage the set of available commands or to hide it.

  2. Terminal: Fully updated the built-in chats. Now they support group dialogs and channels. Conduct private discussions with a group of people in a unified environment without switching between different dialogs and create channels according to your interests and languages. Communicate with colleagues and friends at MQL5.community without visiting the website.

    Group chats and channels can be public or private. Their creators decide whether it is possible to join them freely or only by invitation. You can also assign moderators to channels and chats for additional communication control.



  3. Terminal: Added support for extended volume accuracy for cryptocurrency trading. Now the minimum possible volume of trading operations is 0.00000001 lots. The market depth, the time and sales, as well as other interface elements now feature the ability to display volumes accurate to 8 decimal places.

    The minimal volume and its change step depend on financial instrument settings on the broker's side.



  4. Terminal: Added the tab of articles published on MQL5.community to the Toolbox window. Over 600 detailed materials on the development of trading strategies in MQL5 are now available directly in the terminal. New articles are published every week.



  5. Terminal: Added support for extended authentication using certificates when working under Wine.
  6. Terminal: Fixed display of the market depth when it is limited to one level.
  7. Terminal: Added the "Save As Picture" command to the Standard toolbar. Now, it is much easier to take pictures of charts and share them in the community.



  8. Terminal: Fixed applying the time shift when importing bars and ticks. Previously, the shift was not applied in some cases.



  9. Terminal: Fixed terminal freezing in case of a large amount of economic calendar news.
  10. MQL5: Added native support for .NET libraries with "smart" functions import. Now .NET libraries can be used without writing special wrappers — MetaEditor does it on its own.

    To work with .NET library functions, simply import DLL itself without defining specific functions. MetaEditor automatically imports all functions it is possible to work with:
    • Simple structures (POD, plain old data) — structures that contain only simple data types.
    • Public static functions having parameters, in which only simple types and POD structures or their arrays are used

    To call functions from the library, simply import it:
    #import "TestLib.dll"
    
    //+------------------------------------------------------------------+
    //| Script program start function                                    |
    //+------------------------------------------------------------------+
    void OnStart()
      {
       int x=41;
       TestClass::Inc(x);
       Print(x);
      }
    The C# code of the Inc function of the TestClass looks as follows:
    public class TestClass
    {
       public static void Inc(ref int x)
       {
        x++;
       }
    }
    As a result of execution, the script returns the value of 42.

    The work on support for .NET libraries continues. Their features are to be expanded in the future.

  11. MQL5: Added support for working with WinAPI functions to Standard Library. Now, there is no need to import libraries manually and describe function signatures to use operating system functions in an MQL5 program. Simply include the header file from the MQL5\Include\WinAPI directory.

    WinAPI functions are grouped in separate files by their purpose:

    • libloaderapi.mqh — working with resources
    • memoryapi.mqh — working with memory
    • processenv.mqh — working with environment
    • processthreadsapi.mqh — working with processes
    • securitybaseapi.mqh — working with OS security system
    • sysinfoapi.mqh — obtaining system information
    • winbase.mqh — common functions
    • windef.mqh — constants, structures and enumerations
    • wingdi.mqh — working with graphical objects
    • winnt.mqh — working with exceptions
    • winreg.mqh — working with the registry
    • winuser.mqh — working with windows and interface
    • errhandlingapi.mqh — handling errors
    • fileapi.mqh — working with files
    • handleapi.mqh — working with handles
    • winapi.mqh — including all functions (WinAPI header files)

    The binding works only with the 64-bit architecture.

  12. MQL5: Added support for the inline, __inline and __forceinline specifiers when parsing code. The presence of the specifiers in the code causes no errors and does not affect the compilation. At the moment, this feature simplifies transferring С++ code to MQL5.
    Find more information about specifiers in MSDN.

  13. MQL5: Significantly optimized execution of MQL5 programs. In some cases, the performance improvement can reach 10%. 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 1912 and later cannot be launched in terminal versions below 1912. Programs compiled in earlier MetaEditor versions can run in new terminals.

  14. MQL5: Significantly optimized multiple MQL5 functions.
  15. MQL5: Added new properties for attaching/detaching charts from the terminal main window and managing their position.

    Added the following properties to the ENUM_CHART_PROPERTY_INTEGER enumeration:

    • CHART_IS_DOCKED — the chart window is docked. If set to 'false', the chart can be dragged outside the terminal area.
    • CHART_FLOAT_LEFT — the left coordinate of the undocked chart window relative to the virtual screen.
    • CHART_FLOAT_TOP — the upper coordinate of the undocked chart window relative to the virtual screen.
    • CHART_FLOAT_RIGHT — the right coordinate of the undocked chart window relative to the virtual screen.
    • CHART_FLOAT_BOTTOM — the bottom coordinate of the undocked chart window relative to the virtual screen.

    Added the following functions to the ENUM_TERMINAL_INFO_INTEGER enumeration:

    • TERMINAL_SCREEN_LEFT — the left coordinate of the virtual screen. A virtual screen is a rectangle that covers all monitors. If the system has two monitors ordered from right to left, then the left coordinate of the virtual screen can be on the border of two monitors.
    • TERMINAL_SCREEN_TOP — the top coordinate of the virtual screen.
    • TERMINAL_SCREEN_WIDTH — terminal width.
    • TERMINAL_SCREEN_HEIGHT — terminal height.
    • TERMINAL_LEFT — the left coordinate of the terminal relative to the virtual screen.
    • TERMINAL_TOP — the top coordinate of the terminal relative to the virtual screen.
    • TERMINAL_RIGHT — the right coordinate of the terminal relative to the virtual screen.
    • TERMINAL_BOTTOM — the bottom coordinate of the terminal relative to the virtual screen.

  16. MQL5: Added the volume_real field to the MqlTick and MqlBookInfo structures. It is designed to work with extended accuracy volumes. The volume_real value has a higher priority than 'volume'. The server will use this value, if specified.

    struct MqlTick
      {
       datetime         time;            // Last price update time
       double           bid;             // Current Bid price
       double           ask;             // Current Ask price
       double           last;            // Current price of the Last trade
       ulong            volume;          // Volume for the current Last price
       long             time_msc;        // Last price update time in milliseconds
        uint             flags;           // Tick flags
       double           volume_real;     // Volume for the current Last price with greater accuracy
      };

    struct MqlBookInfo
      {
       ENUM_BOOK_TYPE   type;            // order type from the ENUM_BOOK_TYPE enumeration
       double           price;           // price
       long             volume;          // volume
       double           volume_real;     // volume with greater accuracy
      };

  17. MQL5: Added new properties to the ENUM_SYMBOL_INFO_DOUBLE enumeration:

    • SYMBOL_VOLUME_REAL — the volume of the last executed deal;
    • SYMBOL_VOLUMEHIGH_REAL — the highest deal volume for the current day;
    • SYMBOL_VOLUMELOW_REAL — the lowest deal volume for the current day.

    Use the SymbolInfoDouble function to get these properties.

  18. MQL5: Added the MQL_FORWARD property to the ENUM_MQL_INFO_INTEGER enumeration — forward test mode flag.
  19. MQL5: Added the pack( integer_value ) property for structures. It allows you to set the alignment of the fields arrangement within a structure, which can be necessary when working with DLL. The values of 1, 2 ,4 ,8 and 16 are possible for integer_value.
    If the property is not defined, the default alignment of 1 byte is used — pack(1).

    Example of use:
    //+------------------------------------------------------------------+
    //| Default packing                                                  |
    //+------------------------------------------------------------------+
    struct A
      {
       char              a;
       int               b;
      };
    //+------------------------------------------------------------------+
    //| Specified packing                                                |
    //+------------------------------------------------------------------+
    struct B pack(4)
      {
       char              a;
       int               b;
      };
    //+------------------------------------------------------------------+
    //| Script program start function                                    |
    //+------------------------------------------------------------------+
    void OnStart()
      {
       Print("sizeof(A)=",sizeof(A));
       Print("sizeof(B)=",sizeof(B));
      }
    //+------------------------------------------------------------------+
    Conclusion:
    sizeof(A)=5
    sizeof(B)=8
    Find more information about alignment within structures in MSDN.

  20. MQL5: Relaxed requirements for casting enumerations. In case of an implicit casting, the compiler automatically substitutes the value of a correct enumeration and displays a warning.

    For the following code:
    enum Main
      {
       PRICE_CLOSE_,
       PRICE_OPEN_
      };
    
    input Main Inp=PRICE_CLOSE;
    //+------------------------------------------------------------------+
    //| Start function                                                   |
    //+------------------------------------------------------------------+
    void OnStart()
      {
      }
    The compiler displays the warning:
    implicit conversion from 'enum ENUM_APPLIED_PRICE' to 'enum Main'
    'Main::PRICE_OPEN_' instead of 'ENUM_APPLIED_PRICE::PRICE_CLOSE' will be used
    Previously, the following error was generated in that case:
    'PRICE_CLOSE' - cannot convert enum
    The compiler will still display the error if enumerations are used incorrectly in the function parameters.

  21. MQL5: Fixed compilation of template functions. Now, when using overloaded template functions, only the necessary overload, rather than all existing ones, is instantiated.
    class X {  };
    
    void f(int)  {  }
      
    template<typename T>
    void a(T*) { new T(2); }  // previously, the compiler generated the error here
      
    template<typename T>
    void a()  { f(0); }
      
      
    void OnInit()  { a<X>(); }  

  22. MQL5: Optimized some cases of accessing tick history via the CopyTicks* functions.
  23. MQL5: Added the new TesterStop function allowing for early completion of a test/optimization pass. When calling it, the entire trading statistics and OnTester result are passed to the client terminal just like during the normal test/optimization completion.
  24. MQL5: Added the new property for custom indicators #property tester_everytick_calculate. It is used in the strategy tester and allows for forced indicator calculation at each tick.
  25. Tester: Now, in case of a non-visual test/optimization, all used indicators (standard and custom ones) are calculated only during a data request. The exceptions are indicators containing the EventChartCustom function calls and applying the OnTimer handler. Previously, all indicators were unconditionally calculated in the strategy tester at each incoming tick (even from some other instrument). The new feature significantly accelerates testing and optimization.

    To enable the forced indicator calculation at each tick, add the #property tester_everytick_calculate property for the program.
    Indicators compiled using the previous compiler versions are calculated as before — at each tick.

  26. Tester: Fixed calculating the deposit currency accuracy when testing/optimizing and generating relevant reports.
  27. Tester: Optimized and accelerated the strategy tester operation.
  28. Tester: Fixed a few testing and optimization errors.
  29. MetaEditor: Fixed search for entire words. Now when searching, the underscore is counted as a regular character, rather than a word delimiter.
  30. Updated documentation.

The update will be available through the Live Update system.


 

Forum on trading, automated trading systems and testing trading strategies

New MetaTrader 5 Platform build 2005: Economic Calendar, MQL5 applications as services

MetaQuotes Software Corp., 2019.02.20 17:20

The MetaTrader 5 platform update will be released on February 21, 2019. The new version features the following changes:

  1. Terminal: Completely revised built-in Economic Calendar.

    The Economic Calendar is our proprietary solution. Therein you will find over 600 financial news and indicators related to the 13 largest global economies: USA, European Union, Japan, UK, Canada, Australia, China among others. Relevant data is collected from open sources in real time.

    The new version features updated contents and advanced event filters: by time, priority, currencies and countries.

    The calendar data can now be accessed from MQL5 programs. Please see below for details.




  2. Terminal: Added new type of MQL5 applications — Services. This new type enables the creation of custom price feeds for the terminal, i.e. to implement price delivery from external systems in real time, just like it is implemented on brokers' trade servers.

    Unlike Expert Advisors, indicators and scripts, services are not linked to a specific chart. Such applications run in the background and are launched automatically when the terminal is started (unless such an app was forcibly stopped).

    Services can be managed from a new section within the Navigator window:





    How to create services
    To create a service template, use the corresponding MQL5 Wizard option. Services have one OnStart entry point, similar to scripts. At this point, you can implement an endless data receiving and handling cycle using network functions.

    How to launch services
    To run multiple Expert Advisor or indicator copies with different parameters, you should launch them on different charts. In this case different program instances are created, which then operate independently. Services are not linked to charts, therefore a special mechanism has been implemented for the creation of service instances.

    Select a service from the Navigator and click "Add service" in its context menu. This will open a standard MQL5 program dialog, in which you can enable/disable trading and access to signal settings, as well as set various parameters.




    A service instance can be launched and stopped using the appropriate instance menu. To manage all instances, use the service menu.

  3. Terminal: A learning program has been added.

    The new feature will help beginners in learning how to interact with the platform. We have added over 100 interactive tips concerning the main platform features.

    • Tips are seamlessly displayed as a progress bar on the toolbar and thus they do not distract the user.
    • Tips only appear for the actions which you have never performed in the platform.
    • All tips include interactive links, by which you can navigate to the relevant interface elements. For example, a trading dialog or a menu with the desired program can be launched straight from the tip.

    The filled area of the progress bar will increase whenever you perform appropriate actions and continue training.




  4. Terminal: The trading account history can be presented as positions. The platform collects data on deals related to the position (opening, volume increase, partial or full closing) and groups the information into a single record. Thus you can access position details: open and close time, volume, price and result. This efficient presentation form is now available in history reports exported to files.




  5. Terminal: Added new API enabling request of MetaTrader 5 terminal data through applications
  6. Terminal: Optimized Close By dialog used for closing a position by an opposite one. Now, the dialog is not slowed down even if you have a large number of open positions.
  7. Terminal: Fixed synthetic symbol calculation errors, due to which data could be occasionally skipped.
  8. Terminal: When a custom symbol is deleted, files storing its tick and bar history are also deleted. This avoids the accumulation of unused data on the hard disk.
  9. Terminal: Fixed display of search results on High DPI screens.
  10. MQL5: Implemented access to economic calendar data from MQL5 programs.

    New functions

    CalendarCountryById — gets country description by identifier.
    bool CalendarCountryById(
       const long           country_id,    // country ID
       MqlCalendarCountry&  country        // country description
       );
    CalendarEventById — gets event description by identifier.
    bool CalendarEventById(
       const long           event_id,      // event ID
       MqlCalendarEvent&    event          // event description
       );
    CalendarValueById — gets event value description by identifier.
    bool CalendarValueById(
       const long           value_id,      // value ID
       MqlCalendarValue&    value          // value description
       );
    CalendarEventByCountry — gets the array of available events for the country.
    bool CalendarEventByCountry(
       string               country_code,  // country code
       MqlCalendarEvent&    events[]       // array of events
       );
    CalendarEventByCurrency — gets the array of available events for the affected currency.
    bool CalendarEventByCurrency(
       string               currency,      // currency
       MqlCalendarEvent&    events[]       // array of events
       );
    CalendarValueHistoryByEvent — gets the array of values for the specified time period, by event identifier.
    bool CalendarValueHistoryByEvent(
       ulong                event_id,      // event ID
       MqlCalendarValue&    values[],      // array of values
       datetime             datetime_from, // period beginning date
       datetime             datetime_to=0  // period end date
       );
    CalendarValueHistory — gets the array of values for the specified time period for all events, filtered by country and/or currency.
    bool CalendarValueHistory(
       MqlCalendarValue&    values[],          // array of values
       datetime             datetime_from,     // beginning of period
       datetime             datetime_to=0,     // end of period
       string               country_code=NULL, // country code
       string               currency=NULL      // currency
       );
    CalendarValueLastByEvent — gets an array of last event values by identifier. This function enables the request of the values which have appeared since the previous request. The in/out parameter "change_id" is additionally used for this operation.

    Every time the calendar database changes, the "change_id" property (the last change identifier) is updated. During data request, you specify "change_id" and the terminal returns events which appeared after that time, as well as the current "change_id" value, which can be used for the next request. During the first function call, specify the zero "change_id": the function will not return any events, but will return the current "change_id" for further requests.
    bool CalendarValueHistory(
       ulong                event_id,          // event ID
       ulong&               change_id,         // last calendar change ID
       MqlCalendarValue&    values[]           // array of values
       );
    CalendarValueLast — gets the array of last values for all events, filtered by country and/or currency. This function enables the request of the values which have appeared since the previous request. Similarly to CalendarValueLastByEvent, the "change_id" property is used for the request.
    bool CalendarValueHistory(
       ulong                event_id,          // event ID
       ulong&               change_id,         // last calendar change ID
       MqlCalendarValue&    values[],          // array of values
       string               country_code=NULL, // country code
       string currency=NULL                    // currency
       );

    New structures

    MqlCalendarCountry — country description.
    struct MqlCalendarCountry
      {
       ulong             id;                        // country ID in ISO 3166-1
       string            name;                      // text name of the country
       string            code;                      // code name of the country in ISO 3166-1 alpha-2
       string            currency;                  // country currency code
       string            currency_symbol;           // country currency symbol/sign
       string            url_name;                  // country name used in URL on mql5.com
      };
    MqlCalendarEvent — event description.
    struct MqlCalendarEvent
      {
       ulong                          id;           // event ID
       ENUM_CALENDAR_EVENT_TYPE       type;         // event type
       ENUM_CALENDAR_EVENT_SECTOR     sector;       // sector to which the event belongs
       ENUM_CALENDAR_EVENT_FREQUENCY  frequency;    // event release frequency
       ENUM_CALENDAR_EVENT_TIMEMODE   time_mode;    // event release time mode
       ulong                          country_id;   // country ID
       ENUM_CALENDAR_EVENT_UNIT       unit;         // unit for the event values
       ENUM_CALENDAR_EVENT_IMPORTANCE importance;   // event importance
       ENUM_CALENDAR_EVENT_MULTIPLIER multiplier;   // event importance multiplier
       uint                           digits;       // number of decimal places in the event value
       string                         source_url;   // source URL
       string                         event_code;   // event code
       string                         name;         // text name of the event in the terminal language
      };
    MqlCalendarValue — event value description.
    struct MqlCalendarValue
      {
       ulong             id;                        // value ID
       ulong             event_id;                  // event ID
       datetime          time;                      // event date and time
       datetime          period;                    // period, for which the event is published
       int               revision;                  // published indicator revision in relation to the reported period
       long              actual_value;              // current event value
       long              prev_value;                // previous event value
       long              revised_prev_value;        // revised previous event value
       long              forecast_value;            // forecast event value
       ENUM_CALENDAR_EVENT_IMPACRT impact_type;     // potential impact on the currency rate
      };

    New enumerations

    enum ENUM_CALENDAR_EVENT_FREQUENCY
      {
       CALENDAR_FREQUENCY_NONE            =0,   // not used
       CALENDAR_FREQUENCY_WEEK            =1,   // weekly
       CALENDAR_FREQUENCY_MONTH           =2,   // monthly
       CALENDAR_FREQUENCY_QUARTER         =3,   // quarterly
       CALENDAR_FREQUENCY_YEAR            =4,   // yearly
       CALENDAR_FREQUENCY_DAY             =5,   // daily
      };
    
    enum ENUM_CALENDAR_EVENT_TYPE
      {
       CALENDAR_TYPE_EVENT                =0,   // event (meeting, speech, etc.)
       CALENDAR_TYPE_INDICATOR            =1,   // indicator
       CALENDAR_TYPE_HOLIDAY              =2,   // holiday
      };
    
    enum ENUM_CALENDAR_EVENT_SECTOR
      {
       CALENDAR_SECTOR_NONE               =0,   // no
       CALENDAR_SECTOR_MARKET             =1,   // market
       CALENDAR_SECTOR_GDP                =2,   // GDP
       CALENDAR_SECTOR_JOBS               =3,   // jobs
       CALENDAR_SECTOR_PRICES             =4,   // prices
       CALENDAR_SECTOR_MONEY              =5,   // money
       CALENDAR_SECTOR_TRADE              =6,   // trade
       CALENDAR_SECTOR_GOVERNMENT         =7,   // government
       CALENDAR_SECTOR_BUSINESS           =8,   // business
       CALENDAR_SECTOR_CONSUMER           =9,   // consumer
       CALENDAR_SECTOR_HOUSING            =10,  // housing
       CALENDAR_SECTOR_TAXES              =11,  // taxes
       CALENDAR_SECTOR_HOLIDAYS           =12,  // holidays
      };
      
    enum ENUM_CALENDAR_EVENT_IMPORTANCE
      {
       CALENDAR_IMPORTANCE_NONE           =0,   // no
       CALENDAR_IMPORTANCE_LOW            =1,   // low
       CALENDAR_IMPORTANCE_MODERATE       =2,   // moderate
       CALENDAR_IMPORTANCE_HIGH           =3,   // high
      };
    
    enum ENUM_CALENDAR_EVENT_UNIT
      {
       CALENDAR_UNIT_NONE                 =0,   // no
       CALENDAR_UNIT_PERCENT              =1,   // percent
       CALENDAR_UNIT_CURRENCY             =2,   // national currency
       CALENDAR_UNIT_HOUR                 =3,   // number of hours
       CALENDAR_UNIT_JOB                  =4,   // number of jobs
       CALENDAR_UNIT_RIG                  =5,   // number of rigs
       CALENDAR_UNIT_USD                  =6,   // US dollar
       CALENDAR_UNIT_PEOPLE               =7,   // number of people
       CALENDAR_UNIT_MORTGAGE             =8,   // number of mortgages
       CALENDAR_UNIT_VOTE                 =9,   // number of votes
       CALENDAR_UNIT_BARREL               =10,  // number of barrels
       CALENDAR_UNIT_CUBICFEET            =11,  // volume in cubic feet
       CALENDAR_UNIT_POSITION             =12,  // number of job positions
       CALENDAR_UNIT_BUILDING             =13   // number of buildings
      };
      
    enum ENUM_CALENDAR_EVENT_MULTIPLIER
      {
       CALENDAR_MULTIPLIER_NONE           =0,   // no    
       CALENDAR_MULTIPLIER_THOUSANDS      =1,   // thousands
       CALENDAR_MULTIPLIER_MILLIONS       =2,   // millions
       CALENDAR_MULTIPLIER_BILLIONS       =3,   // billions
       CALENDAR_MULTIPLIER_TRILLIONS      =4,   // trillions
      };
      
    enum ENUM_CALENDAR_EVENT_IMPACRT
      {
       CALENDAR_IMPACT_NA                 =0,   // not available
       CALENDAR_IMPACT_POSITIVE           =1,   // positive
       CALENDAR_IMPACT_NEGATIVE           =2,   // negative
      };
    
    enum ENUM_CALENDAR_EVENT_TIMEMODE
      {
       CALENDAR_TIMEMODE_DATETIME         =0,   // the source publishes the exact time
       CALENDAR_TIMEMODE_DATE             =1,   // the event takes the whole day
       CALENDAR_TIMEMODE_NOTIME           =2,   // the source does not publish the event time
       CALENDAR_TIMEMODE_TENTATIVE        =3,   // the source provides only date, but does not publish the exact time in advance, exact time is added when event occurs
      };

    New error codes

    ERR_CALENDAR_MORE_DATA             =5400,   // the array is too small for the whole result (values which fit in the array were passed)
    ERR_CALENDAR_TIMEOUT               =5401,   // timed out waiting for a response to the calendar data request
    ERR_CALENDAR_NO_DATA               =5402,   // data not found

  11. MQL5: Fixes and operation speed improvements related to tick and bar history.
  12. MQL5: Fixes and significant operation speed improvements related to tick and bars history modification functions of custom trading symbols, CustomTicks* and CustomRates*.
  13. MQL5: New data conversion functions.

    CharArrayToStruct copies a uchar array to a POD structure.
    bool  CharArrayToStruct(
       void&         struct_object,    // structure
       const uchar&  char_array[],     // array
       uint          start_pos=0       // starting position in the array
       );
    StructToCharArray copies a POD structure to a uchar array.
    bool  StructToCharArray(
       const void&  struct_object,     // structure
       uchar&       char_array[],      // array
       uint         start_pos=0        // starting position in the array
       );

  14. Added MathSwap function for changing byte order in ushort, uint and ulong values.
    ushort MathSwap(ushort value);
    uint   MathSwap(uint   value);
    ulong  MathSwap(ulong  value);

  15. MQL5: Added network functions for creating TCP connections to remote hosts via system sockets:

    • SocketCreate creates a socket with specified flags and returns its handle
    • SocketClose closes the socket
    • SocketConnect connects to the server, with timeout control
    • SocketIsConnected checks if the socket is currently connected
    • SocketIsReadable gets the number of bytes which can be read from the socket
    • SocketIsWritable checks if data writing to this socket is possible at the current time
    • SocketTimeouts sets data receiving and sending timeouts for the system socket object
    • SocketRead reads data from a socket
    • SocketSend writes data to a socket
    • SocketTlsHandshake initiates a secure TLS (SSL) connection with the specified host using the TLS Handshake protocol
    • SocketTlsCertificate receives information concerning the certificate used for secure network connection
    • SocketTlsRead reads data from a secure TLS connection
    • SocketTlsReadAvailable reads all available data from a secure TLS connection
    • SocketTlsSend sends data using a secure TLS connection

    The address of the host, to which connection using network functions is established, must be explicitly added to the list of allowed addresses in terminal settings.

    New error codes have been added for operations with network functions:

    • ERR_NETSOCKET_INVALIDHANDLE (5270): invalid socket handle passed to the function
    • ERR_NETSOCKET_TOO_MANY_OPENED (5271): too many sockets open (maximum 128)
    • ERR_NETSOCKET_CANNOT_CONNECT (5272): error while connecting to remote host
    • ERR_NETSOCKET_IO_ERROR (5273): error while sending/receiving data from the socket
    • ERR_NETSOCKET_HANDSHAKE_FAILED (5274): secure connection establishment error (TLS Handshake)
    • ERR_NETSOCKET_NO_CERTIFICATE (5275) — no data about certificate used for secure connection

  16. MQL5: Added new functions for string operations:

    StringReserve reserves for a string the memory buffer of the specified size.
    bool  StringReserve(
       string&        string_var,          // string
       uint           new_capacity         // buffer size for the string
       );
    StringSetLength sets the specified string length in characters.
    bool  StringSetLength(
       string&        string_var,          // string
       uint           new_length           // new string length
       );

  17. MQL5: Added new function for array operations:

    ArrayRemove removes from an array the specified number of elements starting with the specified index.
    bool  ArrayRemove(
       void&         array[],              // array of any type
       uint          start,                // the index to start removal
       uint          count=WHOLE_ARRAY     // number of elements
       );
    ArrayInsert inserts to a receiver array the specified number of elements from the source array, starting with the specified index.
    bool  ArrayInsert(
       void&         dst_array[],          // receiver array
       const void&   src_array[],          // source array
       uint          dst_start,            // index in the receiver array where to insert
       uint          src_start=0,          // index in the source array to start copying
       uint          count=WHOLE_ARRAY     // number of inserted elements
       );
    ArrayReverse reverses in an array the specified number of elements starting with the specified index.
    bool  ArrayReverse(
       void&         array[],              // array of any type
       uint          start=0,              // index to start reversing
       uint          count=WHOLE_ARRAY     // number of elements
       );

  18. MQL5: New "uint count" parameter has been added in functions CustomRatesUpdate, CustomRatesReplace, CustomTicksAdd and CustomTicksReplace. It allows specification of the number of elements of the passed array, which will be used for these functions. The WHOLE_ARRAY value is used for the parameter by default. It means that the whole array will be utilized.
  19. MQL5: Added CustomBookAdd function to pass the status of the Depth of Market for a custom symbol. The function allows broadcasting the Depth of Market as if the prices arrive from a broker's server.
    int  CustomBookAdd(
       const string        symbol,            // symbol name
       const MqlBookInfo&  books[]            // an array with the DOM elements descriptions
       uint                count=WHOLE_ARRAY  // number of elements to be used
       );
  20. MQL5: Added CustomSymbolCreate function overloading. This allows the creation of a custom trading symbol based on an existing one. After creation, any symbol property can be edited using corresponding functions.
    bool  CustomSymbolCreate(
       const string        symbol_name,       // custom symbol name
       const string        symbol_path="",    // name of the group in which the symbol will be created
       const string        symbol_origin=NULL // name of the symbol based on which the custom symbol will be created
       );
    The name of the symbol, from which the properties of for the custom symbol should be copied, is specified in the "symbol_origin" parameter.

  21. The StringToTime function converting the string with date/time to a datetime value has been updated. Now it supports the following date formats:

    • yyyy.mm.dd [hh:mi]
    • yyyy.mm.dd [hh:mi:ss]
    • yyyymmdd [hh:mi:ss]
    • yyyymmdd [hhmiss]
    • yyyy/mm/dd [hh:mi:ss]
    • yyyy-mm-dd [hh:mi:ss]

  22. MQL5: New TERMINAL_VPS property in the ENUM_TERMINAL_INFO_INTEGER enumeration; it shows that the terminal is running on the MetaTrader Virtual Hosting server (MetaTrader VPS). If an application is running on a hosting server, you can disable all its visual functions, since the virtual server does not have a graphical user interface.
  23. MQL5: New SYMBOL_EXIST property in the ENUM_SYMBOL_INFO_INTEGER enumeration, means that the symbol under this name exists.
  24. MQL5: Fixed typing when using template function pre-declarations.
  25. MQL5: Added re-initialization of indicators when changing a trading account.
  26. MQL5: Optimized StringSplit function.
  27. MQL5: Fixed errors in the standard library operation.
  28. Tester: Added TesterStop function — routine early shutdown of an Expert Advisor on a test agent. Now you can forcibly stop testing after reaching the specified number of losing trades, a preset drawdown level or any other criterion.

    Testing completed using this function is considered successful. After the function call, the trading history obtained during testing and all trade statistics are passed to the terminal.

  29. Tester: Disabled ability to test and optimize Expert Advisors through MQL5 Cloud Network in the real tick mode. This mode can only be used on local agents and local network farms.
  30. Tester: Improved work with indicators during visual testing. Now the price chart and indicator lines are drawn synchronously, even for the maximum visualization speed.
  31. Tester: Optimized and significantly accelerated testing and optimization.
  32. Tester: Fixed debugging of indicators on historical data. Now the OnInit and OnDeinit indicator functions can be properly debugged.
  33. Tester: Implemented faster access to historical data when testing multicurrency Expert Advisors.
  34. Tester: Fixed occasional freezing of the visual tester during debugging on historical data.
  35. Tester: Implemented faster start of optimization passes when processing a task package by an agent.
  36. Tester: Changed policy of distributing task packages to testing agents. The package size has been increased and thus resource consumption on network operations has been significantly reduced.
  37. Tester: Changed behavior of options enabling the use of local, network and cloud agents. Now, when you switch off the options, the agents complete processing of received tasks, while no more new tasks are given to them. In earlier versions, the behavior was similar to the "Disable" command, which immediately stopped agent operation.




  38. MetaEditor: Added support for non-ANSI characters in the debugger. Now, the expressions are properly displayed even if the variable name is specified in Cyrillic.
  39. MetaEditor: Fixed display of search results on High DPI screens.
  40. Added user interface translation into Croatian.
  41. Documentation has been updated.
The update will be available through the LiveUpdate system.

 

Forum on trading, automated trading systems and testing trading strategies

New MetaTrader 5 platform build 2085: Integration with Python and Strategy Tester improvements

MetaQuotes Software Corp., 2019.06.11 17:36

The updated version of the MetaTrader 5 platform will be released on Thursday, June 13, 2019. The new version contains the following changes:


  1. Terminal: Added new API which enables request of MetaTrader 5 terminal data through applications using Python language.

    Python is a modern high-level programming language for developing scripts and applications. It contains multiple libraries for machine learning, process automation, as well as data analysis and visualization.

    MetaTrader package for Python is designed for efficient and fast obtaining of exchange data via interprocessor communication, directly from the MetaTrader 5 terminal. The data received via this pathway can be further used for statistical calculations and machine learning.



    Connection

    1. Download the latest Python version at https://www.python.org/downloads/windows
    2. During Python installation, check "Add Python X.X to PATH%" to enable the launch of Python scripts from the command line.
    3. Install the MetaTrader 5 module from the command line
      pip install MetaTrader5
    4. Add matplotlib and pytz packages
      pip install matplotlib
      pip install pytz

    Functions

    • MT5Initialize establishes connection with the MetaTrader 5 terminal
    • MT5Shutdown closes the previously established connection to the MetaTrader 5 terminal
    • MT5TerminalInfo receives status and parameters of the connected MetaTrader 5 terminal
    • MT5Version returns the MetaTrader 5 terminal version
    • MT5WaitForTerminal waits till the MetaTrader 5 terminal connects to the trade server
    • MT5CopyRatesFrom receives bars from the MetaTrader 5 terminal starting from the specified date
    • MT5CopyRatesFromPos receives bars from the MetaTrader 5 terminal starting from the specified index
    • MT5CopyRatesRange receives bars in the specified date range from the MetaTrader 5 terminal
    • MT5CopyTicksFrom receives ticks from the MetaTrader 5 terminal starting from the specified date
    • MT5CopyTicksRange receives ticks for the specified date range from the MetaTrader 5 terminal


  2. Terminal: The Market and Signal sections have been optimized. Now the product and signal showcases run up to seven times faster and thus provide a better service browsing experience.




  3. Terminal: Added support for "Market", "Signals" and "Search" in Wine. Linux and Mac OS users can now access the largest store of trading applications along with the copy trading service.




  4. Terminal: The built-in learning program has been translated into more than 30 languages, including Spanish, Chinese, Portuguese and German, among others. To view interactive tips in the desired language, switch to the required interface language using the View menu.




  5. Terminal: New options enable verification of phone numbers and emails, which are specified by traders when opening demo and preliminary accounts.

    The need for data verification is determined by the broker. If the option is enabled, confirmation codes are automatically sent to the trader during an account request and special code fields appear in the dialog box:




    Confirmation codes are valid for several minutes. If the code is not entered in the field within this time frame, the trader will need to repeat the procedure.
    Before sending codes, the system checks whether the specified phone/email was previously confirmed. If the trader has already passed verification from his or her computer, an account will be opened without additional confirmation. Thus, there will be no additional burden for traders during an account request.

  6. Terminal: MQL5.community payment options through the PayPal system have been expanded. Purchases can now be performed with one click, using this system.

    How it works
    After you log in using your PayPal account when making a purchase, you will be requested to allow further payments to our company:





    By confirming this option, and you will be able to perform further purchases with one click, by pressing the previously saved account button:




    If you click "Cancel and return to MetaQuotes Software Corp.", you will make the payments in a normal way, by entering the PayPal account details manually, for each purchase.
    The MQL5.com website and the MetaTrader 5 platform do not store your payment details. When you deposit funds, make a purchase in the Market service or subscribe to a Signal, the data verification is performed on the payment system side.
    You can always remove your PayPal account link.

  7. Tester: Strategy Tester improvements and optimization.

    We have introduced a large number of hidden improvements and fixed errors to optimize the Strategy Tester operation. The update enables much faster testing for some of the task types and higher operation stability. Major improvements include:

    Operations with frames
    Operations with frames on local, network and cloud agents have been optimized. Such operations are now processed faster and are never skipped.

    Distribution of tasks to agents
    The tester can now redistribute tasks to agents during the optimization process. If a new agent has become available (or one of the previously used ones has been released), the tester automatically creates a new package of tasks, using those which were earlier distributed among other agents. Tasks can also be redistributed if slow agents are detected. Tasks of such agents are sent to other agents to complete the optimization faster.

    Task distribution in math calculation mode has become much faster.

    Optimization statistics in the Journal
    Optimization logging has been extended: it includes detailed statistics related to the MQL5 Cloud Network usage and to the enabling and disabling of cloud agents, among others.

    Operation in full optimization log mode
    For optimal resource consumption, not all messages from agents are recorded to the tester log. To view all logs, you can enable the "Full optimization logs" option using the tester log context menu. Previously, this mode significantly slowed the optimization process. Now the calculation time is not affected.

    MQL5 Cloud Network
    Optimized operation of cloud testing agents. Now computation tasks are distributed more efficiently.

  8. Terminal: The built-in calendar features publications of more than 900 indicators related to the 18 largest global economies, including US, European Union, Japan and the UK, among others. Relevant data is collected from open sources in real time. By regularly checking the service, traders remain informed on the latest global news and can take informed trading decisions.

    The economic calendar is available in desktop terminals and websites, as well as on mobile devices. The application can be opened using the Calendar context menu in the terminal:




    Select your platform and download the Tradays apps:


    In addition to calendar functions available in the desktop platform, the mobile version provides event reminders and access to a complete history of indicators in the form of charts and tables.

  9. Terminal: Added automatic generation of custom symbol bar history during import of tick history. Now, if tick data of a custom symbol changes, corresponding bars are automatically recalculated:

    • Thus, unified data is preserved in the platform.
    • After importing tick data (provided that there is enough data), there is no need to import bars since they are automatically calculated by the terminal.

    Changes concern the import of ticks performed via the terminal interface, as well as the update of ticks performed from MQL5 applications using the CustomTicks* function. Any changes in tick data lead to recalculation of the corresponding 1-minute bars of the custom symbol.

  10. Terminal: Fixed data update in the Data Window when using a crosshair on a detached chart.
  11. Terminal: Fixed tick history saving. In earlier versions, multiple ticks within a millisecond could be saved in the wrong order.
  12. Terminal: Fixed generation of charts based on a too short price history (less than a day) available on the server.
  13. MQL5: Added MQL5 service debugging option. These applications can now be tested similar to Expert Advisors and indicators.
  14. MQL5: New profit and margin calculation modes have been added in the ENUM_SYMBOL_CALC_MODE enumeration:

    • SYMBOL_CALC_MODE_EXCH_BONDS — calculation for exchange bonds.
    • SYMBOL_CALC_MODE_EXCH_STOCKS_MOEX — calculation for the stocks traded on the Moscow Exchange.
    • SYMBOL_CALC_MODE_EXCH_BONDS_MOEX — calculation for the bonds traded on the Moscow Exchange.

  15. MQL5: The new TesterDeposit function enables the emulation of deposit operations during testing. The function can be useful when testing money management strategies.
    bool  TesterDeposit(
       double money      // the deposit amount
       );
  16. MQL5: During the OnDeinit method execution, the MQL5 application does not receive any events from the terminal. Previously, applications occasionally failed to complete de-initialization (for example, to delete all created objects) due to the receiving of other events.
  17. MQL5: Fixed occasional errors which could occur after a change in the custom symbol tick history for the current day.
  18. MQL5: Fixed occasional application slowdown when using a large number (tens of thousands) of graphical objects.
  19. MQL5: Fixed terminal freezing in the case of frequent trading history calls from MQL5 programs.
  20. MQL5: Fixed iBarShift function operation. With the "exact=false" flag and request outside the data, the function returned the oldest bar number instead of the newest one.
  21. Tester: Fixed determination of the cores number on computers with processors having several NUMA nodes.
  22. Tester: Added possibility to run testing and optimization with the zero initial deposit, since deposit operations can be emulated during testing using the new TesterDeposit function.
  23. MetaEditor: The code styler command can now be added to the toolbar for quick access.
  24. MetaEditor: Fixed switching to parameter definition and viewing of related data when using non-Unicode characters in function and variable names.
  25. Documentation has been updated.

The update is available through the LiveUpdate system.


 

Forum on trading, automated trading systems and testing trading strategies

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

MetaQuotes Software Corp., 2019.10.03 15:18

The MetaTrader 5 platform update will be released on Friday, October 4, 2019 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 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. 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 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. Terminal: 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. Terminal: 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. Terminal: The Crosshair tool now shows the distance between price levels in percentage, in addition to previously available pips:




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




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

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

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

  11. MQL5: 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&)'

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

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

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




  15. 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 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() );
      }
  16. MQL5: 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.
  17. MQL5: Fixed excessive memory consumption in the Copyticks and CopyTicksRange functions.
  18. Signals: Fixed display of signal charts when working in Wine (Mac OS and Linux).
  19. 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 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.




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




  21. Tester: Added saving of optimization cache for the "All symbols in Market Watch" mode.
  22. 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, 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:




  23. Tester: Significantly accelerated testing and optimization, including operations performed using the MQL5 Cloud Network.
  24. Tester: Fixes and optimized operations with frames.
  25. 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;
     }

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




  27. MetaEditor: Fixed display of the 'union' keyword in tooltips.
  28. 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.

  29. Documentation has been updated.
  30. Fixes based on crash logs.

The update will be available through the Live Update system.


 

Forum on trading, automated trading systems and testing trading strategies

New MetaTrader 5 Platform Build 2190

MetaQuotes Software Corp., 2019.10.17 09:40

The MetaTrader 5 platform update will be released on Friday, October the 18th, 2019. The update provides improvements and fixes implemented based on the feedback that we received after the previous MetaTrader 5 build 2170 major update:

  1. Terminal: Fixed the display order of MQL5 programs in the Navigator.
  2. MQL5: Fixed compilation errors connected with the use of local static variables in programs having input group declarations.
  3. VPS: Fixed requesting of Hosting journals.
  4. Tester: Improved display of three-dimensional optimization charts.
  5. Tester: Fixed reception of frames during forward optimization. Now, all frames from the main and forward optimizations are available in the OnTesterDeinit function.
  6. Tester: Fixed formation of a tree of symbols in Strategy Tester settings.
  7. Added user interface translation into Punjabi (India).
  8. Documentation has been updated.
  9. Fixes based on crash logs.

The update will be available through the Live Update system.


 

Forum on trading, automated trading systems and testing trading strategies

Support for 32-bit versions ends with the next MetaTrader 5 update

MetaQuotes Software Corp., 2019.11.01 15:07

MetaTrader 5 build 2190 is the last release that supports the 32-bit version. The next official release of the MetaTrader 5 platform will be available only in the 64-bit version. The 64-bit version of Windows XP was released 14 years ago. Support for 32-bit versions currently impedes the development of any project.

Discontinuation of support for 32-bit versions will affect Market as well. After the next official update of the MetaTrader 5 platform, access to the Market will be disabled for the 32-bit version of the terminal. Users will be able to purchase and launch new MetaTrader 5 products from the 64-bit terminal only. All products previously purchased in the 32-bit MetaTrader 5 terminal will continue to work, but it will not be possible to upgrade them to a new version.

The 32-bit version of MetaTrader 5 build 2190 will be available for download and installation for another 6 months

Reason: