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

 

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

MetaTrader 5 platform update is to be released on December 9, 2016. It contains the following changes:

  1. MQL5: Added the CopyTicksRange function.
  2. MQL5: Added improved anti-aliasing functions to CCanvas class:
  3. MQL5: 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. MQL5: 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. MQL5: 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");
  6. Fixed errors reported in crash logs.

The update will be available through the LiveUpdate system.
 

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

The MetaTrader 5 platform update will be released on Friday, January 27, 2017. The new version features the following changes:

  1. Terminal: 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. Terminal:  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. Terminal: 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. Terminal: 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. Terminal: 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.
  6. MQL5: 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]
    

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

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

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

  10. MQL5: 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);
         }
      }

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

  12. MQL5: Fixed error that could occasionally cause skipping of ticks in the tick history.
  13. MQL5: Fixed indirect template typing errors.
  14. MQL5: Updated library of mathematical statistics functions.
  15. Market: Fixed product page opening when downloading a demo version.
  16. Tester: After optimization completion, results are now automatically sorted by the "Results" column.
  17. Tester: A new command in the context menu of the optimization results tab allows to automatically open results when the optimization completes.
  18. Tester: 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.
  19. Tester: 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.



  20. Tester: Added UI translations into Mongolian, Hungarian, Romanian and Urdu.
  21. MetaEditor: 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.




  22. MetaEditor: Fixed determining of source file encoding.
  23. MetaEditor: Fixed search by files in the UTF-8 encoding.
  24. MetaEditor: Fixed text selection with a mouse in case the text contains tabs.
  25. MetaEditor: Added UI translations into Hungarian and Romanian.
  26. Updated documentation.

The update will be available through the LiveUpdate system.

 

Forum on trading, automated trading systems and testing trading strategies

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

MetaQuotes Software Corp., 2017.02.15 16:39

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

The MetaTrader 5 platform update will be released on February 17, 2017. The update will feature the following changes:

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



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




  3. Terminal: 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. Terminal: Significantly reduced load on the terminal, created by invisible (minimized) charts and objects.
  5. Terminal: Fixed occasional incorrect triggering of trailing stop levels.
  6. Terminal: Fixed filtering of trades by symbol in the account trading history.
  7. Terminal: Fixed display of the 'Type' field in the history of positions.
  8. Terminal: Fixed presentation of the trading history in the form of positions.
  9. MQL5: 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.
  10. MQL5: Fixed template typing using a constant pointer.
  11. MQL5: Fixed control of access to private and protected class members.
  12. Tester: 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).
  13. Tester: Removed restriction connected with testing of custom indicators having more than 64 input parameters.
  14. Tester: Added UI translation into Hindi.
  15. Updated documentation.

The update will be available through the LiveUpdate system.


 

Forum on trading, automated trading systems and testing trading strategies

New MetaTrader 5 Platform Build 1570: Improved Market showcase and extended MQL5 template functions

MetaQuotes Software Corp., 2017.03.22 17:03

New MetaTrader 5 Platform Build 1570: Improved Market showcase and extended MQL5 template functions

MetaTrader 5 platform update is to be released on March 24, 2017. The update will feature the following changes:

  1. Terminal: Updated the showcase of the MetaTrader Market store of applications. Now, you can browse through trading robots and technical indicators more conveniently. We have updated the design and added product selections:

    • The main page now features popular experts, indicators, new Market products, as well as top free applications.
    • The Experts, Indicators and Utilities sections now have subsections: grid and hedging robots, trend and multi-currency indicators, and much more.




  2. Terminal: Fixed the client terminal update and built-in purchases in the Market, Signals and Virtual Hosting when using a Windows account with limited rights.
  3. Terminal: Fixed occasional incorrect sorting of position history.
  4. Terminal: Optimized and fixed display of the Exposure tab.
  5. MQL5: Added support for overloading template functions using parameters. For example, we have a template function that writes the value of the second parameter to the first one using typecasting. MQL5 does not allow typecasting string to bool. However, we can do that ourselves. Let's create an overload of a template function:
    //+------------------------------------------------------------------+
    //| Template function                                                |
    //+------------------------------------------------------------------+
    template<typename T1,typename T2>
    string Assign(T1 &var1,T2 var2)
      {
       var1=(T1)var2;
       return(__FUNCSIG__);
      }
    //+------------------------------------------------------------------+
    //| Special overload for bool+string                                 |
    //+------------------------------------------------------------------+
    string Assign(bool &var1,string var2)
      {
       var1=(StringCompare(var2,"true",false) || StringToInteger(var2)!=0);
       return(__FUNCSIG__);
      }
    //+------------------------------------------------------------------+
    //| Script program start function                                    |
    //+------------------------------------------------------------------+
    void OnStart()
      {
       int i;
       bool b;
       Print(Assign(i,"test"));
       Print(Assign(b,"test"));
      }
    As a result of the code execution, we can see that the Assign() template function has been used for the int+string pair, while the overloaded version has already been used for the bool+string pair during the second call.
    string Assign<int,string>(int&,string)
    string Assign(bool&,string)

  6. MQL5: Added explicit specialization of template functions. To do this, specify typification parameters before the list of the call parameters:
    template<typename T>
    T Func() { return (T)0; }
      
      
    void OnInit()
      {
       Func<double>();   // explicit template function specialization
      }
    Thus, typification is performed by explicit specification of types rather than via the call parameters.

  7. MQL5: Optimized display of custom indicators with the DRAW_ZIGZAG drawing type.
  8. MQL5: Added the new values to the ENUM_DEAL_TYPE deal types enumeration:

    • DEAL_DIVIDEND — dividend operations.
    • DEAL_DIVIDEND_FRANKED — franked (non-taxable) dividend operations (tax is paid by a company, not a client).
    • DEAL_TAX — charging a tax.

  9. MQL5: Fixed display of custom indicators with the DRAW_FILLING drawing type. In case the upper and lower line coordinates coincide, a thin line is drawn.
  10. MQL5: Fixed calculating the Bitmap Label object coordinates when setting the CHART_SHOW parameter to 'false'. The parameter is set by the ChartSetInteger function and allows hiding all price chart elements to create a custom program interface.
  11. MQL5: Fixed re-encoding of 24-bit images when placing them to MQL5 application resources.
  12. MQL5: Fixed printing structures using the ArrayPrint function.
  13. MQL5: Updated the MQL5 standard libraries.
  14. MetaEditor: Added translation of the user interface into Malay.
  15. Signals: Fixed opening a signal page in the terminal when moving from the MQL5.community website while not connected to a trading account.
  16. Tester: Fixed the CopyTicks function operation in the strategy tester.
  17. Tester: Fixed sorting Withdrawal trades when generating a report.
  18. Tester: Fixed modifying pending orders.
  19. Hosting: Fixed display of the virtual hosting wizard on ultra-high resolution screens (4К).
  20. Updated documentation.

The update will be available through the LiveUpdate system.


 

Forum on trading, automated trading systems and testing trading strategies

New MetaTrader 5 Platform Build 1595: Access to the price history

MetaQuotes Software Corp., 2017.04.19 17:10

New MetaTrader 5 Platform Build 1595: Access to the price history

The MetaTrader 5 platform update will be released on April 21, 2017. The update will feature the following changes:

  1. Terminal: Added access to the bar and tick history. Now, it is possible to download the full 1-minute and tick history from the server through the trading platform interface, not only using the MQL5 language. Access to price data is expanded as part of preparations for the launch of custom data-feed functions. In the near future, the platform will provide the possibility to build charts based on users' price data, as well as to create synthetic symbols and use offline charts.

    To download the data, open the symbol management dialog from the context menu of the "Market Watch" window:


    The dialog features two new tabs: "Bars" and "Ticks". Select the symbol, the desired time interval and click "Request". The platform will request from the server all available data, and will immediately display the data if they have already been downloaded. Saved price data can be exported to a CSV file.

  2. Terminal: Added display of time with a millisecond precision for positions, deals and orders.




  3. Terminal: In the trade dialog, fixed notifying about the refusal to execute a Close By request.
  4. MQL5: Fixed the PositionSelect function. The function could occasionally select a position different from the one having the lowest ticket number.
  5. MQL5: Fixed operation of the CopyTicks and CopyTicksRange functions when requesting very deep tick history data.
  6. Signals: Fixed copying of operations that increase the size of an existing position. The error could occasionally occur on netting accounts.
  7. Tester: Fixed processing of limit orders for exchange instruments. Orders placed better than the market (the buy price is below the market price or the sell price is above that) are executed without slippage. Orders placed worse than the market or at the market price are executed immediately at the market price as of the order placing time.
  8. Updated documentation.

The update will be available through the LiveUpdate system.


 

Forum on trading, automated trading systems and testing trading strategies

New MetaTrader 5 Platform Build 1640: Creating and testing custom symbols

MetaQuotes Software Corp., 2017.07.19 18:15

New MetaTrader 5 Platform Build 1640: Creating and testing custom symbols

MetaTrader 5 platform update is to be released on July 21, 2017. The update will feature the following changes:

  1. Terminal: Now it is possible to create custom financial instruments in the terminal. Using the new option, you can create any symbol, configure its settings, import your price data to the symbol and view its charts.

    Creating a Custom Symbol
    Open the symbol management window using the context menu of the "Market Watch" window and click on "Create Custom Symbol":



    A large number of symbol parameters can be configured. The full list of parameters and their description is available in the documentation. You can quickly configure your custom symbol by copying parameters of any similar instrument and modifying them. Select an existing symbol in the "Copy from" field.
    The name of the custom symbol must not match the names of symbols provided by the brokers. If you connect to the server, on which a symbol with the same name exists, the custom symbol will be deleted.
    Commands for importing and exporting parameters are also available here. You can easily share custom symbols or transfer symbols between your terminals. Settings are exported to JSON text files.

    Managing Custom Symbols
    All symbols are displayed in a separate Custom group. If you need to modify or delete a symbol, use the context menu of the list:




    Importing the Price History
    You can import price data to your custom symbol from any text file. Choose a symbol and go to the "Bars" tab.



    In the import dialog, specify the path to the file and set the required parameters:

    • Separator — element separator in a text file.
    • Skip columns and rows — amount of columns (from left to right) and rows (top to bottom) to be skipped during an import.
    • Shift — time shift by hours. The option is used when importing data saved in a different time zone.
    • Use selected only — import only rows highlighted in the row view area. You can highlight rows with your mouse while holding Ctrl or Shift.

    A file with 1-minute bars should have the following format: Date Time Open High Low Close TickVolume Volume Spread. For example;
    2016.06.27    00:01:00    1.10024    1.10136    1.10024    1.10070    18    54000000    44
    2016.06.27    00:02:00    1.10070    1.10165    1.10070    1.10165    32    55575000    46
    2016.06.27    00:03:00    1.10166    1.10166    1.10136    1.10163    13    13000000    46
    2016.06.27    00:04:00    1.10163    1.10204    1.10155    1.10160    23    51000000    41
    You can use data from any existing instrument for your custom symbol. Export data (the option was added in the previous platform version), modify them if necessary, and import the data back.
    The price history is stored in the form of one-minute bars in MetaTrader 5. All other timeframes are created based on these bars. You can also import data of higher timeframes, but charts on lower timeframes will have gaps in this case. For example, if you import one-hour data, one bar per hour will be shown on the M1 chart.
    Price data of custom symbols are saved in a separate Custom directory (not in the directories where data of trade servers are stored):
    C:\Users\[windows account]\AppData\Roaming\MetaQuotes\Terminal\[instance id]\bases\Custom

    Using Custom Symbols
    Use of custom symbols is similar to the use of instruments provided by the broker. Custom symbols are displayed in the Market Watch window; you can open charts of such symbols and apply indicators and analytical objects on them. Custom symbols cannot be traded.

    Testing Strategies on Custom Symbols
    Custom symbols can be used for testing trading robots and indicators in the strategy tester. This allows for optimization of strategies even for the financial symbols a broker is currently unable to provide. You just need to import history correctly and configure the custom symbol properties.




    When calculating the margin and profit, the strategy tester automatically uses available cross rates. Suppose that we have created AUDCAD.custom symbol with the Forex type of margin calculation, and our account currency is USD. In this case, the tester searches for the necessary symbols in the following order based on the Forex symbol name:
    1.     first, the search is performed for the symbols of AUDUSD.custom (for calculating the margin) and USDCAD.custom (for calculating the trade profit) forms
    2.     if any of these symbols is not present, the search is performed for the first symbol corresponding to the necessary currency pairs by name (AUDUSD and USDCAD respectively). For example, AUDUSD.b and NZDUSD.b symbols have been found. This means their rates are to be used to calculate the margin and profit.

    Instruments with other types of margin calculation (CFD, Futures and Stock Exchange) require a currency pair to convert the instrument currency into the deposit one. Suppose that we have created a custom symbol with profit and margin currency expressed in GBP, while the deposit currency is CHF. In this case, the search for testing symbols is performed in the following order:
    1. The presence of a trading symbol corresponding to GBPCHF (GBP vs CHF) is checked.
    2. If no such symbol exists, the search is performed for the first trading symbol that corresponds to GBPCHF by its name, for example GBPCHF.b or GBPCHF.def.

    When testing applications using custom instruments, make sure that the trading account has all the necessary currency pairs. Otherwise, the calculation of financial results and margin requirements during testing will not be possible.

    More possibilities will be available in future platform versions
    The development of custom symbols has not completed yet, and more functions will be added in the next builds of the platform. You will be able to import history to custom symbols straight from Expert Advisors, as well as broadcast data (add quotes) of such symbols in real time.

  2. Terminal: Added filtering of the Time & Sales feature by volume.

    Deals with the volume less than the specified value can be hidden from the Time & Sales table. If this filter is applied, only large deals will appear in the Time & Sales window.

    Double click on the first line in the Time & Sales window, specify the minimum volume in lots, and then click on any other area of ​​the Market Depth. Trades will be filtered, and the current filter value will appear in the volume column header.


    You can also specify the minimum volume using the Time & Sales context menu.

  3. Terminal: Added an option for binding the Market Depth to an active chart. Every time you switch to a chart of a financial instrument, the same instrument will be automatically enabled in the Market Depth window. So, you will not need to open the Market Depth window for each new symbol.



  4. Terminal: Fixed refreshing of toolbars after minimizing and maximizing the terminal window.
  5. Terminal: Fixed generation of position trading history if trade and position tickets overlap.
  6. MQL5: Added an option for profiling MQL5 programs on a price history. This option allows checking the performance of programs without waiting for new ticks.

    When profiling based on real data, the program is launched in a normal chart of the terminal. Many programs, especially indicators, only perform calculations at the arrival of a new tick (OnTick, OnCalculate). Thus, in order to evaluate performance, you have to wait for new ticks in real time. If you test a program using history data, you can immediately provide the required load. Profiling is launched in the visual mode in the Strategy Tester, and you receive a lot of new tick events at a time.




  7. MQL5: Added support for union. Union is a special data type consisting of several variables sharing the same memory area. Therefore, the union provides the ability to interpret the same bit sequence in two (or more) different ways. Union declaration starts with the 'union' keyword.
    union LongDouble
    {
      long   long_value;
      double double_value;
    };
    Unlike the structure, various union members belong to the same memory area. In this example, the union of LongDouble is declared with long and double type values sharing the same memory area. Please note that it is impossible to make the union store a long integer value and a double real value simultaneously (unlike a structure), since long_value and double_value variables overlap (in memory). On the other hand, an MQL5 program is able to process data containing in the union as an integer (long) or real (double) value at any time. Therefore, the union allows receiving two (or more) options for representing the same data sequence.

    During the union declaration, the compiler automatically allocates the memory area sufficient to store the largest type (by volume) in the variable union. The same syntax is used for accessing the union element as for the structures, i.e. the point operator.
    union LongDouble
    {
      long   long_value;
      double double_value;
    };
    //+------------------------------------------------------------------+
    //| Script program start function                                    |
    //+------------------------------------------------------------------+
    void OnStart()
      {
    //---
       LongDouble lb;
    //--- get and display the invalid -nan(ind) number
       lb.double_value=MathArcsin(2.0);
       printf("1.  double=%f                integer=%I64X",lb.double_value,lb.long_value);
    //--- largest normalized value (DBL_MAX)
       lb.long_value=0x7FEFFFFFFFFFFFFF;
       printf("2.  double=%.16e  integer=%I64X",lb.double_value,lb.long_value);
    //--- smallest positive normalized (DBL_MIN)
       lb.long_value=0x0010000000000000;    
       printf("3.  double=%.16e  integer=%.16I64X",lb.double_value,lb.long_value);
      }
    /*  Execution result
        1.  double=-nan(ind)                integer=FFF8000000000000
        2.  double=1.7976931348623157e+308  integer=7FEFFFFFFFFFFFFF
        3.  double=2.2250738585072014e-308  integer=0010000000000000
    */

  8. MQL5: Added automatic generation of an implicit copy operator for the objects of structures and classes. Now, the compiler automatically creates copy operators, which allows writing simple entries for objects, such as b=a:
    class Foo
      {
       int               value;
    public:
       string Description(void){return IntegerToString(value);};
       //--- default constructor
                         Foo(void){value=-1;};
       //--- parameterized constructor   
                         Foo(int v){value=v;};
      };
    //+------------------------------------------------------------------+
    //|  structure containing Foo type objects                           |
    //+------------------------------------------------------------------+
    struct MyStruct
      {
       string            s;
       Foo               foo;
      };
    //+------------------------------------------------------------------+
    //| Script program start function                                    |
    //+------------------------------------------------------------------+
    void OnStart()
      {
    //---
       MyStruct a,b;
       Foo an_foo(5);
       a.s="test";
       a.foo=an_foo;
       Print("a.s=",a.s," a.foo.Description()=",a.foo.Description());
       Print("b.s=",b.s," b.foo.Description()=",b.foo.Description());
    //---
       Print("b=a");
       b=a;
    //---
       Print("a.s=",a.s," a.foo.Description()=",a.foo.Description());
       Print("b.s=",b.s," b.foo.Description()=",b.foo.Description());
    /*
       Execution result;
       a.s=test a.foo.Description()=5
       b.s= b.foo.Description()=-1
       b=a
       a.s=test a.foo.Description()=5
       b.s=test b.foo.Description()=5
    */
      }
    Memberwise copying of objects is performed in the implicit operator.

    • If a member is an object, the corresponding copying operator for this object is called.
    • If a member is an array of objects, the receiving array is increased or reduced to the require size using ArrayResize before calling the appropriate copying operator for each element.
    • If a member is an array of simple types, the ArrayCopy function is used for copying.
    • If a member is a pointer to an object, the pointer is copied rather than the object to which it points.

    If necessary, you can override the behavior and create your own option instead of an implicit copy operator, using overloading.

  9. MQL5: Optimized memory use when accessing the price history from Expert Advisors using the Copy* function. Memory consumption will be reduced manifold when working with large amounts of data.

  10. MQL5: Now, the TimeToStruct function returns a boolean value, allowing to check the success of conversion of datetime to MqlDateTime.
  11. MQL5: Added ban to use the FileWriteStruct and FileReadStruct functions for structures containing strings, dynamic arrays, object and pointers.
  12. MQL5: The following response codes have been added:

    • TRADE_RETCODE_REJECT_CANCEL — the request to activate a pending order is rejected, the order is canceled
    • TRADE_RETCODE_LONG_ONLY — the request is rejected, because the rule "Only long positions are allowed" is set for the symbol
    • TRADE_RETCODE_SHORT_ONLY — the request is rejected, because the rule "Only short positions are allowed" is set for the symbol
    • TRADE_RETCODE_CLOSE_ONLY — the request is rejected, because the rule "Only closing of existing positions is allowed" is set for the symbol

  13. MQL5: Added new return value of the SymbolInfoInteger function with the SYMBOL_ORDER_MODE parameter. SYMBOL_ORDER_CLOSEBY — permission of a Close By operation, i.e. closing a position by an opposite open position.
  14. MQL5: The SYMBOL_CUSTOM boolean property has been added to the ENUM_SYMBOL_INFO_INTEGER enumeration. The property allows finding out if the symbol is custom. Use the SymbolInfoInteger function to get the property.
  15. MQL5: Now it is possible to obtain the reason for the creation of an order, deal or position.

    New properties


    Order, deal and position creation reasons
    Three variables have been added for obtaining the reasons for the creation of trading operations:

    ENUM_POSITION_REASON ENUM_DEAL_REASON ENUM_ORDER_REASON Reason description
    POSITION_REASON_CLIENT DEAL_REASON_CLIENT ORDER_REASON_CLIENT The operation was executed as a result of activation of an order placed from a desktop terminal
    POSITION_REASON_MOBILE DEAL_REASON_MOBILE ORDER_REASON_MOBILE The operation was executed as a result of activation of an order placed from a mobile application
    POSITION_REASON_WEB DEAL_REASON_WEB ORDER_REASON_WEB The operation was executed as a result of activation of an order placed from the web platform
    POSITION_REASON_EXPERT DEAL_REASON_EXPERT ORDER_REASON_EXPERT The operation was executed as a result of activation of an order placed from an MQL5 program, i.e. an Expert Advisor or a script
    - DEAL_REASON_SL ORDER_REASON_SL The operation was executed as a result of Stop Loss activation
    - DEAL_REASON_TP ORDER_REASON_TP The operation was executed as a result of Take Profit activation
    - DEAL_REASON_SO ORDER_REASON_SO The operation was executed as a result of the Stop Out event
    - DEAL_REASON_ROLLOVER - The deal was executed due to a rollover
    - DEAL_REASON_VMARGIN - The deal was executed after charging the variation margin
    - DEAL_REASON_SPLIT - The deal was executed after the split (price reduction) of a stock or another asset, which had an open position during split announcement

  16. MQL5: Optimized synchronization and access to the tick history.
  17. MQL5: Fixed returning of ticks to the statistic array in the CopyTicksRange function. In earlier versions, 0 ticks were always returned in this case.
  18. MQL5: Various fixes have been made in the Fuzzy Logic Library.
  19. Signals: Fixed opening of a signal from the website when there is no trading account connection.
  20. Tester: Optimized and accelerated work with the history of orders and deals. Operation speed will be increased manifold when working with large amounts of data (tens of thousands of history entries).
  21. Tester: Fixed calculation of position holding time in the testing report.
  22. MetaEditor: Fixed the display of the contents of static class member arrays in the debugger.
  23. MetaEditor: Added a list of breakpoints in the debugged program. The list can be opened using the context menu of the Debug tab:


    To jump to a breakpoint, double-click on it.

  24. Updated documentation.
The update will be available through the LiveUpdate system.

 

Forum on trading, automated trading systems and testing trading strategies

MetaTrader 5 Build 1700: Synthetic Instruments, Shared Projects and MQL5 Cloud Protector

MetaQuotes Software Corp., 2017.12.05 14:33

Long-awaited release of the platform which incorporates brand new features. Be among the first users to share the new experience.

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

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

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

End of Support for Older Terminal Versions
Support for older versions of desktop and mobile terminals will end upon the release of the new platform version:
  • Client Terminal: versions below 730, November 23, 2012
  • Mobile Terminal for iPhone: versions below 1171, November 11, 2015
  • Mobile Terminal for Android: versions below 1334, August 5, 2016
Unsupported terminal builds will not be able to connect to new server versions. We strongly recommend that you update your terminals in advance.

MQL5 Storage Operation Protocol Changes
To support new shared projects, we have updated the protocol of operation with the MQL5 Storage. Therefore, you will need to perform a checkout of all data from the storage after the platform update. Data stored at the MQL5 Storage will not be lost or affected during the update.

Before updating the platform to the new version, we recommend that you perform the Commit operation to send all local changes to the MQL5 Storage.

The update will feature the following changes:

  1. Full-featured projects are now available in MetaEditor. The program development process has become more convenient.

    Now the main MQ5 program file does not appear as the project. The project is a separate "MQPROJ" file, which stores program settings, compilation parameters and information about all used files. Main project settings can be accessed from a separate dialog box, so there is no need to specify them in the source code via #property now.

    A separate tab in the Navigator is provided for a convenient work with the project. All files, such as include, resource, header and other files are arranged into categories on this tab. All files are automatically added to the project navigator. For example, if you include a new MQH file, it will automatically appear in the "Dependencies" section of the navigator.

    Support for new projects has also been implemented in the updated MQL5 Storage online repository. It is a convenient option for developing large projects through collaboration with other members of the MQL5.community.

    New Shared Projects section is provided for group projects. A project created in this section is immediately sent to the storage: you can grant permissions to other users and start collaboration right away.





    When you compile a project in Shared Projects, an executable EX5 file is automatically copied to the local Experts, Indicators or Scripts directory depending on the program type. You can easily launch the program on a chart without having to copy files manually.


    What's New in the MQL5 Storage Operation
    To implement support for new shared projects, we have modified the protocol of operation with the MQL5 Storage. Therefore, you will need to perform a checkout of all data from the storage after the platform update. Data stored at the MQL5 storage will not be lost or affected during the update.
    Before updating the platform to the new version, we recommend that you perform the Commit operation to send all local changes to the MQL5 Storage.
    The 'Checkout from Storage' command is now only available in Shared Projects. For other catalogs in the MQL5 folder the 'Activate MQL5 Storage' and 'Update from Storage' commands are used:

    • If you haven't used the MQL5 Storage in the current MetaEditor instance, click 'Activate MQL5 Storage' in the context menu of the Navigator window. All catalogs and files available in your storage will be uploaded to your local computer.
    • If you are already working with the storage, click 'Update files from Storage' in the context menu of the root MQL5 element in the Navigator to receive all data from the storage.


    New Projects: Examples of Creation and Operation Details
    A new project entity has been added in MetaEditor. A project is an mqproj file that stores common program properties and information about all used files. Now, program properties can be conveniently managed from a separate MetaEditor dialog instead of manual modification of properties in the source code (using #property directives).

    If you have available code, you can easily test new projects by using the 'New Project from Source' command.




    In the directory where the selected file is located, a new project file with the same name and the mqproj extension will be created. The main program properties specified in the source code via #property will be automatically added to the project, including the name, copyright, version, link to the developer's site and program description.
    The set of program properties in the project file is given a higher priority, than properties specified in the program code. If properties are specified both in the project and in the source file, properties from the project will be used.




    Two new options for compiling MQL5 programs have been added to project properties:

    • Enable additional optimization: applications with the optimization disabled are compiled faster, but execute more slowly.
    • Check floating point dividers: applications with the check disabled work a little faster, because the zero divide error is not checked during code execution.

    To work with projects, use a separate Project tab in the Navigator window. All files used in a project are displayed on this tab in a convenient form. When a project is generated from a source file, all used include files (specified using the #include directory in the main MQ5 file and in its include files) are automatically added to the Dependencies section.

    When a new include file is added to the source code, it also appears in the project Navigator. Used header files are added to the Headers section; images, sounds and other MQL5 programs used in the project as resource are added to the Resources section. MQ5 files with the source code are displayed in the Sources section. In the 'Settings and files' section, you can add other files, such as set files for testing and chart templates.

    Use context menu commands to add existing files to a project or to delete files from it. Be careful when deleting files, since you can remove a file from the project (remove the binding) or completely delete it from the hard disk:



    Creation of a new project is as easy as the creation of a normal MQL5 program. Click 'New Project', select the type of new program and specify properties (such as name, event handlers, etc) in the MQL5 Wizard.

    To obtain an executable EX5 file, you can open the project and press F7 (the compilation command) or open the main MQ5 file of the program and compile it.

    Shared Projects in MQL5 Storage: Operation Details
    Shared projects are managed from a separate Shared Projects section. If you have not connected the storage yet, execute the 'Activate MQL5 Storage' command from the context menu of the desired folder. MetaEditor will check if your storage contains any saved data and if there are any share projects available to you. All available data will be retrieved from the storage and uploaded to your computer (the checkout operation). Available group projects appear in the Shared Projects section. To retrieve the projects, execute "Checkout from Storage" in the context menu.

    To create a new group project, select the Shared Projects folder and click "New Project":



    Then complete standard MQL5 steps: set the type, name and properties of the desired program. For group projects, you should use clear and understandable names, so that other participants could easily find them. Only Latin letters without spaces can be used in project names.

    A created object is immediately added to the MQL5 Storage. Standard Library files used in the project are not added to the storage, and you can add them manually.

    To allow other participants to work with the project, open its properties. From here you can grant permissions to selected users by specifying their MQL5.community login, as well as set common parameters for the group work:

    • Private project
    • Free to join project
    • Join by request project



    When you compile a group project, the executable EX5 file is automatically copied to the local Experts, Indicators or Scripts directory depending on the program type. It allows you to instantly run the program in the terminal without having to copy it manually to the proper directory.

  2. Terminal: Now, the trading platform allows creating synthetic financial instruments, i.e. symbols based on one or more existing instruments. The user should set the formula for calculating quotes, after which the platform will generate ticks of the synthetic instrument in real time, and also will create its minute history.

    How It Works
    • You create a synthetic instrument and set formula for price calculation.
    • The platform calculates ticks at a frequency of 10 times per second, provided that the price of at least one of the instruments used in the formula has changed.
    • The platform also calculates the history of one-minute bars (for the last two months) based on minute bars of instruments used in its formula. All new bars (current and subsequent ones) are built in real time based on the generated ticks of the synthetic instrument.
    For example, you can create an instrument showing the dollar index (USDX). It uses the below formula:
    50.14348112 * pow(ask(EURUSD),-0.576) * pow(USDJPY,0.136) * pow(ask(GBPUSD),-0.119) * pow(USDCAD,0.091) * pow(USDSEK,0.042) * pow(USDCHF,0.036)
    Note: the USDEUR and USDGBP pairs are used in the source dollar index formula. Since only reverse pairs are available in the platform, a negative power and Ask instead of Bid are used in the synthetic symbol formula.

    The platform will calculate in real time the price of the new instrument based on the quotes of the other six symbols provided by your broker. The price changes will be visualized in the Market Watch window and on the chart:



    Create a new custom symbol, open its specification and enter the formula:



    For convenience, the formula editor shows a list of possible options as you type the names of symbols and functions.

    Calculation of ticks and one-minute bars of a synthetic instrument starts when this instrument is added to the Market Watch. Also, all symbols required for the synthetic price calculation are automatically added to the Market Watch. An entry about the calculation start will be added to the platform journal: Synthetic Symbol USDX: processing started.
    • Calculation of a synthetic instrument stops after it is removed from the Market Watch.
    • Symbols that are currently used for calculating synthetic symbol prices cannot be hidden from the Market Watch.

    Real-Time Calculation of Quotes
    Every 100 ms (i.e. ten times per second) the prices of symbols used in calculation are checked. If at least one of them has changed, the price of the synthetic symbol is calculated and a new tick is generated. Calculation is performed in parallel in three threads for Bid, Ask and Last prices. For example, if the calculation formula is EURUSD*GBPUSD, the price of the synthetic symbol will be calculated as follows:

    • Bid = bid(EURUSD)*bid(GBPUSD)
    • Ask = ask(EURUSD)*ask(GBPUSD)
    • Last = last(EURUSD)*last(GBPUSD)

    The availability of changes is checked separately for each price. For example, if only the Bid price of a source instrument has changed, only the appropriate price of a synthetic instrument will be calculated.

    Creating a History of Minute Bars
    In addition to collecting ticks in real time, the platform creates a minute history of the synthetic instrument. It enables traders to view synthetic symbol charts similar to normal ones, as well as to conduct technical analysis using objects and indicators.

    When a trader adds a synthetic instrument to the Market Watch, the platform checks whether its calculated minute history exists. If it does not exist, the history for the last 60 days will be created, which includes about 50,000 bars. If a lower value is specified in the 'Max. bars in chart' parameter in platform settings, the appropriate restriction will apply.

    If some of bars within this period have already been created, the platform will additionally generate new bars. A deeper history is created if the user tries to view an older time period on the chart (by scrolling it back or accessing it from an MQL5 program).

    The history of one-minute bars of a synthetic instrument is calculated based one one-minute bars (not ticks) of instruments used in its formula. For example, to calculate the Open price of a 1-minute bar of a synthetic symbol, the platform uses the Open prices of symbols used in its formula. High, Low and Close prices are calculated in a similar way.

    If the required bar is not available for any of the instruments, the platform will use the Close price of the previous bar. For example, three instruments are used: EURUSD, USDJPY and GBPUSD. If in the calculation of a bar corresponding to 12:00 the required bar of USDJPY is not available, the following prices will be used for calculation:

    • Open: EURUSD Open 12:00, USDJPY Close 11:59, GBPUSD Open 12:00
    • High: EURUSD High 12:00, USDJPY Close 11:59, GBPUSD High 12:00
    • Low: EURUSD Low 12:00, USDJPY Close 11:59, GBPUSD Low 12:00
    • Close: EURUSD Close 12:00, USDJPY Close 11:59, GBPUSD Close 12:00

    If the minute bar is not available for all of the instruments used in the formula, the appropriate minute bar of the synthetic instrument will not be calculated.

    Drawing New Minute Bars
    All new bars (current and subsequent ones) of the synthetic instrument are created based on generated ticks. The price used for building the bars depends on the value of the Chart Mode parameter in the specification:




    What Operations Can Be Used in the Symbol Formula
    Price data and some properties of existing symbols provided by the broker can be used for calculating synthetic prices. Specify the following:

    • Symbol name — depending on the synthetic price to be calculated, the Bid, Ask or Last of the specified instrument will be used. For example, if EURUSD*GBPUSD is specified, Bid is calculated as bid(EURUSD)*bid(GBPUSD), and Ask = ask(EURUSD)*ask(GBPUSD).
    • bid(symbol name) — the bid price of the specified symbol will be forcedly used for calculating the Bid price of the synthetic instrument. This option is similar to the previous one (where the price type is not specified).
    • ask(symbol name) — the Ask price of the specified symbol will be used for calculating the Bid price of the synthetic instrument. Bid price of the specified instrument will be used for calculating Ask. The Last price of the specified symbol will be used for calculating Last. If ask(EURUSD)*GBPUSD is specified, the following calculation will be used:
      • Вid = ask(EURUSD)*bid(GBPUSD)
      • Ask = bid(EURUSD)*ask(GBPUSD)
      • Last = last(EURUSD)*last(GBPUSD)
    • last(symbol name) — the Last price of the specified symbol will be used in the calculation of all prices of the synthetic instrument (Bid, Ask and Last). If last(EURUSD)*GBPUSD is specified, the following calculation will be used:
      • Вid = last(EURUSD)*bid(GBPUSD)
      • Ask = last(EURUSD)*ask(GBPUSD)
      • Last = last(EURUSD)*last(GBPUSD)
    • volume(symbol name) — the tick volume of the specified instrument will be used in the formula. Make sure that volume information is provided by the broker for this symbol.
    • point(symbol name) — the minimum price change of the specified instrument will be used in calculations.
    • digits(symbol name) — the number of decimal places in the specified symbol price will be used in the formula.

    If a symbol has a complex name (contains hyphens, dots, etc.), it must be written in quotation marks. Example: "RTS-6.17".
    The following arithmetic operations can be used in the formula: addition (+), subtraction (-), multiplication (*), devision (/) and remainder of division (%). For example, EURUSD+GBPUSD means that the price is calculated as the sum of EURUSD and GBPUSD prices. Also you can use the unary minus to change the sign, for example: -10*EURUSD.

    Mind the calculation priority of arithmetic operations:

    • The operations of multiplication, division and remainder are performed first; then addition and subtraction operations are performed.
    • The operations are performed from left to right. If the formula uses several operations that have the same priority (for example, multiplication and division), the operation on the left will be performed first.
    • You can use brackets ( and ) to change the priority of operations. Operations in brackets have the highest priority in the calculation. The left-to-right principle also applies for them: operations in brackets on the left are calculated first.

    You can use constants in the formula:

    • Numerical (integer and float). Example: EURUSD*2+GBPUSD*0.7.
    • Symbol properties _Digits and _Point. They add to the formula appropriate properties of the custom symbol from the specification. _Digits means the number of decimal places in the instrument price; _Point means the smallest change in the symbol price.

    You can also use in the formula all mathematical functions supported in MQL5, except for MathSrand, MathRand and MathIsValidNuber: Only short names are used for all functions, such as fabs(), acos(), asin() etc.

  3. Terminal: A new option has been implemented, allowing to add quotes of custom instruments in real time. Now, it is possible to develop an MQL5 Expert Advisor that would be feeding quotes of the specified custom symbol. The CustomTicksAdd function is used for that.
    int  CustomTicksAdd(
       const string           symbol,       // Symbol name
       const MqlTick&         ticks[]       // The array with tick data that should be applied to the custom symbol
       );
    The CustomTicksAdd function allows feeding quotes as if these quotes were received from a broker's server. Data is sent to the Market Watch window instead of being directly written to the tick database. Then, the terminal saves ticks from the Market Watch to the database. If a large volume of data is passed in one call, the function behavior changes, in order to save resources. If more than 256 ticks are transmitted, data is divided into two parts. A larger part is recorded directly to the tick database (similar to CustomTicksReplace). The second part consisting of the last 128 ticks is sent to the Market Watch, from where the terminal saves the ticks to a database.

  4. MQL5: New online service MQL5 Cloud Protector has been added to provide additional protection for MQL5 programs. Protection is similar to the option used in the largest store of trading applications MetaTrader Market, where the EX5 product files submitted by sellers are additionally compiled to native code.

    Now, this type of protection is available to all platform users. To protect your files, execute the following command in MetaEditor: Tools—MQL5 Cloud Protector. The only difference of MQL5 Cloud Protector from the mechanism used in the Market, is that the file is not linked to the user's computer. Protected via MQL5 Cloud Protector files can be run on any computers similar to common EX5 files.
    MQL5 Cloud Protector is a secure service. Additional protection is only applied to a compiled file. The source code is not passed to the service. At the first step, a program is compiled to an EX5 file on the user's computer; after that the compiled file is sent over an encrypted channel to the service, where it is protected and returned to the user.



  5. Terminal: The Market Watch window now additionally features the High and Low prices. These columns are hidden by default. They can be enabled using the context menu:




    If a symbol chart is constructed using Bid prices (as per specification settings), Bid High and Bid Low prices are shown for this symbol. If a symbol chart is constructed using Last prices, Last High and Last Low prices are shown for this symbol.

    If Market Watch contains at least one symbol whose chart is drawn based on Last prices, the Last column is automatically enabled in addition to High/Low.

  6. Terminal: Now it is possible to edit the tick history of custom financial instruments. Click 'Symbols' in the Market Watch context menu, select a custom symbol and request the required data interval in the Ticks tab.

    • Double-tap to change the value.
    • Use the context menu to add or delete entries
    • If you need to delete multiple bars/ticks at once, select them with the mouse, holding down Shift or Ctrl+Shift.



    For convenience, modified entries are highlighted as follows:

    • Green background indicates a modified entry
    • Gray background means a deleted entry
    • Yellow background shows an added entry

    To save the changes, click "Apply Changes" at the bottom of the window.

  7. Terminal: Added display of time in millisecond in the Quotes window.




  8. Terminal: Scanning of available servers in the new account opening dialog has become faster.
  9. Terminal: Fixed display of the Trendline graphics object with the Ray Left and Ray Right options enabled.
  10. Terminal: Optimized operation with a large amount of internal emails (hundreds of thousands).
  11. Terminal: Optimized terminal operation with a large amount of trading instruments (50,000 or more).
  12. MQL5: New functions for working with custom financial instruments have been added.

    Function Action
    CustomSymbolCreate Create a custom symbol with the specified name in the specified group
    CustomSymbolDelete Delete a custom symbol with the specified name
    CustomSymbolSetInteger Set the integer type property value for a custom symbol
    CustomSymbolSetDouble Set the real type property value for a custom symbol
    CustomSymbolSetString Set the string type property value for a custom symbol
    CustomSymbolSetMarginRate Set the margin rates depending on the order type and direction for a custom symbol
    CustomSymbolSetSessionQuote Set the start and end time of the specified quotation session for the specified symbol and week day
    CustomSymbolSetSessionTrade Set the start and end time of the specified trading session for the specified symbol and week day
    CustomRatesDelete Delete all bars from the price history of the custom symbol in the specified time interval
    CustomRatesReplace Fully replace the price history of the custom symbol within the specified time interval with the data from the MqlRates type array
    CustomRatesUpdate Add missing bars to the custom symbol history and replace existing data with the ones from the MqlRates type array
    CustomTicksAdd Adds data from an array of the MqlTick type to the price history of a custom symbol. The custom symbol must be selected in the Market Watch window.
    CustomTicksDelete Delete all ticks from the price history of the custom symbol in the specified time interval
    CustomTicksReplace Fully replace the price history of the custom symbol within the specified time interval with the data from the MqlTick type array

  13. MQL5: Added support for templates for the union data type.
  14. MQL5: The SYMBOL_VISIBLE trading instrument property has been added. Call of SymbolInfoInteger(symbol, SYMBOL_VISIBLE) returns false if the specified symbol is not visible in the Market Watch.
  15. MQL5: Added new CHARTEVENT_MOUSE_WHEEL property. The event is called when the mouse wheel is scrolled or pressed on the chart (if CHART_EVENT_MOUSE_WHEEL=true for the chart).
  16. MQL5: The following chart properties have been added:

    • CHART_EVENT_MOUSE_WHEEL — enabling/disabling generation of CHART_EVENT_MOUSE_WHEEL (mouse scroll and click event on the chart). Possible values: 0 and 1.
    • CHART_CROSSHAIR_TOOL — enable/disable the possibility to switch cursor to the Crosshair mode by a middle click. Possible values: 0 and 1.
    • CHART_CONTEXT_MENU — enable/disable the use of right click to display the context menu of the chart. Possible values: 0 and 1.

  17. MQL5: Now, drawing buffers with the DRAW_NONE style are not taken into account when calculating the indicator window scale.
  18. MQL5: Added the CHARTEVENT_CHART_CHANGE event generation when setting the CHART_SCALEFIX (fixed scale) property for the chart.
  19. MQL5: The ArraySwap function has been added, allowing to quickly swap the contents of dynamic arrays.
    bool  ArraySwap(
       void&  array1[],      // The first array
       void&  array2[]       // The second array
       );
    The function accepts dynamic arrays of the same type and the same dimensions. For multidimensional arrays, the number of elements in all dimensions except the first one should match.

  20. Signals: Fixed indication of order filling type in case of forced closing of positions opened according to a Signal. The 'Stop if the account is lower than XXX USD' option is provided in signal copying options: if equity drops below a specified level, copying of trade signals is automatically terminated, all positions are closed. Earlier, an incorrect filling type could be set for position closing orders in case of forced closure. Now the terminal checks allowed filling types in symbol settings and indicates a proper option.
  21. Tester: The behavior of the HistoryOrderSelect function in the Strategy Tester now corresponds to the same function in the client terminal.
  22. Tester: The behavior of the CopyTicks and CopyTicksRange functions in the Strategy Tester now corresponds to the same functions in the client terminal.
  23. Tester: Optimized display of graphics objects during visual testing.
  24. Tester: Fixed display of testing results of exchange instruments (with the exchange risk management model). Now, the chart only shows the equity, while the balance and the deposit load are not shown. The trading status of such accounts is evaluated based on the equity level. The balance only shows the amount of money on the account and ignores the trader's assets and liabilities. Deposit load (margin/equity) is not displayed, because in the exchange calculation mode margin is equal to the current discounted value of the asset/liability, and it changes along with equity.
  25. MetaEditor: Added the ability to easily insert properties and resources to program code. For example, you can quickly add an included file to code. Use command "Insert—MQH as #incude", and select the desired include file. The #include directive with the proper path to the selected file will be inserted to program code.



    The same menu allows adding to program code files in the form of a binary or text array. Among others, you can transfer chart templates with Expert Advisors or indicators: insert your template in the program code as an array, and save it to disk then using the FileSave function. After that the template can be applied on the desired chart right from an Expert Advisor using the ChartApplyTemplate function.
    //+------------------------------------------------------------------+
    //| Script program start function                                    |
    //+------------------------------------------------------------------+
    void OnStart()
      {
    //--- Template file as a binary array
       unsigned char my_template[]=
         {
          0xFF,0xFE,0x3C, ... ,0x00 // The data array in this example is shortened
         };
    //--- Saving and applying the template
       if(FileSave("my_template.tpl",my_template))
         {
          Print("Custom template saved in \\MQL5\\Files");
          if(ChartApplyTemplate(0,"\\Files\\my_template.tpl"))
             Print("Custom template applied to the current chart");
          else
             Print("Failed to apply custom template");
         }
       else
          Print("Failed to save custom template");
      }

  26. MetaEditor: Added an option for converting strings between ASCII, HEX and Base64 formats. Select a line in the source code and click the desired command in the Edit—Convert menu:




  27. MetaEditor: Fixed case-insensitive search in files.
  28. MetaEditor: Fixed a debugger error that could occur when calculating expressions similar to x.y[0][1].z.
  29. MetaEditor: Fixed code navigation using Forward and Back buttons.
  30. The user interface is now also available in Dutch.
  31. Updated documentation.


The update will be available through the LiveUpdate system.


 

Forum on trading, automated trading systems and testing trading strategies

New MetaTrader 5 Build 1730: Projects in MetaEditor and Synthetic financial instruments

MetaQuotes Software Corp., 2017.12.20 13:49

New MetaTrader 5 Build 1730: Projects in MetaEditor and Synthetic financial instruments

The MetaTrader 5 platform update will be released on December 21, 2017.

End of Support for Older Terminal Versions
Support for older versions of desktop and mobile terminals will end upon the release of the new platform version:
  • Client Terminal: versions below 730, November 23, 2012
  • Mobile Terminal for iPhone: versions below 1171, November 11, 2015
  • Mobile Terminal for Android: versions below 1334, August 5, 2016
Unsupported terminal builds will not be able to connect to new server versions. We strongly recommend that you update your terminals in advance.

MQL5 Storage Operation Protocol Changes
To support new shared projects, we have updated the protocol of operation with the MQL5 Storage. Therefore, you will need to perform a checkout of all data from the storage after the platform update. Data stored at the MQL5 Storage will not be lost or affected during the update.

Before updating the platform to the new version, we recommend that you perform the Commit operation to send all local changes to the MQL5 Storage.

The update will feature the following changes:

  1. Full-featured projects are now available in MetaEditor. The program development process has become more convenient.

    Now the main MQ5 program file does not appear as the project. The project is a separate "MQPROJ" file, which stores program settings, compilation parameters and information about all used files. Main project settings can be accessed from a separate dialog box, so there is no need to specify them in the source code via #property now.

    A separate tab in the Navigator is provided for work convenience within the project. All files, such as include, resource, header and other files are arranged into categories on this tab. All files are automatically added to the project navigator. For example, if you include a new MQH file, it will automatically appear in the "Dependencies" section of the navigator.

    Support for new projects has also been implemented in the updated MQL5 Storage online repository. Now, it has become much more convenient to develop large projects through collaboration with other members of the MQL5.community.

    New Shared Projects section is provided for group projects. A project created in this section is immediately sent to the storage: you can grant permissions to other users and start collaboration right away.




    When you compile a project in Shared Projects, an executable EX5 file is automatically copied to the local Experts, Indicators or Scripts directory depending on the program type. You can easily launch the program on a chart without having to copy files manually.


    What's New in the MQL5 Storage Operation

    To implement support for new shared projects, we have modified the protocol of operation with the MQL5 Storage. Therefore, you will need to perform a checkout of all data from the storage after the platform update. Data stored at the MQL5 storage will not be lost or affected during the update.

    Before updating the platform to the new version, we recommend that you perform the Commit operation to send all local changes to the MQL5 Storage.

    The 'Checkout from Storage' command is unavailable now. Instead, the 'Activate MQL5 Storage' and 'Update from Storage' commands are used to receive data:

    • If you haven't used the MQL5 Storage in the current MetaEditor instance, click 'Activate MQL5 Storage' in the context menu of the Navigator window. All catalogs and files available in your storage will be uploaded to your local computer.
    • If you are already working with the storage, click 'Update files from Storage' in the context menu of a certain project or the root MQL5 element in the Navigator window to receive data from the storage.

    New Projects: Examples of Creation and Operation Details

    A new project entity has been added in MetaEditor. A project is an mqproj file that stores common program properties and information about all used files. Now, program properties can be conveniently managed from a separate MetaEditor dialog instead of manual modification of properties in the source code (using #property directives).

    If you have available code, you can easily test new projects by using the 'New Project from Source' command.




    In the directory where the selected file is located, a new project file with the same name and the mqproj extension will be created. The main program properties specified in the source code via #property will be automatically added to the project, including the name, copyright, version, link to the developer's site and program description.

    The set of program properties in the project file is given a higher priority, than properties specified in the program code. If properties are specified both in the project and in the source file, properties from the project will be used.




    Two new options for compiling MQL5 programs have been added to project properties:

    • Enable additional optimization: applications with the optimization disabled are compiled faster, but execute more slowly.
    • Check floating point dividers: applications with the check disabled work a little faster, because the zero divide error is not checked during code execution.

    To work with projects, use a separate Project tab in the Navigator window. All files used in a project are displayed on this tab in a convenient form. When a project is generated from a source file, all used include files (specified using the #include directory in the main MQ5 file and in its include files) are automatically added to the Dependencies section.

    When a new include file is added to the source code, it also appears in the project Navigator. Used header files are added to the Headers section; images, sounds and other MQL5 programs used in the project as resource are added to the Resources section. MQ5 files with the source code are displayed in the Sources section. In the 'Settings and files' section, you can add other files, such as set files for testing and chart templates.

    Use context menu commands to add existing files to a project or to delete files from it. Be careful when deleting files, since you can remove a file from the project (remove the binding) or completely delete it from the hard disk:




    Creation of a new project is as easy as the creation of a normal MQL5 program. Click 'New Project', select the type of new program and specify properties (such as name, event handlers, etc) in the MQL5 Wizard.

    To obtain an executable EX5 file, you can open the project and press F7 (the compilation command) or open the main MQ5 file of the program and compile it.


    Shared Projects in MQL5 Storage: Operation Details

    Shared projects are managed from a separate Shared Projects section. If you have not connected the storage yet, execute the 'Activate MQL5 Storage' command from the context menu of the desired folder. MetaEditor will check if your storage contains any saved data and if there are any share projects available to you. All available data will be retrieved from the storage and uploaded to your computer (the checkout operation). Available group projects appear in the Shared Projects section. To retrieve the projects, execute "Checkout from Storage" in the context menu.

    To create a new group project, select the Shared Projects folder and click "New Project":




    Then complete standard MQL5 steps: set the type, name and properties of the desired program. For group projects, you should use clear and understandable names, so that other participants could easily find them. Only Latin letters and numbers without spaces can be used in project names.

    A created object is immediately added to the MQL5 Storage. Standard Library files used in the project are not added to the storage, and you can add them manually.

    To allow other participants to work with the project, open its properties. From here you can grant permissions to selected users by specifying their MQL5.community login, as well as set common parameters for the group work:

    • Private project
    • Free to join project
    • Join by request project




    When you compile a group project, the executable EX5 file is automatically copied to the local Experts, Indicators or Scripts directory depending on the program type. It allows you to instantly run the program in the terminal without having to copy it manually to the proper directory.


    Public Projects in MQL5 Storage: Participation in Development

    As mentioned above, each group project in MQL5 Storage has publicity settings: the project can be private or open to other users. Now, all projects you can freely join are displayed in the separate "Public Projects" tab.

    Everyone can find an exciting project and take part in its development. Simply click Join and receive the project from the storage.




    Each joined user gets read-only rights. Contact the project author to be able to submit your changes. To know his or her login, open the project properties via the context menu.

  2. Terminal: Now, the trading platform allows creating synthetic financial instruments, i.e. symbols based on one or more existing instruments. The user should set the formula for calculating quotes, after which the platform will generate ticks of the synthetic instrument in real time, and also will create its minute history.


    How It Works

    • You create a synthetic instrument and set the formula for price calculation.
    • The platform calculates ticks at a frequency of 10 times per second, provided that the price of at least one of the instruments used in the formula has changed.
    • The platform also calculates the history of one-minute bars (for the last two months) based on minute bars of instruments used in its formula. All new bars (current and subsequent ones) are built in real time based on the generated ticks of the synthetic instrument.

    For example, you can create an instrument showing the dollar index (USDX). It uses the below formula:

    50.14348112 * pow(ask(EURUSD),-0.576) * pow(USDJPY,0.136) * pow(ask(GBPUSD),-0.119) * pow(USDCAD,0.091) * pow(USDSEK,0.042) * pow(USDCHF,0.036)

    Note: the USDEUR and USDGBP pairs are used in the source dollar index formula. Since only reverse pairs are available in the platform, a negative power and Ask instead of Bid are used in the synthetic symbol formula.

    The platform will calculate in real time the price of the new instrument based on the quotes of the other six symbols provided by your broker. The price changes will be visualized in the Market Watch window and on the chart:




    Create a new custom symbol, open its specification and enter the formula:




    For convenience, the formula editor shows a list of possible options as you type the names of symbols and functions.

    Calculation of ticks and one-minute bars of a synthetic instrument starts when this instrument is added to the Market Watch. Also, all symbols required for the synthetic price calculation are automatically added to the Market Watch. An entry about the calculation start will be added to the platform journal: Synthetic Symbol USDX: processing started.
    • Calculation of a synthetic instrument stops after it is removed from the Market Watch.
    • Symbols that are currently used for calculating synthetic symbol prices cannot be hidden from the Market Watch.

    Real-Time Calculation of Quotes
    Every 100 ms (i.e. ten times per second) the prices of symbols used in calculation are checked. If at least one of them has changed, the price of the synthetic symbol is calculated and a new tick is generated. Calculation is performed in parallel in three threads for Bid, Ask and Last prices. For example, if the calculation formula is EURUSD*GBPUSD, the price of the synthetic symbol will be calculated as follows:

    • Bid = bid(EURUSD)*bid(GBPUSD)
    • Ask = ask(EURUSD)*ask(GBPUSD)
    • Last = last(EURUSD)*last(GBPUSD)

    The availability of changes is checked separately for each price. For example, if only the Bid price of a source instrument has changed, only the appropriate price of a synthetic instrument will be calculated.

    Creating a History of Minute Bars
    In addition to collecting ticks in real time, the platform creates a minute history of the synthetic instrument. It enables traders to view synthetic symbol charts similar to normal ones, as well as to conduct technical analysis using objects and indicators.

    When a trader adds a synthetic instrument to the Market Watch, the platform checks whether its calculated minute history exists. If it does not exist, the history for the last 60 days will be created, which includes about 50,000 bars. If a lower value is specified in the 'Max. bars in chart' parameter in platform settings, the appropriate restriction will apply.

    If some of bars within this period have already been create, the platform will additionally generate new bars. A deeper history is created if the user tries to view an older time period on the chart (by scrolling it back or accessing it from an MQL5 program).

    The history of one-minute bars of a synthetic instrument is calculated based one one-minute bars (not ticks) of instruments used in its formula. For example, to calculate the Open price of a 1-minute bar of a synthetic symbol, the platform uses the Open prices of symbols used in its formula. High, Low and Close prices are calculated in a similar way.

    If the required bar is not available for any of the instruments, the platform will use the Close price of the previous bar. For example, three instruments are used: EURUSD, USDJPY and GBPUSD. If in the calculation of a bar corresponding to 12:00 the required bar of USDJPY is not available, the following prices will be used for calculation:

    • Open: EURUSD Open 12:00, USDJPY Close 11:59, GBPUSD Open 12:00
    • High: EURUSD High 12:00, USDJPY Close 11:59, GBPUSD High 12:00
    • Low: EURUSD Low 12:00, USDJPY Close 11:59, GBPUSD Low 12:00
    • Close: EURUSD Close 12:00, USDJPY Close 11:59, GBPUSD Close 12:00

    If the minute bar is not available for all of the instruments used in the formula, the appropriate minute bar of the synthetic instrument will not be calculated.

    Drawing New Minute Bars
    All new bars (current and subsequent ones) of the synthetic instrument are created based on generated ticks. The price used for building the bars depends on the value of the Chart Mode parameter in the specification:





    What Operations Can Be Used in the Symbol Formula
    Price data and some properties of existing symbols provided by the broker can be used for calculating synthetic prices. Specify the following:

    • Symbol name — depending on the synthetic price to be calculated, the Bid, Ask or Last of the specified instrument will be used. For example, if EURUSD*GBPUSD is specified, Bid is calculated as bid(EURUSD)*bid(GBPUSD), and Ask = ask(EURUSD)*ask(GBPUSD).
    • bid(symbol name) — the bid price of the specified symbol will be forcedly used for calculating the Bid price of the synthetic instrument. This option is similar to the previous one (where the price type is not specified).
    • ask(symbol name) — the Ask price of the specified symbol will be used for calculating the Bid price of the synthetic instrument. Bid price of the specified instrument will be used for calculating Ask. The Last price of the specified symbol will be used for calculating Last. If ask(EURUSD)*GBPUSD is specified, the following calculation will be used:
      • Вid = ask(EURUSD)*bid(GBPUSD)
      • Ask = bid(EURUSD)*ask(GBPUSD)
      • Last = last(EURUSD)*last(GBPUSD)
    • last(symbol name) — the Last price of the specified symbol will be used in the calculation of all prices of the synthetic instrument (Bid, Ask and Last). If last(EURUSD)*GBPUSD is specified, the following calculation will be used:
      • Вid = last(EURUSD)*bid(GBPUSD)
      • Ask = last(EURUSD)*ask(GBPUSD)
      • Last = last(EURUSD)*last(GBPUSD)
    • volume(symbol name) — the tick volume of the specified instrument will be used in the formula. Make sure that volume information is provided by the broker for this symbol.
    • point(symbol name) — the minimum price change of the specified instrument will be used in calculations.
    • digits(symbol name) — the number of decimal places in the specified symbol price will be used in the formula.

    If a symbol has a complex name (contains hyphens, dots, etc.), it must be written in quotation marks. Example: "RTS-6.17".
    The following arithmetic operations can be used in the formula: addition (+), subtraction (-), multiplication (*), devision (/) and remainder of division (%). For example, EURUSD+GBPUSD means that the price is calculated as the sum of EURUSD and GBPUSD prices. Also you can use the unary minus to change the sign, for example: -10*EURUSD.

    Mind the calculation priority of arithmetic operations:

    • The operations of multiplication, division and remainder are performed first; then addition and subtraction operations are performed.
    • The operations are performed from left to right. If the formula uses several operations that have the same priority (for example, multiplication and division), the operation on the left will be performed first.
    • You can use brackets ( and ) to change the priority of operations. Operations in brackets have the highest priority in the calculation. The left-to-right principle also applies for them: operations in brackets on the left are calculated first.

    You can use constants in the formula:

    • Numerical (integer and float). Example: EURUSD*2+GBPUSD*0.7.
    • Symbol properties _Digits and _Point. They add to the formula appropriate properties of the custom symbol from the specification. _Digits means the number of decimal places in the instrument price; _Point means the smallest change in the symbol price.

    You can also use in the formula all mathematical functions supported in MQL5, except for MathSrand, MathRand and MathIsValidNumber: Only short names are used for all functions, such as fabs(), acos(), asin() etc.

  3. Terminal: A new option has been implemented, allowing to add quotes of custom instruments in real time. Now, it is possible to develop an MQL5 Expert Advisor that would be feeding quotes of the specified custom symbol. The CustomTicksAdd function is used for that.
    int  CustomTicksAdd(
       const string           symbol,       // Symbol name
       const MqlTick&         ticks[]       // The array with tick data that should be applied to the custom symbol
       );
    The CustomTicksAdd function allows feeding quotes as if these quotes were received from a broker's server. Data is sent to the Market Watch window instead of being directly written to the tick database. Then, the terminal saves ticks from the Market Watch to the database. If a large volume of data is passed in one call, the function behavior changes, in order to save resources. If more than 256 ticks are transmitted, data is divided into two parts. A larger part is recorded directly to the tick database (similar to CustomTicksReplace). The second part consisting of the last 128 ticks is sent to the Market Watch, from where the terminal saves the ticks to a database.

  4. MQL5: New online service MQL5 Cloud Protector has been added to provide additional protection for MQL5 programs. Protection is similar to the option used in the largest store of trading applications MetaTrader Market, where the EX5 product files submitted by sellers are additionally compiled to native code.

    Now, this type of protection is available to all platform users. To protect your files, execute the following command in MetaEditor: Tools—MQL5 Cloud Protector. The only difference of MQL5 Cloud Protector from the mechanism used in the Market, is that the file is not linked to the user's computer. Protected via MQL5 Cloud Protector files can be run on any computers similar to common EX5 files.
    MQL5 Cloud Protector is a secure service. Additional protection is only applied to a compiled file. The source code is not passed to the service. At the first step, a program is compiled to an EX5 file on the user's computer; after that the compiled file is sent over an encrypted channel to the service, where it is protected and returned to the user.



  5. Terminal: The Market Watch window now additionally features the High and Low prices. These columns are hidden by default. They can be enabled using the context menu:




    If a symbol chart is constructed using Bid prices (as per specification settings), Bid High and Bid Low prices are shown for this symbol. If a symbol chart is constructed using Last prices, Last High and Last Low prices are shown for this symbol.

    If Market Watch contains at least one symbol whose chart is drawn based on Last prices, the Last column is automatically enabled in addition to High/Low.

  6. Terminal: Now it is possible to edit the tick history of custom financial instruments. Click 'Symbols' in the Market Watch context menu, select a custom symbol and request the required data interval in the Ticks tab.

    • Double-tap to change the value.
    • Use the context menu to add or delete entries.
    • If you need to delete multiple bars/ticks at once, select them with the mouse, holding down Shift or Ctrl+Shift.




    For convenience, modified entries are highlighted as follows:

    • Green background indicates a modified entry
    • Gray background means a deleted entry
    • Yellow background shows an added entry

    To save the changes, click "Apply Changes" at the bottom of the window.

  7. Terminal: Added display of preliminary accounts in the Navigator tree.

    Traders can send a request to a broker to open a real account straight from desktop terminals. The user needs to fill in a simple request form with contact details. A special preliminary account is created for the trader after that. Then, the broker contacts the trader to formalize relations and turn the real account from the preliminary one.




  8. Terminal: Added display of time in millisecond in the Quotes window.





  9. Terminal: Scanning of available servers in the new account opening dialog has become faster.
  10. Terminal: Fixed display of the Trendline graphics object with the Ray Left and Ray Right options enabled.
  11. Terminal: Optimized operation with a large amount of internal emails (hundreds of thousands).
  12. Terminal: Optimized terminal operation with a large amount of trading instruments (50,000 or more).
  13. Terminal: Added optimization of the tick history of custom financial instruments executed after editing history.
  14. MQL5: New functions for working with custom financial instruments have been added.

    Function Action
    CustomSymbolCreate Create a custom symbol with the specified name in the specified group
    CustomSymbolDelete Delete a custom symbol with the specified name
    CustomSymbolSetInteger Set the integer type property value for a custom symbol
    CustomSymbolSetDouble Set the real type property value for a custom symbol
    CustomSymbolSetString Set the string type property value for a custom symbol
    CustomSymbolSetMarginRate Set the margin rates depending on the order type and direction for a custom symbol
    CustomSymbolSetSessionQuote Set the start and end time of the specified quotation session for the specified symbol and week day
    CustomSymbolSetSessionTrade Set the start and end time of the specified trading session for the specified symbol and week day
    CustomRatesDelete Delete all bars from the price history of the custom symbol in the specified time interval
    CustomRatesReplace Fully replace the price history of the custom symbol within the specified time interval with the data from the MqlRates type array
    CustomRatesUpdate Add missing bars to the custom symbol history and replace existing data with the ones from the MqlRates type array
    CustomTicksAdd Adds data from an array of the MqlTick type to the price history of a custom symbol. The custom symbol must be selected in the Market Watch window.
    CustomTicksDelete Delete all ticks from the price history of the custom symbol in the specified time interval
    CustomTicksReplace Fully replace the price history of the custom symbol within the specified time interval with the data from the MqlTick type array

  15. MQL5: Added Generic Data Collections to the Standard Library. They contain classes and interfaces for defining collections based on templates. The new strongly typed collections provide a greater application development convenience and high data handling performance.

    The library is placed to the Include\Generic folder of the terminal's working directory.

  16. MQL5: Added support for templates for the union data type.
  17. MQL5: The SYMBOL_VISIBLE trading instrument property has been added. Call of SymbolInfoInteger(symbol, SYMBOL_VISIBLE) returns false if the specified symbol is not visible in the Market Watch.
  18. MQL5: Added new CHARTEVENT_MOUSE_WHEEL property. The event is called when the mouse wheel is scrolled or pressed on the chart (if CHART_EVENT_MOUSE_WHEEL=true for the chart).
  19. MQL5: The following chart properties have been added:

    • CHART_EVENT_MOUSE_WHEEL — enabling/disabling generation of CHARTEVENT_MOUSE_WHEEL (mouse scroll and click event on the chart). Possible values: 0 and 1.
    • CHART_CROSSHAIR_TOOL — enable/disable the possibility to switch cursor to the Crosshair mode by a middle click. Possible values: 0 and 1.
    • CHART_CONTEXT_MENU — enable/disable the use of right click to display the context menu of the chart. Possible values: 0 and 1.

  20. MQL5: Now, drawing buffers with the DRAW_NONE style are not taken into account when calculating the indicator window scale.
  21. MQL5: Added the CHARTEVENT_CHART_CHANGE event generation when setting the CHART_SCALEFIX (fixed scale) property for the chart.
  22. MQL5: The ArraySwap function has been added, allowing to quickly swap the contents of dynamic arrays.
    bool  ArraySwap(
       void&  array1[],      // The first array
       void&  array2[]       // The second array
       );
    The function accepts dynamic arrays of the same type and the same dimensions. For multidimensional arrays, the number of elements in all dimensions except the first one should match.

  23. MQL5: Added the new property TERMINAL_RETRANSMISSION — percentage of resent network packets (re-transmits) in the TCP/IP protocol for all running applications and services on the given computer. Packet loss occurs even in the fastest and correctly configured networks. In this case, there is no confirmation of packet delivery between the recipient and the sender. Therefore, lost packets are resent.

    The terminal does not calculate this value. It is requested from the operating system once per minute. It is not an indication of the connection quality between a particular terminal and a trade server, since the percentage is calculated for the entire network activity, including system and background activity.

    The TERMINAL_RETRANSMISSION property is added to the ENUM_TERMINAL_INFO_DOUBLE enumeration, the TerminalInfoDouble function is used to obtain it.
  24. MQL5: Optimized working with trade history.
  25. Signals: Fixed indication of order filling type in case of forced closing of positions opened according to a Signal. The 'Stop if the account is lower than XXX USD' option is provided in signal copying options: if equity drops below a specified level, copying of trade signals is automatically terminated, all positions are closed. Earlier, an incorrect filling type could be set for position closing orders in case of forced closure. Now the terminal checks allowed filling types in symbol settings and indicates a proper option.
  26. Tester: The behavior of the HistoryOrderSelect function in the Strategy Tester now corresponds to the same function in the client terminal.
  27. Tester: The behavior of the CopyTicks and CopyTicksRange functions in the Strategy Tester now corresponds to the same functions in the client terminal.
  28. Tester: Optimized display of graphics objects during visual testing.
  29. Tester: Fixed display of testing results of exchange instruments (with the exchange risk management model). Now, the chart only shows the equity, while the balance and the deposit load are not shown. The trading status of such accounts is evaluated based on the equity level. The balance only shows the amount of money on the account and ignores the trader's assets and liabilities. Deposit load (margin/equity) is not displayed, because in the exchange calculation mode margin is equal to the current discounted value of the asset/liability, and it changes along with equity.
  30. MetaEditor: Added the ability to easily insert properties and resources to program code. For example, you can quickly add an included file to code. Use command "Insert—MQH as #incude", and select the desired include file. The #include directive with the proper path to the selected file will be inserted to program code.




    The same menu allows adding to program code files in the form of a binary or text array. Among others, you can transfer chart templates with Expert Advisors or indicators: insert your template in the program code as an array, and save it to disk then using the FileSave function. After that the template can be applied on the desired chart right from an Expert Advisor using the ChartApplyTemplate function.
    //+------------------------------------------------------------------+
    //| Script program start function                                    |
    //+------------------------------------------------------------------+
    void OnStart()
      {
    //--- Template file as a binary array
       unsigned char my_template[]=
         {
          0xFF,0xFE,0x3C, ... ,0x00 // The data array in this example is shortened
         };
    //--- Saving and applying the template
       if(FileSave("my_template.tpl",my_template))
         {
          Print("Custom template saved in \\MQL5\\Files");
          if(ChartApplyTemplate(0,"\\Files\\my_template.tpl"))
             Print("Custom template applied to the current chart");
          else
             Print("Failed to apply custom template");
         }
       else
          Print("Failed to save custom template");
      }

  31. MetaEditor: Added an option for converting strings between ASCII, HEX and Base64 formats. Select a line in the source code and click the desired command in the Edit—Convert menu:




  32. MetaEditor: Fixed case-insensitive search in files.
  33. MetaEditor: Fixed a debugger error that could occur when calculating expressions similar to x.y[0][1].z.
  34. MetaEditor: Fixed code navigation using Forward and Back buttons.
  35. The user interface is now also available in Dutch.
  36. 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 1745

MetaQuotes Software Corp., 2018.01.11 13:58

New MetaTrader 5 Platform Build 1745

The MetaTrader 5 platform update will be released on January 12, 2018.

MetaTrader 5 build 1745 will be the last platform version supporting Microsoft Windows XP/2003/Vista
A few months ago, we announced end of support for older versions of operating systems. Windows 2003, Windows Vista and especially Microsoft Windows XP are outdated operating systems. Microsoft ended support for Windows XP three years ago, because potential hardware capabilities could no longer be realized on this system due to technical limitations.

MetaTrader 5 build 1745 and older versions will continue to work on the above operating systems, but will no longer receive updates. Platform installers will not run on these operating systems.

The minimum required operating system version for running MetaTrader 5 is Windows 7. However, we strongly recommend using the 64-bit version of Windows 10.

The new version features the following changes:

  1. Terminal: The /auto key has been added to the installer, allowing to install the program in automated mode without additional actions required from the user. When the installer is launched with this key, installation settings will not be shown to the user, and the terminal will be installed at the standard path, with the standard Start menu folder name for the program. Example of such launch:
    C:\mt5setup.exe /auto
  2. Terminal: Fixed installer operation in cases when the user does not have appropriate operating system permissions.
  3. Terminal: Fixed excessive consumption of CPU resources when no actions are performed in the terminal (when there are no open charts and no actions are performed by the user).
  4. Terminal: The new version features automatic compression of *.log files at the file system level. The new functionality allows reducing the amount of disk space used by logs.
  5. Tester: The amount of cache during single test runs has been increased. This provides faster testing in 64-bit operating systems.
  6. Tester: Fixed optimization of trading robots using the MQL5 Cloud Network. Issues could arise with products purchased from the MetaTrader Market.
  7. Tester: Fixed calculation of spreads for bars generated in the "Every Tick" testing mode.
  8. Tester: Fixed selection of OpenCL devices in the strategy tester. Now, the visual tester is allowed to access all available OpenCL devices.
  9. Tester: The new version features automatic compression of *.log files at the file system level. The new functionality allows reducing the amount of disk space used by logs.
  10. MQL5: Fixed deletion of bars of a custom symbol using the CustomRatesDelete method.
  11. Fixes based on crash reports.
  12. Updated documentation.
The update is available through the LiveUpdate system.

Reason: