What's new in MetaTrader 5

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

21 February 2019
MetaTrader 5 Platform build 2005: Economic Calendar, MQL5 applications as services and R language API

Terminal

  1. Completely revised built-in Economic Calendar.

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

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

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




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

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

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





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

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

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




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

  3. A learning program has been added.

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

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

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




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




  5. Added new API enabling request of MetaTrader 5 terminal data through applications using the R language.

    We have prepared a special MetaTrader package. It contains DLL for interactions between R and the MetaTrader 5 terminal, documentation and auxiliary r files. We are completing the package registration in the CRAN repository, after which it will be available for download and installation.




    The package can be installed using a special command:
    R CMD INSTALL --build MetaTrader

    The following commands related to data request are available:

    • MT5Initialize initializes and establishes connection with the MetaTrader 5 terminal. If necessary, the terminal is launched during command execution.
    • MT5Shutdown de-initializes and disconnects from MetaTrader 5.
    • MT5Version gets the MetaTrader 5 terminal version.
    • MT5TerminalInfo gets the state and parameters of terminal connection to a broker's server (account number and server address).
    • MT5WaitTerminal waits for the MetaTrader 5 terminal to connect to a broker's server.
    • MT5CopyTicksFrom(symbol, from, count, flags) copies the specified number of ticks starting from the specified date. The date is specified in milliseconds since 01.01.1970.
    • MT5CopyTicksRange(symbol, from, to, flags) copies ticks from within the specified period. The dates are specified in milliseconds since 01.01.1970.
    • MT5CopyRatesFrom(symbol, timeframe, from, count) copies the specified number of one-minute bars starting from the specified date. The date is specified in seconds since 01.01.1970.
    • MT5CopyRatesFromPos(symbol, timeframe, start_pos, count) copies one-minute bars from the specified position relative to the last bar.
    • MT5CopyRatesFromRange(symbol, timeframe, date_from, date_to) copies bars from within the specified period. The dates are specified in seconds since 01.01.1970.

    The list of supported commands will be further expanded.

  6. Optimized Close By dialog used for closing a position by an opposite one. Now, the dialog is not slowed down even if you have a large number of open positions.
  7. Fixed synthetic symbol calculation errors, due to which data could be occasionally skipped.
  8. When a custom symbol is deleted, files storing its tick and bar history are also deleted. This avoids the accumulation of unused data on the hard disk.
  9. Fixed display of search results on High DPI screens.

MQL5

  1. Implemented access to economic calendar data from MQL5 programs.

    New functions

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

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

    New structures

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

    New enumerations

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

    New error codes

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

  2. Fixes and operation speed improvements related to tick and bar history.
  3. Fixes and significant operation speed improvements related to tick and bars history modification functions of custom trading symbols, CustomTicks* and CustomRates*.
  4. New data conversion functions.

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

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

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

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

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

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

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

  7. Added new functions for string operations:

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

  8. Added new function for array operations:

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

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

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

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

  13. New TERMINAL_VPS property in the ENUM_TERMINAL_INFO_INTEGER enumeration; it shows that the terminal is running on the MetaTrader Virtual Hosting server (MetaTrader VPS). If an application is running on a hosting server, you can disable all its visual functions, since the virtual server does not have a graphical user interface.
  14. New SYMBOL_EXIST property in the ENUM_SYMBOL_INFO_INTEGER enumeration, means that the symbol under this name exists.
  15. Fixed typing when using template function pre-declarations.
  16. Added re-initialization of indicators when changing a trading account.
  17. Optimized StringSplit function.
  18. Fixed errors in the standard library operation.

Tester

  1. Added TesterStop function — routine early shutdown of an Expert Advisor on a test agent. Now you can forcibly stop testing after reaching the specified number of losing trades, a preset drawdown level or any other criterion.

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

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




MetaEditor

  1. Added support for non-ANSI characters in the debugger. Now, the expressions are properly displayed even if the variable name is specified in Cyrillic.
  2. Fixed display of search results on High DPI screens.

Added user interface translation into Croatian.

Documentation has been updated.

26 October 2018
MetaTrader 5 platform build 1930: Floating window charts and .Net libraries in MQL5

Terminal

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

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



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

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

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




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

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



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



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



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



  9. Fixed terminal freezing in case of a large amount of economic calendar news.

MQL5

  1. Added native support for .NET libraries with "smart" functions import. Now .NET libraries can be used without writing special wrappers — MetaEditor does it on its own.

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

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

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

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

    WinAPI functions are grouped in separate files by their purpose:

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

    The binding works only with the 64-bit architecture.

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

  4. Significantly optimized execution of MQL5 programs. In some cases, the performance improvement can reach 10%. Recompile your programs in the new MetaEditor version to make them run faster.
    Unfortunately, new programs will not be compatible with previous terminal versions due to this additional optimization. Programs compiled in MetaEditor version 1912 and later cannot be launched in terminal versions below 1912. Programs compiled in earlier MetaEditor versions can run in new terminals.

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

    Added the following properties to the ENUM_CHART_PROPERTY_INTEGER enumeration:

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

    Added the following functions to the ENUM_TERMINAL_INFO_INTEGER enumeration:

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

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

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

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

  8. Added new properties to the ENUM_SYMBOL_INFO_DOUBLE enumeration:

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

    Use the SymbolInfoDouble function to get these properties.

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

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

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

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

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

  13. Optimized some cases of accessing tick history via the CopyTicks* functions.
  14. Added the new TesterStop function allowing for early completion of a test/optimization pass. When calling it, the entire trading statistics and OnTester result are passed to the client terminal just like during the normal test/optimization completion.
  15. Added the new property for custom indicators #property tester_everytick_calculate. It is used in the strategy tester and allows for forced indicator calculation at each tick.

Tester

  1. Now, in case of a non-visual test/optimization, all used indicators (standard and custom ones) are calculated only during a data request. The exceptions are indicators containing the EventChartCustom function calls and applying the OnTimer handler. Previously, all indicators were unconditionally calculated in the strategy tester at each incoming tick (even from some other instrument). The new feature significantly accelerates testing and optimization.

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

  2. Fixed calculating the deposit currency accuracy when testing/optimizing and generating relevant reports.
  3. Optimized and accelerated the strategy tester operation.
  4. Fixed a few testing and optimization errors.

MetaEditor

  1. Fixed search for entire words. Now when searching, the underscore is counted as a regular character, rather than a word delimiter.

Updated documentation.

6 July 2018
MetaTrader 5 build 1880: calculation of the complete history of synthetic symbols

Terminal

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

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




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

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

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

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

MQL5

  1. New property ACCOUNT_CURRENCY_DIGITS — the number of decimal places in the account deposit currency. Use the AccountInfoInteger function to get the property. You may use the property when calculating profit on your own, to normalize the values ​​obtained.
  2. Fixed delay in the execution of Copy functions and i-functions during operations with the weekly timeframe.
  3. Fixed operation of the WebRequest function.

Tester

  1. Added ability to perform a single Expert Advisor test after downloading optimization results from a cache file.
  2. The new version features a faster initial download of price history by local agents.

Documentation has been updated.

26 June 2018
MetaTrader 5 build 1870: adding symbols to Market Watch by ISIN

Terminal

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



  2. Fixed user interface slowdown when changing a trading account password.
  3. Fixed occasional CPU load increase caused by the client terminal.

MQL5

  1. Fixed passing of custom HTTP headers in the WebRequest function.
  2. Fixed behavior of the Bars function in cases when the range beginning and end dates are the same. Now, if there is a bar, the function returns 1. In earlier versions, the function unconditionally returned 0.

Tester

  1. Fixed start of single testing in the visual mode after a forward optimization.
  2. Fixed sorting of optimization results. Now sorting takes into account passes with incorrect input parameters (INIT_INCORRECT_PARAMETERS) and those having no profit factor.
  3. Fixed recalculation of genetic optimization graph after changing the optimization criterion.

Documentation has been updated.

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

Terminal

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

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




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




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




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




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




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




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

MQL5

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Tester

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

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

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



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

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

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




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

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

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




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

    MetaEditor

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

Documentation has been updated.

18 January 2018
MetaTrader 5 Platform Build 1755

Terminal

  1. Fixed an error that caused the terminal and MetaEditor to block Windows shutdown and reboot.
  2. Fixed the chart shift when applying a template.

MQL5

  1. Fixed errors that slowed down compilation in some conditions.

Fixed errors reported in crash logs.

12 January 2018
MetaTrader 5 Platform Build 1745

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.

Terminal

  1. 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. Fixed installer operation in cases when the user does not have appropriate operating system permissions.
  3. 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. 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. The amount of cache during single test runs has been increased. This provides faster testing in 64-bit operating systems.

Tester

  1. Fixed optimization of trading robots using the MQL5 Cloud Network. Issues could arise with products purchased from the MetaTrader Market.
  2. Fixed calculation of spreads for bars generated in the "Every Tick" testing mode.
  3. Fixed selection of OpenCL devices in the strategy tester. Now, the visual tester is allowed to access all available OpenCL devices.
  4. 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.

MQL5

  1. Fixed deletion of bars of a custom symbol using the CustomRatesDelete method.
Fixes based on crash reports.
Updated documentation.
20 December 2017
MetaTrader 5 Build 1730: projects in MetaEditor and Synthetic financial instruments

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.

Terminal

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


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


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


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

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




  6. Added display of time in millisecond in the Quotes window.





  7. Scanning of available servers in the new account opening dialog has become faster.
  8. Fixed display of the Trendline graphics object with the Ray Left and Ray Right options enabled.
  9. Optimized operation with a large amount of internal emails (hundreds of thousands).
  10. Optimized terminal operation with a large amount of trading instruments (50,000 or more).
  11. Added optimization of the tick history of custom financial instruments executed after editing history.

MetaEditor

  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. 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");
      }

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




  4. Fixed case-insensitive search in files.
  5. Fixed a debugger error that could occur when calculating expressions similar to x.y[0][1].z.
  6. Fixed code navigation using Forward and Back buttons.

MQL5

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




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

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

  4. Added support for templates for the union data type.
  5. 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.
  6. 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).
  7. 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.

  8. Now, drawing buffers with the DRAW_NONE style are not taken into account when calculating the indicator window scale.
  9. Added the CHARTEVENT_CHART_CHANGE event generation when setting the CHART_SCALEFIX (fixed scale) property for the chart.
  10. 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.

  11. 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.
  12. Optimized working with trade history.

Signals

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

Tester

  1. The behavior of the HistoryOrderSelect function in the Strategy Tester now corresponds to the same function in the client terminal.
  2. The behavior of the CopyTicks and CopyTicksRange functions in the Strategy Tester now corresponds to the same functions in the client terminal.
  3. Optimized display of graphics objects during visual testing.
  4. 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.
  • The user interface is now also available in Dutch.
  • Updated documentation.
  • 21 July 2017
    MetaTrader 5 Build 1640: creating and testing custom symbols

    Terminal

    1. 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 (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. 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. 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. Fixed refreshing of toolbars after minimizing and maximizing the terminal window.
    5. Fixed generation of position trading history if trade and position tickets overlap.

    MQL5

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



    2. 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
      */

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

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

    5. Now, the TimeToStruct function returns a boolean value, allowing to check the success of conversion of datetime to MqlDateTime.
    6. Added ban to use the FileWriteStruct and FileReadStruct functions for structures containing strings, dynamic arrays, object and pointers.
    7. 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

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

    11. Optimized synchronization and access to the tick history.
    12. Fixed returning of ticks to the statistic array in the CopyTicksRange function. In earlier versions, 0 ticks were always returned in this case.
    13. Various fixes have been made in the Fuzzy Logic Library.

    Signals

    1. : Fixed opening of a signal from the website when there is no trading account connection.

    Tester

    1. 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).
    2. Fixed calculation of position holding time in the testing report.

    MetaEditor

    1. Fixed the display of the contents of static class member arrays in the debugger.
    2. 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.


    Updated documentation.
    26 April 2017
    MetaTrader 5 Build 1596: access to the price history

    Terminal

    1. 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. Added display of time with a millisecond precision for positions, deals and orders.




    3. In the trade dialog, fixed notifying about the refusal to execute a Close By request.

    MQL5

    1. Fixed the PositionSelect function. The function could occasionally select a position different from the one having the lowest ticket number.
    2. Fixed operation of the CopyTicks and CopyTicksRange functions when requesting very deep tick history data.

    Signals

    1. Fixed copying of operations that increase the size of an existing position. The error could occasionally occur on netting accounts.

    Tester

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

    Updated documentation.

    24 March 2017
    MetaTrader 5 Build 1570: improved Market showcase and extended MQL5 template functions

    Terminal

    1. 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. 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. Fixed occasional incorrect sorting of position history.
    4. Optimized and fixed display of the Exposure tab.

    MQL5

    1. 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)

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

    3. Optimized display of custom indicators with the DRAW_ZIGZAG drawing type.
    4. 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.

    5. 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.
    6. 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.
    7. Fixed re-encoding of 24-bit images when placing them to MQL5 application resources.
    8. Fixed printing structures using the ArrayPrint function.
    9. Updated the MQL5 standard libraries.

    MetaEditor

    1. Added translation of the user interface into Malay.

    Signals

    1. Signals: Fixed opening a signal page in the terminal when moving from the MQL5.community website while not connected to a trading account.

    Tester

    1. Fixed the CopyTicks function operation in the strategy tester.
    2. Fixed sorting Withdrawal trades when generating a report.
    3. Fixed modifying pending orders.

    Hosting

    1. Hosting: Fixed display of the virtual hosting wizard on ultra-high resolution screens (4К).

    Updated documentation.

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

    Terminal

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



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




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




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

    MQL5

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

    Tester

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

    Updated documentation.

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

    Terminal

    1. Now trading history can be additionally displayed in the form of positions. The terminal collects data on deals related to a position (position opening, additional volume, partial and full closure), and then combines the data into one record providing the following details:

      • Position opening and closing time determined by the first and last trade respectively
      • Position volume. If part of the position has been closed, the record contains the closed volume and the initial volume
      • The weighted average position opening price and its close price
      • The total financial result of deals related to the position




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




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

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




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




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



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

    MQL5

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

      Declaration of the resource variable
      #resource path_to_resource_file as type_of_resource_variable name_of_resource_variable

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

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

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

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

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

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

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

      Functions ChartGetInteger and ChartSetInteger allow getting and setting the property.

    4. Added new functions for working with OpenCL.

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

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

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

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

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

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

    Market

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

    Tester

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




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

    MetaEditor

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




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

    Updated documentation.

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

    MQL5

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

    Fixed errors reported in crash logs.

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





    • Another new option allows changing the master and investor passwords. Take this opportunity to create an easy-to-remember personal ID.
    • Also, the updated web platform can automatically generate demo accounts. Now, you can launch the MetaTrader 5 Web platform from any browser and start trading Forex, Stocks or Futures financial instruments immediately.
    24 November 2016
    MetaTrader 5 Build 1485: Additional testing mode and graphics in the Standard Library

    Terminal

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



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

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




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

    MQL5

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

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

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

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


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



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

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

    Tester

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


      Only the random delay mode was available in earlier versions.

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

    MetaEditor

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



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

    Updated documentation.

    14 October 2016
    MetaTrader 5 Build 1455: Libraries of mathematical functions in MQL5

    Terminal

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




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




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

    MQL5

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

      Library Features

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

      How to Use

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

      #include <Math\Alglib\alglib.mqh>

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

      Library Features

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

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

      How to Use

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

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

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


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

      Library Features

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

      How to Use

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

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

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


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




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

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

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

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

    Market

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

    Tester

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

    Updated documentation.

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

    16 September 2016
    MetaTrader 5 Build 1430: Updated Exposure tab

    Terminal

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

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

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

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




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

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





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

    MQL5

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

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

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

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

      'final' modifier for functions

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

    Market

    1. Fixed a few errors in sorting Market products.

    Tester

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

    MetaEditor

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

    Updated documentation.

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

    Terminal

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

    MQL5

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

    Tester

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




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

    MetaEditor

    1. Added UI translation into Traditional Chinese.

    Updated documentation.

    12345678910111213