What's new in MetaTrader 5

The history of updates of the desktop, mobile and web platforms

17 February 2017

MetaTrader 5 Platform Build 1545: fast switching between windows and changing price values with the mouse wheel

Terminal

  1. Fast switch between the 'Toolbox' and 'Strategy Tester' windows.



  2. New option allows editing prices and volumes of orders using the mouse wheel:




  3. Now, when you go to download mobile terminals, the list of your trade servers is remembered. Then, when you install MetaTrader on your iPhone or Android device, a ready list of servers will be shown to you. You can quickly connect to your existing trading accounts. The server of the currently connected account will be displayed first in the mobile terminal.




  4. Significantly reduced load on the terminal, created by invisible (minimized) charts and objects.
  5. Fixed occasional incorrect triggering of trailing stop levels.
  6. Fixed filtering of trades by symbol in the account trading history.
  7. Fixed display of the 'Type' field in the history of positions.
  8. Fixed presentation of the trading history in the form of positions.
  9. Fixed display of custom indicators whose drawing type is DRAW_COLOR_LINE, DRAW_COLOR_ZIGZAG and DRAW_COLOR_SECTION, in case CLR_NONE is used for the color.

MQL5

  1. Fixed template typing using a constant pointer.
  2. Fixed control of access to private and protected class members.

Tester

  1. Fixed activation of limit orders on Exchange instruments, when the order trigger price is worse than the current market (the Buy price is higher than or the Sell price is lower than the market price).
  2. Removed restriction connected with testing of custom indicators having more than 64 input parameters.
  3. Added UI translation into Hindi.

Updated documentation.

9 February 2017

MetaTrader 5 iOS build 1509: Log in to MQL5.com with Facebook
  • Added the ability to sign up for and log in to your MQL5.com account with Facebook. If you have a profile in this social network, you can access the chats and the entire set of the MetaTrader 5 services in a few clicks.


  • Improvements and fixes.

27 January 2017

MetaTrader 5 build 1525: Representing trading history as positions and tester improvements

Terminal

  1. Now trading history can be additionally displayed in the form of positions. The terminal collects data on deals related to a position (position opening, additional volume, partial and full closure), and then combines the data into one record providing the following details:
    • Position opening and closing time determined by the first and last trade respectively
    • Position volume. If part of the position has been closed, the record contains the closed volume and the initial volume
    • The weighted average position opening price and its close price
    • The total financial result of deals related to the position




    On hedging accounts, the new history form is similar to the account history used in MetaTrader 4.




  2.   A new command has been added, which allows visualizing trades on a symbol's chart.

    • If you need to show deals of a selected position/symbol, click "Add [symbol name] Deals". Appropriate deals will be displayed on all currently open charts of the selected symbol. If there are no open charts of that symbol, a new chart will be opened.
    • Click "Add All Deals" in order to show deals of all symbols from the account history. Appropriate deals of corresponding symbols will be added to all open charts.




  3. Added display of the international name of a trading instrument in contract specification, as well as search by the international name in symbol management dialog.




  4. Added command for terminal window resolution setup. The function will be helpful for making videos. The menu provides the most popular resolution options used in various video services, such as YouTube.



  5. Chart templates and profiles have been moved from [Terminal Data Folder\Profiles] to [Terminal Data Folder\MQL5\Profiles]. Now you can easily add templates to the MQL5 Storage and access them from any PC.

MQL5

  1. Added support for resource variables. Development of some programs can be greatly facilitated by using such variables. For example, you can write a code of an OpenCL program in a separate CL file and then include it as a string into your MQL5 program resources. Before the update, such a code needed to be described as one large string variable.

    Declaration of the resource variable
    #resource path_to_resource_file as type_of_resource_variable name_of_resource_variable

    Features
    • Encoding of string files is determined automatically based on the BOM (the header). If BOM is absent, encoding is defined by the file contents. ANSI, UTF-8 and UTF-16 are supported. All strings are converted to Unicode.
    • Data of such a resource can only be addressed via a variable. Automatic addressing using "::<resource name>" is not available.
    • The special bitmap resource variable type shows to the compiler that the resource is an image. In this case, the resource variable gets the uint type.
    • When using a 24-bit image, the alpha channel component is set to 255 for all the image pixels.
    • When using a 32-bit image without the alpha channel, the alpha channel component is also set to 255 for all the image pixels.
    • When loading a 32-bit image with the alpha channel, the pixels are not processed in any way.
    • The bitmap type array resource variable may have two dimensions. In this case, the array size is defined as [image_height ][ image_width ].
    • If an array of one dimension is specified, the number of elements is equal to image_height*image_width.
    • If the resource file size is not a multiple of the array element size, the remaining data will be cropped. For example, if file size is 14 bytes, the number of elements for an int array will be equal to 3, while the other 2 bytes (14 - sizeof(int)*3) will be discarded.

    Examples of Use
    #resource "data.bin" as int ExtData[]             // declaring the numeric array containing data from the data.bin file
    #resource "data.bin" as MqlRates ExtData[]        // declaring the simple structures array containing data from the data.bin file
    
    #resource "data.txt" as string ExtCode            // declaring the string containing the data.txt file data
    #resource "data.txt" as string ExtCode[]          // declaring the string array containing the data.txt file data
    
    #resource "image.bmp" as bitmap ExtBitmap[]       // declaring the one-dimensional array containing a bitmap from the BMP file, array size = width * height
    #resource "image.bmp" as bitmap ExtBitmap2[][]    // declaring the two-dimensional array containing a bitmap from the BMP file, array size [hight][width]
    

  2. New property CHART_SHOW allows disabling chart display. Functions ChartGetInteger and ChartSetInteger are used to get and set the property.

    If false, drawing of any price chart attributes is disabled and all chart border indents are eliminated, including time and price scales, quick navigation bar, Calendar event labels, trade labels, indicator and bar tooltips, indicator subwindows, volume histograms, etc.

    Disabling the drawing is a perfect solution for creating a custom program interface using graphical resources.

    The graphical objects are always drawn regardless of the CHART_SHOW property value.

  3. New property CHART_KEYBOARD_CONTROL allows enabling/disabling chart control using the keyboard ("Home", "End", "PageUp", "+", "-", "Up arrow", etc.). Setting CHART_KEYBOARD_CONTROL to false disables chart scrolling and scaling while leaving intact the ability to receive the keys pressing events in OnChartEvent().

    Functions ChartGetInteger and ChartSetInteger allow getting and setting the property.

  4. Added new functions for working with OpenCL.

    New properties for working with memory
    Four new properties can be received through CLGetInfoIntegrer:
    • CL_DEVICE_MAX_WORK_GROUP_SIZE — the total number of local working groups available for an OpenCL device.
    • CL_KERNEL_WORK_GROUP_SIZE — the total number of local working groups available for an OpenCL program.
    • CL_KERNEL_LOCAL_MEM_SIZE — size of the local memory in bytes used by an OpenCL program for solving all parallel tasks in a group. Use CL_DEVICE_LOCAL_MEM_SIZE to receive the maximum available value.
    • CL_KERNEL_PRIVATE_MEM_SIZE — the minimum size of the private memory (in bytes) used by each task in the OpenCL program kernel.

    bool CLExecutionStatus(int kernel)
    Returns the OpenCL program execution status. The OpenCL program kernel handle is passed as the parameter.

    bool CLSetKernelArgMemLocal(int kernel_handle,int arg_index,ulong local_mem_size)
    Sets the local buffer as an argument of the kernel function. The OpenCL program kernel handle, the number of the OpenCL function argument and the buffer size are passed as parameters.

  5. New response code TRADE_RETCODE_LIMIT_POSITIONS has been added. The number of open positions simultaneously present on an account can be limited by the server settings. After a limit is reached, the server returns the TRADE_RETCODE_LIMIT_POSITIONS error when attempting to place an order. The limitation operates differently depending on the position accounting type:

    • Netting — number of open positions is considered. When a limit is reached, the platform disables placing new orders whose execution may increase the number of open positions. In fact, the platform allows placing orders only for the symbols that already have open positions. The current pending orders are not considered since their execution may lead to changes in the current positions but it cannot increase their number.
    • Hedging — pending orders are considered together with open positions, since a pending order activation always leads to opening a new position. When a limit is reached, the platform disables placing both new market orders for opening positions and pending orders.

  6. Fixed error that could occasionally cause skipping of ticks in the tick history.
  7. Fixed indirect template typing errors.
  8. Updated library of mathematical statistics functions.
  9. Added TranslateKey function that returns a Unicode character by a virtual key code considering the current input language and the status of control keys. The function uses ToUnicodeEx to convert keys pressed by a user into Unicode characters.
    void OnChartEvent(const int id,const long& lparam,const double& dparam,const string& sparam)
      {
       if(id==CHARTEVENT_KEYDOWN)
         {
          short sym=TranslateKey((int)lparam);
          //--- if the entered character is successfully converted to Unicode
          if(sym>0)
             Print(sym,"'",ShortToString(sym),"'");
          else
             Print("Error in TranslateKey for key=",lparam);
         }
      }

Market

  1. Fixed product page opening when downloading a demo version.

Tester

  1. After optimization completion, results are now automatically sorted by the "Results" column.
  2. A new command in the context menu of the optimization results tab allows to automatically open results when the optimization completes.
  3. The Strategy Tester now stays in the optimization mode after starting a single testing run. In earlier versions, if a single test was started from the optimization results tab, the strategy tester switched to the single testing mode. The optimization mode needed to be enabled in the settings in order to perform further optimization.
  4. Now sets of input parameters can be saved as local strategy tester settings, which can be conveniently accessed from the context menu, in addition to traditional .set files.




  5. Added UI translations into Mongolian, Hungarian, Romanian and Urdu.

MetaEditor

  1. Added ability to change the order of watched expressions in the debugger window. An expression can be dragged to the required position using the mouse.




  2. Fixed determining of source file encoding.
  3. Fixed search by files in the UTF-8 encoding.
  4. Fixed text selection with a mouse in case the text contains tabs.
  5. Added UI translations into Hungarian and Romanian.

Updated documentation.

18 January 2017

MetaTrader 5 Android build 1506: Trade filtering and sorting
  • Trade and History tabs now offer sorting by symbols (financial instruments), orders and trading time. Apart from sorting, you can also filter trades by symbols in the History tab.

  • Working with charts in multi-window mode has been optimized. The improved menu allows you to open new windows, delete old ones, as well as re-arrange them and select a desired layout (vertical, horizontal or tile).

9 December 2016

MetaTrader 5 Build 1495: Improvements in MQL5 for working with custom graphics

MQL5

  1. Added the CopyTicksRange function.
  2. Added improved anti-aliasing functions to CCanvas class:
  3. Added description of the graphical library to the MQL5 Reference. The library allows to quickly create histograms, distributions and line graphs right on the price charts.
  4. Added the identifiers of the state of system keys to the list of constants of Client Terminal Properties. A call to TerminalInfoInteger(TERMINAL_KEYSTATE_XXX) returns the same state code of a key as the GetKeyState() function in MSDN.
  5. Disabled the support for casting of string type to bool. To check strings, one needs to use explicit conditions. For example, in the new build, compilation of the following code will result in an error:
    string str;
    ...
    if(str)                        // will result in "Cannot convert type 'string' to 'bool'" compilation error (no error would appear in the previous versions)
       Print("str is true");
    One should use an explicit condition:
    string str;
    ...
    
    //--- check if the string is initialized
    if(str!=NULL)
       Print("str is true");
    
    or
    
    //--- check if the string value is "true"
    if(StringCompare(str,"true",false))
       Print("str is true");
    
    or
    
    //--- check if the string is integer and is not equal to zero
    if((int)str!=0)
       Print("str is true");

Fixed errors reported in crash logs.

2 December 2016

MetaTrader 5 Web Platform: Two-factor authentication and password change
  • We have added the two-factor authentication option using one-time passwords, which improves protection of accounts against unauthorized access. In order to enable the two-factor authentication, launch the MetaTrader 5 mobile application. Log in and choose the One-time password (OTP) generator option in the Settings window. The OTP generator can bind all your trading accounts and automatically generate a unique one-time six-digit password for each account. Enter this password when logging in to the web platform.





  • Another new option allows changing the master and investor passwords. Take this opportunity to create an easy-to-remember personal ID.
  • Also, the updated web platform can automatically generate demo accounts. Now, you can launch the MetaTrader 5 Web platform from any browser and start trading Forex, Stocks or Futures financial instruments immediately.

24 November 2016

MetaTrader 5 Build 1485: Additional testing mode and graphics in the Standard Library

Terminal

  1. The order of entries in the terminal and MetaEditor journals has changed. Before the update, the latest log entries were featured first. Now the oldest entries are shown in the beginning of the journal. A more conventional reverse sorting order makes reading the journal easier.



    In addition, it is now possible to hide the 'Time' and 'Source' columns using the journal context menu.

  2. In the hedging mode, the ticket of a closed position is now displayed for the orders and deals in the trading history. This makes it easier to find related opening and closing operations.




  3. Fixed an error that caused copying of SL/TP from an existing position to a new position on the same instrument. The error could occur when using One Click Trading functions (for example, from the chart or from the Market Watch window) in the hedging mode.
  4. Fixed display of arrow objects on ultra-high-definition screens (4K).

MQL5

  1. A new ArrayPrint function has been added, which prints simple types and structures to the array log.
    void  ArrayPrint(
       const void&   array[],             // Printed array
       uint          digits=_Digits,      // The number of decimal places
       const string  separator=NULL,      // A separator between the values of the structure fields
       ulong         start=0,             // The index of the first displayed element
       ulong         count=WHOLE_ARRAY,   // The number of displayed elements
       ulong         flags=ARRAYPRINT_HEADER|ARRAYPRINT_INDEX|ARRAYPRINT_LIMIT|ARRAYPRINT_ALIGN    
       );
    
    ArrayPrint does not print all fields of a structure array to logs – array fields and pointer fields of objects are skipped. If you want to print all fields of a structure, you should use a custom function for the mass printing with a desired formatting.
    //--- Prints the values of the last 10 bars
       MqlRates rates[];
       if(CopyRates(_Symbol,_Period,1,10,rates))
         {
          ArrayPrint(rates);
          Print("Проверка\n[time]\t[open]\t[high]\t[low]\t[close]\t[tick_volume]\t[spread]\t[real_volume]");
          for(int i=0;i<10;i++)
            {
             PrintFormat("[%d]\t%s\t%G\t%G\t%G\t%G\t%G\t%G\t%I64d\t",i,
             TimeToString(rates[i].time,TIME_DATE|TIME_MINUTES|TIME_SECONDS),
             rates[i].open,rates[i].high,rates[i].low,rates[i].close,
             rates[i].tick_volume,rates[i].spread,rates[i].real_volume);
            }
         }
       else
          PrintFormat("CopyRates failed, error code=%d",GetLastError());
    //--- A log example
    /*
                        [time]  [open]  [high]   [low] [close] [tick_volume] [spread] [real_volume]
       [0] 2016.11.09 04:00:00 1.11242 1.12314 1.11187 1.12295         18110       10   17300175000
       [1] 2016.11.09 05:00:00 1.12296 1.12825 1.11930 1.12747         17829        9   15632176000
       [2] 2016.11.09 06:00:00 1.12747 1.12991 1.12586 1.12744         13458       10    9593492000
       [3] 2016.11.09 07:00:00 1.12743 1.12763 1.11988 1.12194         15362        9   12352245000
       [4] 2016.11.09 08:00:00 1.12194 1.12262 1.11058 1.11172         16833        9   12961333000
       [5] 2016.11.09 09:00:00 1.11173 1.11348 1.10803 1.11052         15933        8   10720384000
       [6] 2016.11.09 10:00:00 1.11052 1.11065 1.10289 1.10528         11888        9    8084811000
       [7] 2016.11.09 11:00:00 1.10512 1.11041 1.10472 1.10915          7284       10    5087113000
       [8] 2016.11.09 12:00:00 1.10915 1.11079 1.10892 1.10904          8710        9    6769629000
       [9] 2016.11.09 13:00:00 1.10904 1.10913 1.10223 1.10263          8956        7    7192138000
       Check
       [time] [open] [high] [low] [close] [tick_volume] [spread] [real_volume]
       [0] 2016.11.09 04:00:00 1.11242 1.12314 1.11187 1.12295 18110 10 17300175000 
       [1] 2016.11.09 05:00:00 1.12296 1.12825 1.1193 1.12747 17829 9 15632176000 
       [2] 2016.11.09 06:00:00 1.12747 1.12991 1.12586 1.12744 13458 10 9593492000 
       [3] 2016.11.09 07:00:00 1.12743 1.12763 1.11988 1.12194 15362 9 12352245000 
       [4] 2016.11.09 08:00:00 1.12194 1.12262 1.11058 1.11172 16833 9 12961333000 
       [5] 2016.11.09 09:00:00 1.11173 1.11348 1.10803 1.11052 15933 8 10720384000 
       [6] 2016.11.09 10:00:00 1.11052 1.11065 1.10289 1.10528 11888 9 8084811000 
       [7] 2016.11.09 11:00:00 1.10512 1.11041 1.10472 1.10915 7284 10 5087113000 
       [8] 2016.11.09 12:00:00 1.10915 1.11079 1.10892 1.10904 8710 9 6769629000 
       [9] 2016.11.09 13:00:00 1.10904 1.10913 1.10223 1.10263 8956 7 7192138000 
    */
    

  2. Fixed error in the addition of strings of type S1=S2+S1
  3. The behavior of the ArrayResize function has changed. If -1 is passed as the reserve_size parameter, the function only releases unused (reserved) memory if the function does not increase the array size. Setting the new array size to 0 with reserve_size=-1 is equivalent to the ArrayFree call. The new behavior allows optimizing memory usage in MQL5 programs.
    void OnStart()
      {
       int arr[];
    //--- Amount of memory initially used 
       Print("Array size:",ArraySize(arr)," Memory used:",MQLInfoInteger(MQL_MEMORY_USED)," MB");
    //--- Amount of memory used for the array of size 1, with a reserve
       ArrayResize(arr,1,1024*1024);
       Print("Array size:",ArraySize(arr)," Memory used:",MQLInfoInteger(MQL_MEMORY_USED)," MB");
    //--- After the increase of the array, the amount of memory used will not change due to the reserve
       ArrayResize(arr,1024*512,1024*1024);
       Print("Array size:",ArraySize(arr)," Memory used:",MQLInfoInteger(MQL_MEMORY_USED)," MB");
    //--- After reducing the array, the memory size will not change either
       ArrayResize(arr,1);
       Print("Array size:",ArraySize(arr)," Memory used:",MQLInfoInteger(MQL_MEMORY_USED)," MB");
    //--- Unused memory will be released after the removal of the reserve
       ArrayResize(arr,1,-1);
       Print("Array size:",ArraySize(arr)," Memory used:",MQLInfoInteger(MQL_MEMORY_USED)," MB");
      }
    

  4. Chart drawing functions have been added to the Standard Library. To use the new functionality, include MQL5\Include\Graphics\Graphic.mqh to your project.

    Plotting a chart based on three data series using GraphPlot:
    #include <Graphics/Graphic.mqh>
    
    double Func1(double x) { return MathPow(x,2); }
    double Func2(double x) { return MathPow(x,3); }
    double Func3(double x) { return MathPow(x,4); }
    
    void OnStart()
      {
       GraphPlot(Func1,Func2,Func3,-2,2,0.05,CURVE_LINES);
      }
    
    
    The result:


    Plotting a chart based on a data array using GraphPlot:
    #include <Math/Stat/Binomial.mqh>
    #include <Graphics/Graphic.mqh>
    
    void OnStart(void)
      {
       double    vars[101];
       double    results[101];
       const int N=2000;
    //---  
       MathSequence(0,N,20,vars);
       MathProbabilityDensityBinomial(vars,N,M_PI/10,true,results);
       ArrayPrint(results,4);
       GraphPlot(results);
    //---
      }
    
    The result:



  5. Updated functions for working with mathematical statistics in the Standard Library. We have thoroughly checked the quality and accuracy of all functions both in the MQL5 version and in the source R language. Unit tests are distributed along with the static library; the tests enable control over the accuracy and performance speed. They are available in the directory \MQL5\Scripts\UnitTests\Stat.

    • TestStat.mq5 — the main test script for checking calculation results
    • TestPrecision.mq5 — test of calculation precision
    • TestBenchmark.mq5 — the test includes computing performance measurement

Tester

  1. The updated version features advanced settings for configuring execution delays during testing. Now you can test your Expert Advisors in a variety of trading conditions, including the ideal case without a delay and any custom set delay.


    Only the random delay mode was available in earlier versions.

  2. Fixed generation of the tick volume of bars in the 'M1 based OHLC' mode.
  3. Fixed specification of order and position opening time up to milliseconds when trading in the hedging mode.
  4. Fixed "old tick" error, which could appear during multi-currency or multi-timeframe testing in the 'real ticks' mode.
  5. Improved CopyTicks performance speed when the requested ticks are read from a database located on a disk.

MetaEditor

  1. The file context menu in the Navigator and in the toolbox now features commands for working with the versioned source code repository MQL5 Storage.



  2. Fixed an error that could occasionally break the integrity of the local MQL5 Storage database when working with more than 1024 files in the repository.
  3. Fixed display of the file tree of MQL5 Storage.
  4. Fixed file display after a mass text replacement.

Updated documentation.

24 November 2016

MetaTrader 5 iOS build 1425
  • Improvements of the One Click Trading panel on the chart: it is now also available in the portrait mode; trade volume can be quickly changed by selecting a desired value from the list.


  • The chart symbol can now be changed by tapping on the symbol name in the window header.
  • Improvements in the app settings section: now it features information about the current account, properly arranged units, and improved designed.
  • Multiple improvements and fixes.

14 October 2016

MetaTrader 5 Build 1455: Libraries of mathematical functions in MQL5

Terminal

  1. Added tooltips for the Buy, Sell and Close buttons in trade dialogs. The tooltips contain information about the security to be bought or sold during the operation, to help beginners understand the trading process.




  2. Added new icons of orders, deals and positions in the "Trading" and "History" tabs.




  3. The updated terminal provides optimized and much faster (up to 4-5 times) display and update of the Market Depth, of the tick chart in the Market Depth, and of the Time & Sales data.
  4. Fixed synchronization of tick history during non-trading hours. The process could consume an excessive amount of network traffic in some cases.

MQL5

  1. An MQL5 version of the ALGLIB numerical analysis library has been included into the Standard Library.

    Library Features

    • Linear algebra
    • Systems of linear and nonlinear equations
    • Interpolation
    • Optimization
    • Fast Fourier transformation
    • Numerical integration
    • Linear and nonlinear least squares fitting
    • Ordinary differential equations
    • Special functions
    • Descriptive statistics and hypothesis testing
    • Data analysis - classification, regression
    • Implementing algorithms of linear algebra, interpolation, etc. in multiple-precision arithmetic (using MPFR)

    How to Use

    ALGLIB files are located in \MQL5\Include\Math\Alglib. To use the functions, add the main library file into your program:

    #include <Math\Alglib\alglib.mqh>

  2. Mathematical statistics functions have been included into the Standard Library. MQL5 now provides the functionality of the R language, which is one of the best tools for statistical data processing and analysis.

    Library Features

    The statistical library contains functions for calculating the statistical characteristics of data, as well as functions for operations with statistical distributions:

    • Functions for the calculation of statistical characteristics of array elements
    • Options for operations with statistical distributions: normal distribution, lognormal distribution, beta distribution, etc.

    How to Use

    The statistical library files are located in \MQL5\Include\Math\Stat. To use the library, add the file with required functions into your program, for example:

    #include <Math\Stat\Binomal.mqh>
    #include <Math\Stat\Cauchy.mqh>
    
    
    

    The detailed description of the library functions is available in the article Statistical Distributions in MQL5 - Taking the Best of R.


  3. The MQL5 version of the Fuzzy library has been included into the Standard Library. The Fuzzy library implements Mamdani and Sugeno fuzzy inference systems.

    Library Features

    • 13 membership functions
    • Flexible form for developing fuzzy system rules
    • Mamdani fuzzy inference system
    • Sugeno fuzzy inference system
    • 5 defuzzification method for Mamdani-type systems
    • Unlimited amount of input and output variables

    How to Use

    Fuzzy Library files are located in \MQL5\Include\Math\Fuzzy. To use the library, add the file with required functions into your program, for example:

    #include <Math\Fuzzy\mamdanifuzzysystem.mqh>
    #include <Math\Fuzzy\sugenofuzzysystem.mqh>
    
    
    

    A detailed description of the library is available in the Code Base: Fuzzy - library for developing fuzzy models


  4. New property CHART_QUICK_NAVIGATION allows enabling/disabling quick navigation bar in the chart. If you need to modify and access the property state, use the ChartSetInteger and ChartGetInteger functions.




    The navigation bar is opened by pressing Enter or Space. It allows you to quickly move to the specified date on the chart, as well as to switch symbols and timeframes. If your MQL5 program processes Enter or Space key pressing, disable the CHART_QUICK_NAVIGATION property, in order to avoid interception of these events by the terminal. The quick navigation bar can still be opened by a double click.

  5. New functions FileLoad and FileSave have been added. They provide an easy method to read and save arrays to files. Unlike FileRead* and FileWrite*, these functions do not require the indicator handle. FileLoad and FileSave operate with arrays of numeric types, as well as with simple structures that do not have strings, dynamic arrays or class objects.
    long  FileLoad(
       const string filename,      // [in] File name
       void         &buffer[],     // [out] An array to which the file is read
       uint         common_flag=0  // [in] 0 - search for the file in the Files folder of the terminal, FILE_COMMON - search in the common directory of terminals
       );
    
    bool  FileSave(
       const string filename,      // [in] File name
       const void   &buffer[],     // [in] An array to which the file is saved
       uint         common_flag=0  // [in] 0 - create a file in the Files folder of the terminal, FILE_COMMON - create in the common directory of terminals
       );
    
    
    An example of how to write ticks to a file and then read them:
    //--- input parameters
    input int      ticks_to_save=1000; // Number of ticks
    //+------------------------------------------------------------------+
    //| Script program start function                                    |
    //+------------------------------------------------------------------+
    void OnStart()
      {
       string  filename=_Symbol+"_ticks.bin";
       MqlTick ticks[];
    //---
       int copied=CopyTicks(_Symbol,ticks,COPY_TICKS_ALL,0,ticks_to_save);
       if(copied!=-1)
         {
          PrintFormat(" CopyTicks(%s) copied %d ticks",_Symbol,copied);
          //--- If the tick history is synchronized, the error code is equal to zero
          if(!GetLastError()==0)
             PrintFormat("%s: Ticks are not synchronized. Error=",_Symbol,copied,_LastError);
          //---  Writing ticks to a file
          if(!FileSave(filename,ticks,FILE_COMMON))
             PrintFormat("FileSave() failed, error=%d",GetLastError());
         }
       else
          PrintFormat("Failed CopyTicks(%s), Error=",_Symbol,GetLastError());
    //--- Now reading the ticks back to the file
       ArrayFree(ticks);
       long count=FileLoad(filename,ticks,FILE_COMMON);
       if(count!=-1)
         {
          Print("Time\tBid\tAsk\tLast\tVolume\tms\tflags");
          for(int i=0;i<count;i++)
            {
             PrintFormat("%s.%03I64u:\t%G\t%G\t%G\t%I64u\t0x%04x",
             TimeToString(ticks[i].time,TIME_DATE|TIME_SECONDS),ticks[i].time_msc%1000,
             ticks[i].bid,ticks[i].ask,ticks[i].last,ticks[i].volume,ticks[i].flags);
            }
         }
      }
    
    

  6. Modified display of custom indicators with the DRAW_CANDLES drawing mode. Now it is possible to set from one to three colors for this mode. The display of candlesticks depends on how many colors are set.

    If one color is specified, all candlesticks on the chart will be fully painted in this color.
    //--- Candlesticks painted in the same color 
    #property indicator_label1  "One color candles"
    #property indicator_type1   DRAW_CANDLES
    //--- Only one color is specified, so all candlesticks are the same color
    #property indicator_color1  clrGreen  
    
    
    If two colors are specified, one color is used for candlestick edges, the other one is used for the body.
    //--- The color of the candlesticks differs from the color of shadows
    #property indicator_label1  "Two color candles"
    #property indicator_type1   DRAW_CANDLES
    //--- Candlestick edges and shadows are green, body is white
    #property indicator_color1  clrGreen,clrWhite 
    
    
    If three colors are specified, one color is used for candlestick edges, two other colors are used for the bodies of bullish and bearish candlesticks.
    //--- The color of the candlesticks differs from the color of shadows
    #property indicator_label1  "One color candles"
    #property indicator_type1   DRAW_CANDLES
    //--- Candlestick edges and shadows are green, the body of a bullish candle is white, the body of a bearish candle is red
    #property indicator_color1  clrGreen,clrWhite,clrRed
    
    
    The DRAW_CANDLES style allows setting custom colors of candlesticks. All colors can also be changed dynamically while the indicator is running, using the function PlotIndexSetInteger(drawing_index_DRAW_CANDLES, PLOT_LINE_COLOR, modifier_number, color) where modifier_number can have the following values:
    • 0 – the color of edges and shadows
    • 1 – the color of the bullish candlestick body
    • 2 – the color of the bearish candlestick body
    //--- Setting the color of edges and shadows
    PlotIndexSetInteger(0,PLOT_LINE_COLOR,0,clrBlue);
    //--- Setting the color of the bullish candlestick body
    PlotIndexSetInteger(0,PLOT_LINE_COLOR,1,clrGreen);
    //--- Setting the color of the bearish candlestick body
    PlotIndexSetInteger(0,PLOT_LINE_COLOR,2,clrRed);
    
    
  7. Fixed bugs and improved operation with the tick history using CopyTicks functions.
  8. Starting with the new build, operators can be used in interfaces (was not allowed before).

Market

  1. Fixed an error that could lead to the repeated request to sign in to MQL5.community when buying products from the Market.

Tester

  1. Added UI translation into Greek, Malay and Hebrew.

Updated documentation.

29 September 2016

MetaTrader 5 web platform: Code optimization and new interface features
  • Added the ability to re-size the web application blocks, including Market Watch and price chart windows.
  • Added the ability to sort by columns in Trade and History tabs of Toolbox window. The column width can be changed.
  • Added Details tab and the ability to quickly add a symbol.
  • Optimized the code to increase the overall web terminal operation speed. Account initialization, adding symbols and trading itself are now performed even faster.

26 September 2016

MetaTrader 5 iOS build 1403
  • Changed Trade section display — trading data representation now depends on the risk management system on a trading account: Retail Forex, futures or Exchange model. 


  • Moved interface language selection to a separate menu item in the general settings.
  • Fixes and improvements.

26 September 2016

MetaTrader 5 Android build 1372
  • The platform supports the multi-window mode allowing traders to monitor price changes on multiple symbols simultaneously.
  • Added the ability to change an indicator subwindow height.
  • Now, the mobile platform features a symbol fast selection button and a separate menu of chart settings.


  • Added the ability to edit indicator levels.
  • The interface is translated into Bulgarian.

16 September 2016

MetaTrader 5 Build 1430: Updated Exposure tab

Terminal

  1. Implemented the new algorithm of forming the Exposure tab for an exchange market. Now, the platform adapts the display of assets depending on the risk management system applied to a trading account: Retail Forex, futures or Exchange model.

    The Assets section is helpful for those trading Forex or futures at an exchange showing their current status on the market. Same currencies can be found in a variety of different symbols: as one of the currencies in a pair, as a base currency, etc. For example, you may have oppositely directed positions on GBPUSD, USDJPY and GBPJY. In this situation, it is very difficult to understand how much currency you have and how much you need. Having more than three positions further complicates the task. In this case, the total account status can be easily seen in the Assets tab.
    Let's use the same three positions as an example:

    Buy GBPJPY 1 lot at 134.027 — received 100 000 GBP, given 134 027 000 JPY
    Sell USDJPY 1 lot at 102.320 — given 100 000 USD, received 102 320 000 JPY
    Sell GBPUSD 1 lot at 1.30923 — given 100 000 GBP, received 103 920 USD

    We have bought and sold 100 000 GPB simultaneously. We have 0 GBP, and the Assets tab does not display this currency. As of USD, we gave a currency in one case and received it in another. The Assets tab calculates the final outcome and adds it to the current balance since the deposit currency is USD as well. JPY participated in two deals meaning that the tab displays its total value.




    Those using the exchange model can use the section to understand how their money is used. Unlike the previous model, the funds are withdrawn/added right when deals are performed. For example, if you buy EURRUB, you receive EUR at once while the appropriate sum in RUB is withdrawn from the balance. During trading, the account balance may even become negative: when you use borrowed money while purchased assets are used as the collateral. In this case, the Assets tab allows you to easily understand the trading account status.

    Additionally, you can see the liquidation value here — amount of funds on the account and the price (result) of closing all current positions at the market price.





  2. Fixed deal type display in the history of trading operations.
  3. Terminal: Fixed repeated risk notification window display when re-connecting to a trading account.
  4. Optimized and fixed working with the trading symbol selection dialog in case of a large number of symbols (several thousands and more).
  5. Fixed display of levels of built-in indicators calculated based on Moving Average (Bollinger Bands, Adaptive Moving Average, etc.). Previously, an error occurred when plotting indicators in a separate subwindow.
  6. Fixed an error that could occasionally interfere with placing a futures contract order in case an order price coincides with the upper or lower contract price limit.

MQL5

  1. Optimized and accelerated compilation of MQL5 applications.
  2. Added support for 'final' and 'override' modifiers for classes, structures and functions.

    'final' modifier for classes and structures
    The presence of the 'final' modifier when declaring a structure or a class prohibits the further inheritance from it. If there is no need to make any further changes in the class (structure) or such changes are unacceptable for security reasons, declare that class (structure) with the 'final' modifier. In this case, all class methods are also implicitly considered 'final'.
    class CFoo final
      {
      //--- class body
      };
     
    class CBar : public CFoo
      {
      //--- class body
      };
    When attempting to inherit from a class with the 'final' modifier as shown above, the compiler displays an error:
    cannot inherit from 'CFoo' as it has been declared as 'final'
    see declaration of 'CFoo'

    'override' modifier for functions
    The 'override' modifier means that a declared function should always override the parent class method. Using the modifiers allows you to avoid errors when overriding, such as accidental change of a method signature. For example, the 'func' method accepting the 'int' type variable is defined in the base class:
    class CFoo
      {
       void virtual func(int x) const { }
      };
    The method is overridden in the inherited class:
    class CBar : public CFoo
      {
       void func(short x) { }
      };
    But the argument type is mistakenly changed from 'int' to 'short'. In fact, the method overload instead of overriding is performed in that case. While acting according to the overloaded function definition algorithm, the compiler may in some cases select a method defined in the base class instead of an overridden one.

    In order to avoid such errors, the 'override' modifier should be explicitly added to the overridden method.
    class CBar : public CFoo
      {
       void func(short x) override { }
      };
    If the method signature is changed during the overriding process, the compiler cannot find the method with the same signature in the parent class issuing the compilation error:
    'CBar::func' method is declared with 'override' specifier but does not override any base class method

    'final' modifier for functions

    The 'final' modifier acts in the opposite way — it disables method overriding in derived classes. If the method implementation is self-sufficient and fully completed, declare it with the 'final' modifier to ensure it is not changed later.
    class CFoo
      {
       void virtual func(int x) final { }
      };
     
    class CBar : public CFoo
      {
       void func(int) { }
      };
     
    When attempting to override a method with the 'final' modifier as shown above, the compiler displays an error:
    'CFoo::func' method declared as 'final' cannot be overridden by 'CBar::func'
    see declaration of 'CFoo::func'
  3. Fixed compiling template functions with default parameters.

Market

  1. Fixed a few errors in sorting Market products.

Tester

  1. Fixed updating the current market prices for open orders and positions in the visual testing mode.
  2. Removed slippage during Buy Limit and Sell Limit order execution when testing using exchange symbols.
  3. Fixed occasional generation of incorrect prices in "Open prices" testing mode.
  4. Fixed generation of OnTradeTransaction events when testing.
  5. When testing based on real ticks, the data on the mismatch of tick prices (bid or last depending on the price used to generate a bar) and low or high values of the existing minute bar appears in the tester log.

MetaEditor

  1. Fixed displaying the data profiling in source code files.

Updated documentation.


19 August 2016

MetaTrader 5 build 1395: Faster trade operations and visual testing improvements

Terminal

  1. The client terminal now provides for faster sending of trading commands.
  2. Fixed an error which prevented execution of MQL5 applications in terminals running in 32-bit Windows 10, build 1607.
  3. The Navigator now displays whether a trading account is operating in the Hedging or Netting mode.
  4. A new context menu command has been added to the Navigator, it allows to connect to a web terminal using a selected account.
  5. The Help section of the menu has been updated, now it features links to video guides.
  6. Error fixes connected with operation on high-resolution displays (4K).
  7. Fixed errors in Persian translation of the user interface.

MQL5

  1. Added new 'void *' pointers to enable users to create abstract collections of objects. A pointer to an object of any class can be saved to this type of variable.
    It is recommended to use the operator dynamic_cast<class name *>(void * pointer) in order to cast back. If conversion is not possible, the result is NULL.
    class CFoo { };
    class CBar { };
    //+------------------------------------------------------------------+
    //| Script program start function                                    |
    //+------------------------------------------------------------------+
    void OnStart()
      {
       void *vptr[2];
       vptr[0]=new CFoo();
       vptr[1]=new CBar();
    //---
       for(int i=0;i<ArraySize(vptr);i++)
         {
          if(dynamic_cast<CFoo *>(vptr[i])!=NULL)
             Print("CFoo * object at index ",i);
          if(dynamic_cast<CBar *>(vptr[i])!=NULL)
             Print("CBar * object at index ",i);
         }
       CFoo *fptr=vptr[1];  // Will return an error while casting pointers, vptr[1] is not an object of CFoo
      }
    //+------------------------------------------------------------------+
  2. Added support for the operator [ ] for strings. The operator enables users to get a symbol from a string by index. If the specified index is outside the string, the result is 0.
    string text="Hello";
    ushort symb=text[0];  // Will return the code of symbol 'H'
    
  3. Added a second version of the TesterInit event handler with the int OnTesterInit(void) signature, which can return INIT_SUCCEEDED (0) or INIT_FAILED (or any non-zero value). If OnTesterInit returns a non-zero value, the optimization will not begin.
  4. Fixed an error, which could lead to different results returned by different ChartGetString overloaded functions.

Tester

  1. Added new commands and hot keys for visual testing. Now it is possible to configure charts in the visual tester like in the terminal: to change colors, to control visibility of various elements, to apply templates, etc.




  2. Fixed operation of the Sleep function in the "Open prices" testing mode.
  3. Fixed formation of incorrect state of bars on timeframes W1 and MN1.

MetaEditor

  1. Added UI translation into Traditional Chinese.
Updated documentation.

8 August 2016

MetaTrader 5 iOS build 1371
  • A new design of messages. Now, MQL5.community messages and push notifications from the desktop platform are displayed as chats similar to popular mobile messengers.
  • Now it is possible to switch to one of the 23 available languages straight from the platform. For example, if you prefer to use the English interface, you can choose it in the "About" page without changing the language setting of your device.

5 August 2016

MetaTrader 5 Android build 1338
  •  New built-in MQL5.community chat.
  •  New option for transferring SSL certificates from a desktop platform.
  •  New interface translations into Persian and Dutch.

17 July 2016

MetaTrader 5 Platform build 1375: Time & Sales and access to ticks during testing

Terminal

  1. The Time & Sales feature has been added to the Market Depth.




    What is Time & Sales?
    The Time & Sales feature provides the price and time of every trade executed on the exchange. Information on every trade includes the time when the trade was executed, its direction (buying or selling), as well as the price and volume of the trade. For easy visual analysis, different colors are used to indicate different trade directions: blue is used for Buy trades, pink for Sell trades, green means undefined direction. Trade volumes are additionally displayed in a histogram.

    How Time & Sales can help you understand the market
    The Time & Sales feature provides tools for a more detailed market analysis. The trade direction suggests who has initiated the trade: the buyer or the seller. The volume of trades allows traders to understand the behavior of market participants: whether the trades are performed by large or small market players, as well as estimate the activity of the players. The trade execution speed and the volume of trades on various price levels help traders to estimate the importance of the levels.

    How to use Time & Sales data
    In addition to the visual analysis of the table, you can save the details of trades to a CSV file. Further, they can be analyzed using any other software, such as MS Excel. The file contains comma-separated data:
    Time,Bid,Ask,Last,Volume,Type
    2016.07.06 16:05:04.305,89360,89370,89370,4,Buy
    2016.07.06 16:05:04.422,89360,89370,89370,2,Buy
    2016.07.06 16:05:04.422,89360,89370,89370,10,Buy
    2016.07.06 16:05:04.669,89360,89370,89370,1,Buy
    2016.07.06 16:05:05.968,89360,89370,89360,7,Sell
    If you want to save data to a file, open the context menu:



    The broker's platform should be updated to version 1375, in order to enable proper detection of trade direction.
  2. The time between the arrival of a new tick/Market depth change and call of OnTick and OnCalculate has been significantly reduced. Also the time between the arrival of a trade state change event and call of OnTick and OnCalculate has been reduced. Now MQL5 programs provide a faster response to market events.
  3. Trade requests are now sent faster when extended authentication with SSL certificates is used.
  4. User interface translation into Persian has been updated.
  5. Fixed display of SL/TP setting commands in the context menu of the chart when working in the hedging mode.

Tester

  1. A new tester feature allows requesting tick history while testing using the CopyTicks function. In earlier versions, access to ticks was not available in the Strategy Tester.

    • In the "Every tick" mode, the function will return the history of generated ticks. It is possible to request up to 128,000 last ticks.
    • In the "Every tick based on real ticks" mode, the function will return the history of real ticks. The depth of the requested data depends on the availability of history data. However, note that last 128,000 ticks are cached in the Strategy Tester, and the request will be performed quickly. A deeper history is requested from a hard disk, so the request execution can take much more time.
    • The function will not work in the modes "Open price only" and "1 minute OHLC", because tick history is not created in these modes.

  2. Added support for milliseconds. In previous versions, the time quantum in the Strategy Tester was equal to one second.

    • Now the EventSetMillisecondTimer and Sleep functions are more accurate in the Tester.
    • The accuracy of tick feeding during multi-currency EA testing has been increased. In earlier versions, if one second contained multiple ticks (i.e. the tick volume of a one-minute bars exceeded 60), the same time was set for all these ticks. It does not matter when testing single-currency Expert Advisor, because ticks are sequentially passed to the Expert Advisor. However, when you test an Expert Advisor on multiple pairs, it is important to know the pair, from which the tick has arrived first. In earlier versions, ticks of each symbol were passed to the Expert Advisor sequentially: first, all the ticks within one second for one symbol, then all the ticks for another symbol. Now they are sent taking into account milliseconds.

      When real ticks are used in testing, milliseconds are taken from the source tick data. When ticks are generated, milliseconds are set in accordance with the tick volume. For example, if 3 ticks fit within one second, their millisecond time will be equal to 000, 333 and 666.

  3. In the "Open prices only" and "1 minute OHLC" modes, pending and SL/TP orders are now executed at the requested price, not the current price at the time of execution. The algorithm of execution at market prices used in accurate modes (every tick and real ticks), is not suitable for less accurate modes. In some modes intermediate ticks are not generated, therefore the difference between the requested order price and the current price (Open or OHLC) can be significant. Execution of orders at the requested price in the "Open prices only" and "1 minute OHLC" provides more accurate testing results.

  4. Added support for forward testing in the visual mode. Now two separate windows are opened for back and forward testing, allowing users to compare Expert Advisor performance on different time intervals.




    The forward testing window is only opened after testing on the main period is completed.

  5. Now, instead of the margin level, the load on the deposit is displayed on the main testing chart. The load is calculated as the margin/equity ratio.



  6. Fixed calculation of commission as a percentage per annum during testing.

  7. Fixed calculation and display of balance on the chart generated in the process of testing.

MQL5

  1. The behavior of the OrderSend function during order placing, modification, and canceling has changed. The changes only apply to orders sent to external trading systems. In earlier version, OrderSend function control was returned after the order has been successfully placed (handled) on the broker's server. Now the control is only returned after the broker's server receives a notification from an external trading system notifying that the order has been successfully placed in that system.

    The below diagram shows the previous (red arrow) and current behavior of the function:




  2. A new field in the MqlTradeResult structure: retcode_external - an error code in the external trading system. The use and types of these errors depend on the broker and the external trading system, to which trading operations are sent. For example, retcode_external values filled by Moscow Exchange differ from those returned by DGCX.

  3. New properties in the ENUM_CHART_PROPERTY_STRING enumeration: CHART_EXPERT_NAME and CHART_SCRIPT_NAME. Now, the ChartGetString function allows users to find out the name of an Expert Advisor and/or script attached to a chart which is defined by the chart_id parameter.

Signals

  1. Fixed occasional error, due to which copying of the 'close by' operation could fail.
  2. Improved automated matching of currency pairs containing RUB and RUR.

Market

  1. Fixed sorting by product category.

MetaEditor

  1. Fixed setting of focus in the replace text field when opening a replace dialog box.
  2. Fixed replacing of multiple text occurrences when you search upwards starting from the current positions.


Updated documentation.

5 July 2016

MetaTrader 5 Web Platform: Official release

After two months of public testing, the web version of the multi-asset MetaTrader 5 platform has been officially released. It allows trading Forex and exchanges from any browser and operating system. Only Internet connection is necessary, no software installation is required.

The application combines the key advantages of the desktop platform (high speed, support for multiple markets and expanded trading functions) with the convenience of the cross-platform nature of the web terminal. The key feature of the release version is the depth of market, which was not present in the beta version.

The web platform allows traders to perform technical analysis and trading operations just like in the desktop version. The web platform provides the following features:

  • Netting and hedging position accounting systems
  • 31 technical indicators
  • 23 analytical objects
  • One-click trading and full set of trading orders
  • Interface in 41 languages

19 May 2016

MetaTrader 5 iOS build 1335

It is now much easier to transfer SSL certificates from the desktop platform to the mobile one. You no longer need iTunes to do that.

MetaTrader 5 allows you to add an extra protection to your account by using a certificate. Without the certificate, connection is impossible. If the certificate was created in the desktop version, you should transfer it to be able to enter your account via a mobile device.

To do this, open a desktop platform, right-click the necessary account in the Navigator window, and select Transfer. Set the certificate password which is known only to you, open the mobile platform, and connect to your account. You will be immediately offered to import the certificate.

Besides, the latest version features the migration dialog for accounts transferred from MetaTrader 4. If your account has been transferred to the 5th generation platform, you are warmly greeted, provided with information on the new features, and offered to change your password.

13 May 2016

MetaTrader 5 Platform build 1340: Convenient transfer of certificates to mobile devices and Strategy Tester improvements

Terminal

  1. Now certificates used for the advanced security connection can be conveniently transfered from the desktop platform to mobile terminals.

    The trading platform supports extended authentication by protecting a trade account using an SSL certificate in addition to a password. The certificate is a file that is individually generated for an account on the trade server. This file is unique, and account connection is not possible without the certificate.

    In the earlier platform versions, any certificate requested and generated from the desktop terminal needed to be manually copied and installed on the device to enable use of the trading account from the MetaTrader 5 Mobile for iPhone/iPad or Android. Now, certificates can be conveniently transfered.

    The Process of Certificate Transfer
    A certificate is transfered via a trade server:

    • A certificate is first encrypted on the desktop terminal: the account owner sets the password for certificate encryption using the secure AES-256 algorithm. This password is only know to the user, while it is not sent to the server.
    • Further, the encrypted certificate is sent to the trade server, where it is stored until the mobile terminal receives it, but no more than one hour.
    • To receive the certificate on a mobile device, the user must connect to the trading account from the mobile terminal. After connecting, the user is prompted to import the certificate. To proceed with the import, the user needs to specify the password that was used for the certificate encryption on the desktop terminal.

    Certificate transfer process is secure: the trade server is only used as an intermediate storage, while the certificate is encrypted on the client's side. The certificate password is not transmitted to or stored on the trade server.

    How to Transfer a Certificate
    Connect to your account from the desktop terminal and select "Transfer Certificate" in its context menu:



    Enter the master password of the account to confirm that it belongs to you. Next, set a password to protect the certificate before sending it to the server. Set a password that has at least 8 digits.

    After successfully sending the certificate to the server, open the mobile terminal and connect to your account. You will immediately be prompted to import the certificate. Confirm and enter the password that you have set from the desktop terminal.



    You can view the imported certificate in the "About — Certificates" section.
    Updated MetaTrader 5 Platforms for iPhone/iPad and Android supporting certificate transfer will be released soon.

Tester

  1. An updated algorithm for the execution of pending orders, as well as SL ans TP, which provides more accurate testing conditions. Advanced options of visual testing.

    What's New for Exchange Instruments
    In the real market, charts of exchange-traded instruments are generated based on Last price information (the price of the last executed deal). Stop Orders also trigger at the Last price. Limit orders trigger at Bid and Ask prices. All types of orders are always executed at the current market Bid/Ask prices. The Strategy Tester has been updated and now better emulates real market conditions:
      Before
    After
    Triggering Bid/Ask for all types of Pending Orders and SL/TP
    Bid/Ask for Limit Orders
    Last for Stop, Stop-Limit and SL/TP orders
    Execution The price specified in the order for all types of Pending Orders and SL/TP
    Bid/Ask at the time of order triggering for all types of Pending Orders and SL/TP

    Let us consider an example of the Si-6.16 symbol. A new Buy Stop order with the trigger price = 72580 is set while the current prices are: Bid=72570, Ask=72572, Last=72552. New current prices are received in a price stream:

    • Bid=72588
    • Ask=72590
    • Last=72580


    A trigger for Stop-Orders of exchange instruments is the Last price. So the Last price=72580 received in the stream activates the Buy Stop order. In the earlier versions, the same price would be used to execute this order. This behavior is incorrect, because there is no Ask=72580 in the market to execute the Buy transaction.


    The current Ask=72590 is used in the updated tester version, so the Buy Stop order is executed at this price. The new trade execution algorithm in the Tester is closer to real market conditions. The trade operation would be executed at a non-market price when using the previous algorithm, which would lead to inaccurate testing results.

    What's New for Other Instruments
    The algorithm has not changed for other instruments: Bid/Ask prices are used for all types of pending orders, as well as for SL and TP. However, the execution mode has changed: in earlier versions, orders were executed at the price specified in the order. Now market Bid and Ask prices as of the time of order activation are used.

    What's New in Visual Testing
    During visual testing, the bar's High Ask and Low Bid price lines are now shown in the tester. On such charts, it is more convenient to test Expert Advisors that trade exchange instruments, because bars of such instruments, as well as order triggering are based on the Last prices, while market operations are executed at Bid and Ask prices.



    New option on the visual testing chart: navigation to a specified date. Double-click on the chart and enter the desired date and time. It is also possible to navigate to any order or trade: double-click on the appropriate trading operation on the Trade, History or Operations tab.
  2. Expanded logging of information about price and tick history loaded before testing start. The log now contains information about the completion of history loading, as well as the amount of data downloaded and time spent:
    2016.05.10 12:47:53    Core 1    5.10 Mb of history processed in 0:00.842
    2016.05.10 12:47:53    Core 1    GBPUSD: history synchronization completed [5225 Kb]

MQL5

  1. Fixed behavior of the CopyTicks function: it could return fewer ticks than was requested.
  2. Fixed generation of template functions.
  3. Updated documentation.

Fixed errors reported in crash logs.

123456789