What's new in MetaTrader 5

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

10 July 2020
MetaTrader 5 build 2530: Sorting in Market Watch and advanced operations with optimization results

Terminal

  1. A sorting option has been added to the Market Watch window:

    • Click on a column name to sort the list by required data, such as the symbol name, close price, daily change or other variables.
    • Use the new menu with the most popular sorting options. Sorting by the highest growth and fall based on a daily symbol price change can be useful when trading exchange instruments.



  2. Redesigned and improved built-in learning system.
    All interactive hints are grouped into various categories for easier navigation. The number of completed and remaining hints is shown for each category.



    Every hint is now provided with a checklist, indicating the key action which the user should execute in order to complete training.
    We have also revised the learning system design and fixed errors in the total progress calculation.

  3. Added automated calculation of a symbol's previous session close time and of its current session open time. If the appropriate data is not provided by the broker directly, the terminal will calculate the values based on the first and the last quotes in a session. The relevant information can be displayed in the Market Watch window: enable appropriate columns in the "Symbols" section or navigate to the "Details" section.



  4. Optimized and accelerated application of prices to open positions. When new ticks arrive in the terminal, prices, profit and margin requirements are updated faster.
  5. Fixed calculation of the built-in Stochastic Oscillator. An error could occur in the case where a limited number of bars was displayed on charts.

MQL5

  1. Optimized and accelerated AccountInfo* function which provides access to trading account properties.
  2. Optimized and accelerated access to numerical chart properties via the ChartGetInteger function.

MetaEditor

  1. The following context menu commands have been added to the code editing tabs for efficient operations with the MQL5 Storage:

    • Compare a working copy of a file with the current revision
    • Revert changes
    • View file change history



  2. Changed the highlighting of matching brackets. Now, highlighting is applied to brackets instead of the background. The highlighting is disabled by default. It can be enabled in editor settings.


  3. Improved search and replace functions:

    • If you select a text in the file and bring up the search box, the text will be automatically substituted in the "Find" field. If no text is selected, a text from the clipboard will be pasted in the "Find" field. If the clipboard is empty, the focus in the search box will be set to the "Find" field.
    • A similar behavior is implemented for the replace window: the selected text is inserted in the search field, and the cursor is moved to the "Replace with" field. Thus, you can immediately enter the required new text.
    • Search and replace results are now displayed in the log instead of the previously used separate dialog box. If the Toolbox window is enabled, the Journal tab will be automatically selected in it. Thus, you do not need to work with extra windows.

  4. Fixed search in the file comparison window when working with the MQL5 Storage.
  5. Added possibility to search and replace data in files connected to the current file via the #include directive.

    The new option enables faster operations with projects consisting of multiple files. For example, to replace a text in all files, you will not need to specify their directories manually. The editor can automatically find them through the #include directives.



Tester

  1. We have revised optimization criteria which include two variables, one of which is the balance. Now, the criteria only take into account the second variable and ignore the balance. The new optimization criteria are easier to analyze.

    • Balance + Maximum Profitability -> Maximum Profitability
    • Balance + Maximum Expected Payoff -> Maximum Expected Payoff
    • Balance + Minimum Drawdown -> Minimum Drawdown
    • Balance + Maximum Recovery Factor -> Maximum Recovery Factor
    • Balance + Maximum Sharpe Ratio -> Maximum Sharpe Ratio



  2. New quick commands in the "Optimization parameters" submenu, allow showing or hiding, of all input columns in the table with optimization results:



  3. Added coloring for the optimization results table and graph, for a more convenient visual analysis.
    The graph is colored with a green-to-red gradient, depending on the value of the optimization criterion. The following colors are used for the table:

    • Balance: values above the initial deposit are colored in blue, and those below the initial deposit are shown in red.
    • Profit: blue is used for values greater than zero, and red is used for values less than zero.
    • Expected Payoff: blue is used for values greater than zero, and red is used for values less than zero.
    • Drawdown: from green (0-5%) to red (greater than 30%).
    • Sharpe Ratio: from green (greater than 2) to red (less than 0).
    • Recovery Factor: from green (greater than 2) to red (less than 1).



  4. Filters have been added in the optimization results table. Use the filters to hide unsuccessful passes from the list:

    • Passes without trades
    • Loss-making passes
    • Passes with the drawdown greater than 50%
    • Passes with the Recovery Factor less than 1
    • Passes with the Sharpe Ratio less than 0.5



  5. Optimized work of the MQL5 Cloud Network. Now, when an optimization is launched for the same Expert Advisor, the network tries to use the same testing agents which were used during the previous optimization pass. This is because the required market environment, including the trading history, is already available for such agents.
Updated documentation.
26 June 2020
MetaTrader 5 iOS build 2505: Swipes, new sections and color schemes

MetaTrader 5 iOS build 2505

We have gathered feedback from MetaTrader 5 iOS users and redesigned the application considerably

  • Added search for symbols in the quotes section.
  • Added the default "color on white" color scheme for charts.
  • Added display of deals on charts.
  • Moved the timeframe switch panel upwards so that it no longer overlaps the chart.
  • Added vertical scaling of charts — simply swipe over the price scale.
  • Added the ability to move accounts to other devices using QR codes.
  • Added display of the daily price change in pips in the quotes section. The data is available only if it is provided by a broker.
  • Added support for swipes to Quotes, History and Trade screens.
  • Added adaptive selection of a trading volume for fast trading.
  • Added the ability to access the OTP generator via FaceID or fingerprint.
iPad navigation has been redesigned
  • Moved the one-click trading panel upwards;
  • Added the bottom menu with sections and indicators;
  • Moved email, news and account management sections to separate tabs;
  • Improved account management.
5 June 2020
MetaTrader 5 build 2485: iCustom improvements and overall optimization in MQL5

Terminal

  1. Optimized and significantly accelerated bar history editing for custom financial instruments. The improvement also concerns the CustomRatesUpdate function.
  2. Fixed exporting of custom symbol settings to a JSON file.
  3. Fixed errors reported in crash logs.

MQL5

  1. This version features a revised custom indicator loading algorithm via iCustom.

    If the backslash '\' is indicated before the custom indicator name, the EX5 indicator file is searched relative to the MQL5 root folder. So, for a call of iCustom(Symbol(), Period(), "\FirstIndicator"...), the indicator will be loaded as MQL5\FirstIndicator.ex5. If the file is not found at this path, error 4802 (ERR_INDICATOR_CANNOT_CREATE) is returned.

    If the path does not start with a backslash '\', the indicator is searched and loaded based on the following sequence of actions:

    • The EX5 file is searched in the same folder, where the caller program's EX5 is located. For example, the CrossMA.EX5 Expert Advisor is located at MQL5\Experts\MyExperts. It contains the following call: iCustom(Symbol(), Period(), "SecondIndicator"...). In this case, the indicator is searched at MQL5\Experts\MyExperts\SecondIndicator.ex5.
    • If the indicator is not found, a search relative to the Indicators root directory is performed: MQL5\Indicators. Thus, file MQL5\Indicators\SecondIndicator.ex5 is searched. If the indicator is not found, the function returns INVALID_HANDLE and error 4802 (ERR_INDICATOR_CANNOT_CREATE) is raised.

    If the indicator path is set in a subdirectory such as MyIndicators\ThirdIndicator, the search starts in the folder of the calling program (the Expert Advisor is located in the folder MQL5\Experts\MyExperts) at the following path: MQL5\Experts\MyExperts\MyIndicators\ThirdIndicator.ex5. In case of failure, file MQL5\Indicators\MyIndicators\ThirdIndicator.ex5 is searched. Please note that the path separator should be specified as a double backslash '\\'. For example: iCustom(Symbol(), Period(), "MyIndicators\\ThirdIndicator"...)

    Also, if a custom indicator call via iCustom is found in the program code, the compiler will implicitly add the "#property tester_indicator XXX" directive if it is not specified.

  2. Optimized and significantly accelerated HistorySelect function, which allows requesting the history of deals and orders.
  3. Fixed an occasional error in tick requesting via the CopyTicksRange function. The error caused the range beginning to be set to the day beginning rather than to the specified time.
  4. Optimized and significantly accelerated display of alerts via the Alert function.
  5. New property SYMBOL_TIME_MSC for the symbol's last tick time in milliseconds. The property can be obtained using the SymbolInfoInteger function.
29 May 2020
MetaTrader 5 Platform build 2470

Terminal

  • Fixed a bug which caused the inability to add financial symbols with '-', '=', '_' and '+' in their names into Market Watch.

MQL5

MetaEditor

  • Fixed expanded search by the '\n' and '\r' end-of-line characters.
Updated documentation.
22 May 2020
MetaTrader 5 Platform Build 2450: "Subscriptions" service, UI improvements and revised features in MetaEditor

Terminal

  1. We have released the all-new Subscriptions service. Subscriptions offer additional services which can assist you in trading. For example, you can subscribe to high-quality market data from well-known providers, analyze received data and develop new trading strategies. Optionally, you can request personal manager services to help you in learning trading basics or in mastering your platform usage skills.

    The service is currently under development and will become available for use in the next versions.

    How it works
    A new Subscriptions section has been added in the Navigator. All available services are displayed under this section. The list of services is configured on the broker side and thus it depends on the server to which you are connected. Subscriptions are divided into categories for easy browsing.



    Select a service to view its detailed description. Next, click Subscribe. All your active subscriptions are displayed under a separate section.


    When you subscribe to market data, appropriate trading instruments become available for selection in Market Watch. They can be used as regular symbols: view quotes in Market Watch, open charts and analyze them using objects and indicators, as well as run Expert Advisors in the strategy tester. Trading operations for these symbols are not supported.

    How to pay for subscriptions
    You can pay for the services using your trading account funds. There is no need to visit other websites, as the payment can be performed directly from the platform.

    Soon, we will add the possibility to purchase market data subscriptions by connecting to MetaQuotes-Demo
    We plan to set up subscriptions to market data from various exchanges around the world. In just a few clicks, you will be able to receive real-time quotes from Nasdaq, CME, NYSE, BOVESPA and other exchanges. You will be able to pay for subscriptions using an MQL5.community account, similarly to Market, Signals and Hosting purchases.

  2. Added new "Show ticker" option in chart settings. The option shows/hides the line containing the trading symbol name, the timeframe and a custom comment.




  3. Added option "Show trading history" in terminal settings and in chart settings. The ability to display market entries and exits on charts was available in previous versions but it was managed from the "Toolbox \ History" section. The new option enables a more comfortable setting of history display. You can configure it for all charts at a time or set separately for desired charts.



    Furthermore, you can quickly enable the display of trading history and trading levels using the chart context menu:



  4. Added new "Color on White" scheme in chart settings.



  5. New commands have been added to position and order context menus, enabling quick opening of the relevant symbol's Market Depth and chart:



  6. Added chart frame highlighting. This will help you to find the desired symbol chart when multiple charts are open in the terminal. Select a symbol in the Market Watch, an order or position line in the trading or history section, or an alert, and the frame of the appropriate symbol chart will blink three times.


  7. Improved display of trading levels on the chart.
    • Tickets are no longer displayed for positions, orders and levels, in order to keep the chart clean
    • Captions appear in uppercase for better readability
    • Volumes are displayed without the fractional part if it is zero
    • Levels are hidden if the chart height is less than 80 pixels


  8. Added display of symbol description (if it is available) in the upper left chart corner, in addition to symbol name.




  9. New columns have been added in the list of open orders and positions:
    • Change — operation profitability percentage
    • Value — the market value of the position
    • Magic — the identifier of orders and positions opened by the Expert Advisor (magic number)

    The new columns can be shown/hidden using the context menu.

    Position value and magic columns have also been added to the trading history section.

    Furthermore, the profit field in the open positions and history sections is highlighted depending on the operation result.

  10. Added support for negative prices. This enables proper platform operation in situations similar to the recent drop of oil prices below zero. This includes:
    • Display of quotes in Market Watch
    • Display of charts and Market Depth
    • Execution of trading operations
    • Calculation of profits and collateral

  11. The maximum number of symbols which can be simultaneously enabled in Market Watch has been increased to 5000.
  12. Fixed sorting in chats by the last update date.
  13. Optimized and accelerated operation with a large number of trading symbols (50,000 and more).
  14. Fixed a bug due to which it was impossible to close a position if its current volume did not correspond to the symbol's volume change step.

MQL5

  1. Optimized and accelerated operations with the tick history.
  2. Added new functions for working with databases:
    • DatabaseReset — resets the request to the initial state, similar to DatabasePrepare call. The function is intended for multiple execution of a request with different parameter values. For example, when adding data to the table in bulk using the INSERT command, a custom set of field values should be formed for each entry.
    • DatabaseBind — sets a parameter value in a request. The function is used in case an SQL request contains "?" or "?N" parameterizable values where N means the parameter index (starting from one).
    • DatabaseBindArray — sets an array as a parameter value.

  3. Added FSD_FILE_MUST_EXIST flag for the FileSelectDialog function. It indicates that the selected files must exist.
  4. Values for describing options have been added to the ENUM_SYMBOL_INFO_DOUBLE enumeration:
    • SYMBOL_PRICE_CHANGE — change of the current price relative to the end of the previous trading day in %.
    • SYMBOL_PRICE_VOLATILITY — price volatility in %.
    • SYMBOL_PRICE_THEORETICAL — theoretical option price.
    • SYMBOL_PRICE_DELTA — option/warrant delta. Shows the value the option price changes by, when the underlying asset price changes by 1.
    • SYMBOL_PRICE_THETA — option/warrant theta. Number of points the option price is to lose every day due to a temporary breakup, i.e. when the expiration date approaches.
    • SYMBOL_PRICE_GAMMA — option/warrant gamma. Shows the change rate of delta — how quickly or slowly the option premium changes.
    • SYMBOL_PRICE_VEGA — option/warrant vega. Shows the number of points the option price changes by when the volatility changes by 1%.
    • SYMBOL_PRICE_RHO — option/warrant rho. Reflects the sensitivity of the theoretical option price to the interest rate changing by 1%.
    • SYMBOL_PRICE_OMEGA — option/warrant omega. Option elasticity — a relative percentage change of the option price by the percentage change of the underlying asset price.
    • SYMBOL_PRICE_SENSITIVITY — option/warrant sensitivity. Shows by how many points the price of the option's underlying asset should change so that the price of the option changes by one point.

  5. Added export of BLOB fields in HEX format in the DatabaseExport function.
  6. New CHART_SHOW_TICKER property has been added to ENUM_CHART_PROPERTY_INTEGER — showing a symbol ticker in the upper left corner. If CHART_SHOW_TICKER is set to false, CHART_SHOW_OHLC is also set to false and thus OHLC is hidden.   
  7. The quality of code generated by the compiler has been improved. This enabled the increase of its execution speed.
  8. Fixed errors related to the compilation and execution of template functions and classes. These are:
    • Priority mismatch error for overloaded template function calls
    • Template method/class generation error
    • Error caused by an attempt to access an internal class for a template parameter of a template function
    • Template class code generation error caused by the use of an internal class.
    • Error using the B<int> template object before B<void*>
    • Errors in the creation of complex objects having the internal type C and wrapped multiple times
    • Error transferring function pointer argument as const ref template
    • Error passing internal struct to a template function
    • Priority mismatch error for the execution of template functions
    • Incorrect parenthesis count in for and do-while loops
    • Incorrect parenthesis count in class structure description
    • Slowdown when adding one element at a time using ArrayResize
    • Error choosing a matching overloaded function

  9. Fixed occasional errors in the CustomTicksReplace function.
  10. Fixed selection of the display period for the history of trade orders. Now, the range is based on the order execution date instead of the previously used creation date.

Python

  1. The path parameter has been added to the initialize method — path to metatrader.exe or metatrader64.exe. If the path is not specified, the module attempts to find the executable file on its own.
  2. The following new methods have been added:
    • symbols_get — receives all financial symbols from the MetaTrader 5 terminal.
    • symbols_total — obtains the number of all financial symbols in the MetaTrader 5 terminal.

  3. Added filtering by symbol groups for the following functions: orders_get, positions_get, history_orders_get and history_deals_get. Use call forms with the "group" parameter.
  4. The return value of order_send and order_check is now passed with the 'request' field containing the full description of the original request. For example:
    ...
    comment=Request executed
    request_id=55
    retcode_external=0
    request=TradeRequest(action=1, magic=234000, order=0, symbol='USDJPY', volume=0.1, price=108.018, stoplimit=0.0, ...
        traderequest: action=1
        traderequest: magic=234000
        traderequest: order=0
        traderequest: symbol=USDJPY
        traderequest: volume=0.1
        traderequest: price=108.018
        traderequest: stoplimit=0.0
    ...
  5. When launched on a chart, Python scripts now receive the chart symbol and period (in minutes) as arguments.
    import sys
    
    chart_symbol='unknown'
    chart_tf=1
    
    if len(sys.argv) == 3:
        chart_symbol, chart_tf = sys.argv[1:3];
    
    print("Hello world from", chart_symbol, chart_tf)
    
    >> Hello world from T.NYSE 15

MetaEditor

  1. Added command "Add an existing folder". It enables a batch addition of all supported files from the selected directory into the project.


  2. Expanded search and replace options.

    Added extended search features with partial regular expression support. Use \r, \n, \t to specify line feed and tab characters in search requests. Search and replace dialogs have been combined into a single multi-tab dialog.


    Added a separate tab for searching in programmer communities. These include MQL5.community, as well as GitHub, MSDN and Stack Overflow.

    Search results from external resources appear in the MetaEditor toolbox window:



    Furthermore, you can immediately download source files from GitHub. Files are downloaded into a separate subdirectory of the Projects folder, named in accordance with the GitHub project name.

    Search results can be additionally sorted by date.

  3. Added possibility to quickly change font size in the code editing window. To change the font size, press Ctrl and scroll the mouse wheel.
  4. Added possibility to import tables from CSV files to database tables. The following parameters can be set during import:
    • Table name in the database
    • Automatic or manual file encoding detection
    • Data separator type
    • Skipping of the specified number of lines at the beginning
    • Comment prefix
    • If the file has column names
    • How line breaks will be determined
    • Whether data should be added to a new table or to an existing one
    • What quotes to use for strings



  5. Added quick commands for inserting time and color into the program source code. Select the desired values from the interactive calendar and the palette, and the editor will insert them in the appropriate format.



  6. MQL4 support has been disabled, since only 64-bit code is generated now.
  7. Fixed Class snippet operation.
  8. Fixed support for absolute paths in projects.
Updated documentation.


6 March 2020
MetaTrader 5 build 2360: Extension of SQLite integration
  1. MQL5: SQLite database operation errors can now be analyzed using standard MQL5 tools. The following error codes have been added:

    • ERR_DATABASE_ERROR — generic error.
    • ERR_DATABASE_INTERNAL — SQLite internal logic error.
    • ERR_DATABASE_PERM — access denied.
    • ERR_DATABASE_BUSY — database file locked.
    • ERR_DATABASE_LOCKED — database table locked.
    • ERR_DATABASE_NOMEM — insufficient memory for completing operation.
    • ERR_DATABASE_READONLY — attempt to write to read-only database.
    • ERR_DATABASE_IOERR — disk I/O error.
    • ERR_DATABASE_CORRUPT — database disk image corrupted.
    • ERR_DATABASE_FULL — insertion failed because database is full.
    • ERR_DATABASE_CANTOPEN — unable to open the database file.
    • ERR_DATABASE_PROTOCOL — database lock protocol error.
    • ERR_DATABASE_SCHEMA — internal use only.
    • ERR_DATABASE_TOOBIG — string or BLOB exceeds size limit.
    • ERR_DATABASE_CONSTRAINT — abort due to constraint violation.
    • ERR_DATABASE_MISMATCH — data type mismatch.
    • ERR_DATABASE_MISUSE — library used incorrectly.
    • ERR_DATABASE_AUTH — authorization denied.
    • ERR_DATABASE_RANGE — bind parameter error, incorrect index.
    • ERR_DATABASE_NOTADB — file opened that is not database file.

  2. MQL5: Fixed operation of the DatabaseImport function which enables data import from a file into a database table.
  3. MetaEditor: Fixed output of strings longer than 32KB to logs.
  4. MetaEditor: Fixed occasional incorrect encoding in messages sent from the Python console (stdout, stderr) into the Errors section of the editor.
  5. Updated documentation.


21 February 2020
MetaTrader 5 Build 2340: Managing account settings in the Tester and expanded integration with Python

MetaEditor

  1. Added new functionality for working with SQLite databases.

    In the previous platform update, we introduced support for operations with SQLite databases directly from MQL5. The main functions have become available through the MetaEditor user interface:

    • Create and connect databases
    • View tables and perform quick data queries
    • Create and execute SQL queries and rollback changes

    How it works
    The quick database creation functionality is available from the MQL5 Wizard. You can easily create your first table and define its fields.


    Upon the database creation, you will be forwarded to a new Navigator section, which features commands for managing the data.

    Database tables are shown in the left-hand side window. Double-click on the table name to quickly query the first 1,000 records. In this navigator section, you can also create and open other databases, as well as work with tables.

    The database can be managed in the main editor window, in which you can fill in the table, search and select data, enter SQL queries and execute other operations:


    For further details about MetaTrader 5 operations with databases, please read the article entitled "SQLite: Native handling of SQL databases in MQL5".

  2. Expanded support for multi-lingual projects. This update provides further expanded possibilities for working with Python scripts:

    • Now, such scripts can be created using the MQL5 Wizard, while you can instantly add required library dependencies in the code.
    • Special icons have been added in the navigator and the relevant syntax is available in the editor.
    • When running a script via MetaEditor, messages from the Python console (stdout, stderr) appear under the Errors section.


    Click "Compile" in the editor to run the script:


    To work with Python, do not forget to specify its path under the Settings \ Compilers section in MetaEditor. To enable the use of the MetaTrader 5 library, install it using the following command:
    pip install MetaTrader5
    For Python integration details please read the relevant documentation.
  3. Added display of SQLite database files (*.db;*.sdb;*.sqlite;*.db3;*.s3db;*.sqlite3) in the Navigator.
  4. Fixed project property saving errors.

MQL5

  1. Completely revised Python integration. The update involves many new functions and new command naming.

    New naming
    The existing commands have been renamed as follows:
    MT5Initialize       -> initialize
    MT5Shutdown         -> shutdown
    MT5TerminalInfo     -> terminal_info
    MT5Version          -> version
    MT5CopyRatesFrom    -> copy_rates_from
    MT5CopyRatesFromPos -> copy_rates_from_pos
    MT5CopyRatesRange   -> copy_rates_range
    MT5CopyTicksFrom    -> copy_ticks_from
    MT5CopyTicksRange   -> copy_tick_range

    New commands
    The list of supported commands has been expanded. Added trading functions, as well as functions for working with the trading history and for receiving financial symbol and current account data.

    • account_info() receives information about the current account. An analogue of AccountInfoInteger , AcountIndoDouble and AccountInfoString.
    • positions_total() receives the number of open positions. An analogue of PositionsTotal.
    • positions_get(symbol, ticket) receives open positions by symbol or ticket.
    • orders_total() receives the number of orders. An analogue of OrdersTotal.
    • orders_get(symbol, ticket) receives open orders by symbol or ticket.
    • history_orders_total(from, to) receives the number of orders in the specified historical time frame.
    • history_orders_get(from, to, position, ticket) receives orders from the specified historical time frame, by ticket or as filtered by position.
    • history_deals_total() receives the number of deals in the history. An analogue of HistoryDealsTotal.
    • history_deals_get(from, to, position, ticket) receives deals from the specified historical time frame, by ticket or as filtered by position.
    • symbol_info(symbol) receives information about a financial instrument. An analogue of SymbolInfoInteger, SymbolInfoDouble, SymbolInfoString.
    • symbol_info_tick(symbol) receives the last tick by symbol. An analogue of SymbolInfoTick.
    • symbol_select(symbol, enable) enables/disables a symbol in Market Watch. An analogue of SymbolSelect.
    • order_check(request) checks order margin. An analogue of OrderCheck.
    • order_send(request) sends an order to the server. An analogue of OrderSend.
    • order_calc_margin(action, symbol, volume, price) calculates margin for an order. An analogue of OrderCalcMargin.
    • order_calc_profit(action, symbol, volume, price_open, price_close) calculates profit. An analogue of OrderCalcProfit.

    Running Python scripts on charts
    Python scripts can be run directly on platform charts, similarly to regular MQL5 programs. These scripts are marked with special icons in the Navigator.


    Script messages will be displayed under the "Toolbox \ Experts" section. If a MetaTrader 5 library is used in the script, it can receive trading symbol and account data, as well as perform trading operations.

    Python scripts can be executed on the same chart in parallel with other MQL5 scripts and Expert Advisors. To stop a script with a looped execution, remove it from the chart.

    Additional protection
    To enable additional account protection when using third-party Python libraries, you may activate the "Disable automated trading via external Python API" option in terminal settings.


    Python scripts can only perform trading operations when this option is disabled.

  2. Significantly accelerated re-launch of MQL5 programs and re-creation of custom indicators from MQL5 programs. In some cases, operations are performed 100 times faster.
  3. Added functions for working with databases:

    DatabaseImport
    Imports data from a file to a table.
    long  DatabaseImport(
       int           database,          // database handle received in DatabaseOpen
       const string  table,             // table name to insert data to
       const string  filename,          // file name to import data from
       uint          flags,             // combination of flags
       const string  separator,         // data separator
       ulong         skip_rows,         // number of first rows to skip
       const string  skip_comments      // string of characters, which define comments
       );

    DatabaseExport
    Exports a table or an SQL query result to a CSV file. The file is created in UTF-8 encoding.
    long  DatabaseExport( 
       int           database,           // database handle received in DatabaseOpen 
       const string  table_or_sql,       // table name or SQL query
       const string  filename,           // CSV file name for data export
       uint          flags,              // combination of flags
       const string  separator           // data separator in the CSV file
       );

    DatabasePrint
    Prints the table or SQL query result to the Experts journal.
    long  DatabasePrint(
       int           database,          // database handle received in DatabaseOpen
       const string  table_or_sql,      // table or SQL query
       uint          flags              // combination of flags
       );

  4. Added FileSelectDialog function, which calls the system dialog creating/opening a file or a folder.
    int  FileSelectDialog(
       string   caption,              // window title
       string   initial_dir,          // initial directory
       string   filter,               // extension filter
       uint     flags,                // combination of flags
       string&  filenames[],          // array with file names
       string   default_filename      // default file name
       );
    The new function enables the efficient user interaction with the MQL5 program.

  5. New DEAL_FEE value in the ENUM_DEAL_PROPERTY_DOUBLE enumeration. It is used for a deal fee. The value indicates a separate commission type charged by the broker.

Tester

  1. : Added functionality to specify custom trading account settings during strategy testing, such as trading limitations, margin settings and commission. The new functions provide extended capabilities for the modeling of various trading conditions.



    Common settings
    In this section, you can set the maximum number of open orders and positions, which can simultaneously exist on the account. Additionally, you can configure sessions during which the program is not allowed to trade.

    Margin
    The section allows configuration of margin reserving rules and position accounting systems to be used in testing:

    • Risk management — risk management model: OTC and exchange model, netting and hedging systems. For details please read the Documentation.
    • Margin call level — when this level is reached, the account switches to the Margin Call state.
    • Stop out level — when this level is reached, all orders are canceled and all trading positions are closed. These levels can be indicated in percentage and in money. If "in money' is selected, the levels are defined as the account's Equity value. If "In percent" is selected, the levels are defined as the account "Margin level" value (Funds/Margin*100).
    • Unrealized profit — accounting for the current floating profit/loss in the free margin:
      • Do not use unrealized profit/loss — do not include profit/loss of open positions in the calculation.
      • Use unrealized profit/loss — include open positions' profit/loss in the calculation.
      • Use unrealized profit — include only profit.
      • Use unrealized loss — include only loss.
    • Daily fixed profit — accounting for the client's daily fixed profit/loss in the free margin:
      • Use daily fixed profit/loss — include in the free margin profit and loss received during a trading day.
      • Use daily fixed loss — include only loss received during the trade day. During the day, the obtained profit is accumulated in the special account field ("Blocked"). At the end of the trading day, the accumulated profit is released (zeroed) and is added to the account balance (included in the free margin).
    • Release fixed profit at the end of day — this option becomes available only if the option "Use daily fixed loss" is selected. If it is enabled, the accumulated profit will be released (and thus included in the free margin) at the end of the day. Otherwise this profit amount will remain blocked.

    Commission

    This section provides control over commissions charged for all trading operations.

    • Commission may be single-level and multi-level, i.e. be equal regardless of the deal volume/turnover or can depend on their size. Appropriate data is displayed in the terminal.
    • Commission can be charged immediately upon deal execution or at the end of a trading day/month.
    • Different commissions can be charged depending on deal direction: entry, exit or both operation types.
    • Commission can be charged per lot or per deal.
    • Commission can be calculated in money, percentage or points.


  2. Optimized and accelerated work in the Market Scanner mode, during which multiple testing passes are run for all symbols available in the Market Watch.
  3. Deal or position size is now taken into account when calculating profit in pips. Previously, the calculation was only performed per one lot.
  4. Improved control over optimization results graph. The scroll option has been added for a zoomed optimization graph. Double-clicking on a graph point selects the corresponding result in the table of testing passes.
Updated documentation.
13 December 2019
MetaTrader 5 Platform Build 2280

Terminal

  1. Fixed a bug which caused inability to delete an Expert Advisor from the chart having no data.
  2. Fixed chart header display under Wine.

MQL5

  1. Improved loading and compilation speed of MQL5 programs.
  2. A double click on a chart is now passed as a single-click event to an MQL5 program. Previously, such events were not handled.
  3. Fixed StringTrimRight function operation.
  4. Added documentation for DirectX 3D visualization functions.

Tester

  1. Fixed a bug which cased the testing symbol in settings to be empty. The error could result from switching between trading accounts with different sets of trading instruments. The new behavior: if the previously selected symbol is not found in the currently connected trading account, the first available symbol In Market Watch is automatically selected instead.

MetaEditor

  1. Fixed application icon loading when reopening project properties.

Updated user interface translations.
Fixes based on crash logs.
6 December 2019
MetaTrader 5 Platform build 2265: DirectX functions for 3D visualization in MQL5 and symbol settings in Strategy Tester

Terminal

  1. More columns have become available in Market Watch. The main section now features 40 additional symbol parameters, which were previously available only under the Details tab.




  2. Added highlighting of the currently connected account and the current server in the Navigator. The function will be useful if you have multiple accounts with different brokers.




  3. Updated frame design for charts. Frames have become smaller and thus more space is now available for useful information.




  4. Modified algorithm for calculating trading totals when displaying the trading history as positions. The values are now calculated based on actual records.

    To display the trading history as positions, the terminal uses information about deals executed during the requested period. Only the positions closed within this period will be shown in history. If the position is still open or its close time does not fall within the selected interval, it will not be displayed in the history. Therefore, the total profit and commission in the 'positions' mode can differ from those in the 'orders/deals' history mode.

    For example, you are viewing the past week history. During this period, 100 deals were executed, 98 of which participated in the opening and closing of 20 positions. The last two deals opened new positions, which have not been closed up to now. In this case, the history of deals contains 100 records and appropriate total values calculated based on these deals. When viewing the history as positions, you will see 20 records collected based on 98 deals. Only this data will be taken into account when calculating total values. If the broker charges entry deal fees, the final commission value in the deals history will differ from the commissions shown in the positions history, because the two last deals will be ignored in the latter case.

  5. Implemented faster launching of MQL5 programs.
  6. New /beta key has been added for the terminal installation file, which allows downloading the beta version. In normal mode, the release version should be installed first, which can then be updated till a beta version. By skipping this step, you can save time and traffic. Installation start example:
    C:\mt5setup.exe /beta
  7. Fixed display of margin requirements for instruments with the "Exchange Stocks" type.
  8. Accelerated operation of all platform components through the use of the Clang/LLVM compiler. In some cases compilation is 20% faster.

MQL5

  1. Added new DirectX 11 functions and shaders for 3D visualization. Now powerful three-dimensional graphics can be created directly in MQL5.

    The new CCanvas3D class is an extension of the CCanvas custom graphics class. It is available in the \MQL5\Include\Canvas\ directory. The class features functions for rendering three-dimensional objects via DirectX API.

    • Create — creates a scene.
    • Attach — binds a scene to a chart.
    • Destroy — destroys a scene.
    • ObjectAdd — adds to the scene a descendant object inherited from the base CDXObject class.
    • Render — the full render loop, with buffer clearing and rendering of all CDXObject, added via the ObjectAdd method.
    • RenderBegin — starts scene rendering, fills the render buffer with the specified color (if DX_CLEAR_COLOR flag is set) and the depth buffers (when using DX_CLEAR_DEPTH), as well as sets the DXInputScene scene buffer for default shaders.
    • RenderEnd — completes scene rendering and receives a result to an internal buffer. If redraw==true, displays the image on the chart, on which it is running.
    • ViewMatrixGet — receives a view matrix.
    • ViewMatrixSet — sets a view matrix. The matrix is not compatible with ViewPositionSet, ViewRotationSet, ViewTargetSet and ViewUpDirectionsSet methods.
    • ViewPositionSet — sets camera position.
    • ViewRotationSet — sets camera rotation matrix.
    • ViewTargetSet — sets the point the camera is pointing at. Together with ViewUpDirectionsSet, it is an alternative to ViewRotationSet.
    • ViewUpDirectionsSet — sets the vertical position of the camera. Together with ViewTargetSet, it is an alternative to ViewRotationSet.
    • ProjectionMatrixGet — receives a projection matrix.
    • ProjectionMatrixSet — sets a projection matrix.

    Detailed documentation for the new library will be published soon.




  2. Added support for operations with SQLite databases directly from MQL5. This enables easy execution of SQL queries without creating complex instructions. The internal operation is implemented by the new standard library extension.

    The following functions are available:

    • DatabaseOpen — opens or creates a database in the specified file
    • DatabaseClose — closes a database
    • DatabaseTableExists — checks if there is a table in the database
    • DatabaseExecute — executes a query to the specified database
    • DatabasePrepare — creates a query handle, which can be further executed using DatabaseRead()
    • DatabaseRead — jumps to the next record in the query result
    • DatabaseFinalize — deletes a query which was created in DatabasePrepare()
    • DatabaseTransactionBegin — starts the execution of a transaction
    • DatabaseTransactionCommit — completes the execution of a transaction
    • DatabaseTransactionRollback — rolls back a transaction
    • DatabaseColumnsCount — receives the number of fields in a query
    • DatabaseColumnName — receives field name by number
    • DatabaseColumnType — receives field type by number
    • DatabaseColumnSize — receives field size in bytes
    • DatabaseColumnText — receives a string value of a field from the current record
    • DatabaseColumnInteger —  receives an int value from the current record
    • DatabaseColumnLong — receives a long value from the current record
    • DatabaseColumnDouble — receives a double value from the current record
    • DatabaseColumnBlob — receives an array of field values from the current record

    The following error codes have been added for function operations:

    • ERR_MQL_DATABASE_INTERNAL (5120) — internal database error
    • ERR_MQL_DATABASE_INVALID_HANDLE (5121) — invalid database handle
    • ERR_MQL_DATABASE_TOO_MANY_OBJECTS (5122) — maximum number of Database objects exceeded
    • ERR_MQL_DATABASE_CONNECT (5123) — database connection error
    • ERR_MQL_DATABASE_EXECUTE (5124) — request execution error
    • ERR_MQL_DATABASE_PREPARE (5125) — request creation error
    • ERR_MQL_DATABASE_NO_MORE_DATA (5126) — no more data to read
    • ERR_MQL_DATABASE_STEP (5127) — error moving to the next query record
    • ERR_MQL_DATABASE_NOT_READY (5128) — data to read query results is not yet ready
    • ERR_MQL_DATABASE_BIND_PARAMETERS (5129) — SQL query auto-substitution error

  3. Added new property of MQL5 programs, which enables the selection of a default visualization method.
    #property optimization_chart_mode "3d,InpX,InpY"
    The property allows setting the type of chart which opens at the end of optimization, as well as program parameters for the X and Y axes.

    The property only sets the default chart view. It can be changed manually at any time, using the context menu.

  4. MQL5: New MathArctan2 function. Returns the radian value of the angle, the tangent of which is equal to the ratio of the two specified numbers.
    double  MathArctan2(
       double  y      // the y coordinate of the point
       double  x      // the x coordinate of the point
       );
  5. We have performed the general optimization of programs to improve performance and reduce resource consumption.
  6. Added examples of math calculations which can be performed in the strategy tester. They are available under the \MQL5\Experts\Examples\Math 3D\ directory.
  7. Introduced tighter control of namespaces.
  8. Added loading of linked libraries when using .NET libraries in MQL5 programs. If the used .NET library requires other libraries for operation, the compiler will try to download required libraries automatically from \MQL5\Libraries.
  9. Fixed time operations in the MetaTrader module for Python integration. Now all output data use the time of the trading server to which the terminal is connected.

Tester

  1. A plethora of new features and improvements:


    Custom settings for financial instruments
    Now you can change settings of the main trading instrument, for which testing/optimization is performed. Almost all specification parameters can be overwritten: volumes, trading modes, margin requirements, execution mode and other settings. Thus, if you need to check an Expert Advisor under different conditions, there is no need to create a separate custom symbol and download its history. This can be done by changing standard symbol settings.



    If the symbol specification is customized, the gear icon and the symbol icon are marked with an asterisk. This shows that custom parameters are used for the current test.




    Last settings/Expert Advisors/charts
    Use the new context menu commands for fast testing or optimization setup. Choose the last used tester settings, recent charts or applications:


MetaEditor

  1. Added ability to work with C/C++ and Python projects directly from MetaEditor. Now, multi-lingual projects can be managed using the built-in editor.

    If appropriate compilers are installed on your PC, MetaEditor will detect them and add to settings. Optionally, you can specify paths to required components under the Compilers tab. From the same tab, you can download the components by clicking Install next to the appropriate field.




    After that you can work with C/C++ and Python projects similarly to MQL5 programs.

  2. Added support for sub-projects inside the Shared Projects directory intended for shared project development via MQL5 Storage. Previously, only single projects could be created at the top level.
  3. Built-in debugger updates.
  4. Fixed addition of a function header when using a code styler.
  5. 'Jump to previous/next cursor position' commands are now available not only in the View menu, but also on the toolbar.
  6. Spaces can now be used in project names.

Android

  1. Added ability to quickly switch to deposit/withdrawal pages on the broker website.

    There is no need to search for appropriate functions in a trader's room on the broker site. Fast navigation commands are available directly in terminals: users can switch to deposit and withdrawal pages from the Accounts and Trading sections:



    • Deposit/withdrawal operations are only available if appropriate functions are enabled for the trading account on the broker side.
    • The trading terminal does not perform any account deposit/withdrawal operations. The integrated functions redirect the user to the appropriate broker website pages.

  2. Positions in history are sorted now by closing date.
  3. Added marking of positions closed by Stop Loss or Take Profit with red and green vertical lines in the history section.
  4. Added new fields in the trading symbol specification:

    • Category — the property is used for additional marking of financial instruments. For example, this can be the market sector to which the symbol belongs: Agriculture, Oil & Gas and others. The category is displayed only if the appropriate information is provided by the broker.
    • Exchange — the name of the exchange in which the security is traded. The category is displayed only if the appropriate information is provided by the broker.

  5. Added Margin Call state indication in the trading section. Upon the emergence of this state, Margin, Free Margin and Margin Level parameters will be shown in red.
  6. Fixed display of the OTP section opening button in tablets.
  7. Other fixes and improvements.

iPhone/iPad

  1. Added ability to quickly switch to deposit/withdrawal pages on the broker website. For further details, please see the What's New list of MetaTrader 5 for Android.



  2. Added dark mode support for iOS/iPadOS.
  3. The one-time password section has become available in the iPad version.
  4. The positions closed by Stop Loss or Take Profit are marked with red and green vertical lines in the history section.
  5. Positions in history are sorted now by closing date. If the position has not yet been closed, its opening date is used for sorting.
  6. Other fixes and improvements.


22 October 2019
MetaTrader 5 Platform Build 2190

Terminal

  1. Fixed the display order of MQL5 programs in the Navigator.

MQL5

  1. Fixed compilation errors connected with the use of local static variables in programs having input group declarations.

VPS

  1. Fixed requesting of Hosting journals.

Tester

  1. Improved display of three-dimensional optimization charts.
  2. Fixed reception of frames during forward optimization. Now, all frames from the main and forward optimizations are available in the OnTesterDeinit function.
  3. Fixed formation of a tree of symbols in Strategy Tester settings.

Added user interface translation into Punjabi (India).

Documentation has been updated.

Fixes based on crash logs.

The update will be available through the Live Update system.

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

Terminal

  1. Completely redesigned built-in Virtual Hosting management options. All information about the rented terminal, as well as environment migration, stop and start functions, are now available in a separate tab of the Toolbox window.

    In earlier versions, Virtual Hosting functions were available in the context menu of the Navigator window. Now all the necessary information and control commands are conveniently arranged under the "VPS" tab:




    Basic subscription information appears on the left side:

    • Connection data: comparison of network delays between your terminal on the hosting server and a terminal running on a local PC.
    • Trading account for which hosting was rented and the payment plan.
    • Unique subscription identifier. A click on the ID opens the Hosting section in the MQL5.community user profile, from which the subscription can be managed.
    • Registration date and current state. If the hosting service is stopped, an appropriate status will instantly appear here.

    Using the Start/Stop button, the virtual terminal can be quickly started or stopped.

    Data about hosting server hardware and CPU consumption charts are displayed in the right hand side window section. Based on the displayed information, you will be able to respond in a timely manner if your Expert Advisor or indicator utilizes excessive memory or CPU time.

    Information about the last trading environment migration as well as migration commands are also available here. These commands enable fast environment migration after purchasing a subscription.

    A virtual platform can be rented from the "VPS" tab. The renting process has not changed and it is still fast and easy. You only need to select a plan and a suitable payment method. The best server for connecting to your broker will be selected automatically.




  2. Added ability to quickly switch to deposit/withdrawal operations on the broker website.

    There is no need to search for appropriate functions in a trader's room on the broker site. Fast navigation commands are available directly in terminals: in the accounts menu in Navigator and in Toolbox > Trade tab:



    • Deposit/withdrawal operations are only available if appropriate functions are enabled for the trading account on the broker side.
    • The trading terminal does not perform any account deposit/withdrawal operations. The integrated functions redirect the user to the appropriate broker website pages.
  3. New fields in the trading symbol specification:

    Category
    The property is used for additional marking of financial instruments. For example, this can be the market sector to which the symbol belongs: Agriculture, Oil & Gas and others. The category is displayed only if the appropriate information is provided by the broker.

    Exchange
    The name of the exchange in which the security is traded. The category is displayed only if the appropriate information is provided by the broker.

    Commissions
    Information on commissions charged by a broker for the symbol deals. Calculation details are displayed here:

    • Commission may be single-level and multilevel, i.e. be equal regardless of the deal volume/turnover or can depend on the size. Appropriate data is displayed in the terminal.
    • Commission can be charged immediately upon deal execution or at the end of a trading day/month.
    • Commission can be charged depending on deal direction: entry, exit or both operation types.
    • Commission can be charged per lot or deal.
    • Commission can be calculated in money, percentage or points.

    For example, the following entry means that a commission is charged immediately upon deal entry and exit. If the deal volume is between 0 to 10 lots, a commission of 1.2 USD is charged per operation. If the deal volume is between 11 to 20 lots, a commission of 1.1 USD is charged per each lot of the deal.
    Commission | Instant, volume, entry/exit deals
    0  - 10  | 1.2 USD per deal
    11 - 20  | 1.1 USD per lot



  4. Additional options related fields have been added to symbol specification:

    • Option type — call or put
    • Underlying — the underlying symbol of the option
    • Strike price — option strike price

  5. Added support for the delivery of options "Greeks": delta, gamma, vega, theta, rho. Brokers can provide additional information related to such instruments. The data is displayed under the Details section of the Market Watch window and it can be used for advanced trade analysis:




  6. The Crosshair tool now shows the distance between price levels in percentage, in addition to previously available pips:




  7. Added the display of a resulting price in trading dialogs during Market and Exchange execution operations, if this price is available at the time a response is received from the broker:




  8. Fixed occasional error due to which the "Show All" command in the Market Watch window could fail to show the list of all available trading instruments.

MQL5

  1. The scope operation has been revised and thus MQL5 is even closer to C++. This provides MQL5 programmers with wider possibilities in operations with third-party libraries. The update eliminates the need to modify libraries and to unify identifiers.

    Example: Code contains declaration of two structures with the same name even though they belong to different classes. In earlier versions such a declaration produced a compilation error: "identifier already used". Now this code will be successfully compiled and executed. For a proper access to the desired variable/structure/function from outside of its scope, you should specify a class (in this case it is CBar::Item).
    class CFoo
      {
    public:
       struct Item { int x; };
      };
    //+------------------------------------------------------------------+
    class CBar
      {
    public:
       struct Item { int x; };
      };
      
    CBar::Item item;  // proper declaration of the Item structure from the Bar class
    Item       item;  // incorrect declaration
    Added namespace support which provides more possibilities when using third-party code/libraries in MQL5 applications.

    #define PrintFunctionName() Print(__FUNCTION__)
    
    namespace NS
    {
    void func()
      {
       PrintFunctionName();
      }
    
    struct C
      {
       int               x;
                         C() { PrintFunctionName(); };
      };
    }
    
    struct C
      {
       int               x;
                         C() { PrintFunctionName(); };
      };
    
    //+------------------------------------------------------------------+
    //|                                                                  |
    //+------------------------------------------------------------------+
    void func()
      {
       PrintFunctionName();
      }
    //+------------------------------------------------------------------+
    //| Script program start function                                    |
    //+------------------------------------------------------------------+
    void OnStart()
      {
       func();
       NS::func();
    
       C c;
       NS::C ac;
      }
    Upon execution the following result is displayed as output:
    2019.09.18 13:39:35.947    TestScript (AUDCAD,H1)    func
    2019.09.18 13:39:35.949    TestScript (AUDCAD,H1)    NS::func
    2019.09.18 13:39:35.949    TestScript (AUDCAD,H1)    C::C
    2019.09.18 13:39:35.949    TestScript (AUDCAD,H1)    NS::C::C

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

  3. Added support for the "=delete" attribute. It allows prohibition on the use of certain class methods.
    class A
      {
       void              operator=(const A &)=delete;    // prohibit object copying operator
      };
    
    class B : public A
      {
      };
    
    //+------------------------------------------------------------------+
    //| Script program start function                                    |
    //+------------------------------------------------------------------+
    void OnStart()
      {
       A a1,a2;
       B b1,b2; 
      
       a1=a2;
       b1=b2;
      }
    In this example, the compiler will return errors for "a1=a2" and "b1=b2":
    attempting to reference deleted function 'void A::operator=(const A&)'
       function 'void A::operator=(const A&)' was explicitly deleted here

    attempting to reference deleted function 'void B::operator=(const B&)'
       function 'void B::operator=(const B&)' was implicitly deleted because it invokes deleted function 'void A::operator=(const A&)'

  4. The following values have been added to the ENUM_SYMBOL_INFO_STRING enumeration:

    • SYMBOL_CATEGORY — symbol category. It is used for additional marking of financial instruments. For example, this can be the market sector to which the symbol belongs: Agriculture, Oil & Gas and others.
    • SYMBOL_EXCHANGE — the name of the exchange in which the symbol is traded.

  5. Added support for position closure by FIFO rule.

    • ACCOUNT_FIFO_CLOSE value has been added to ENUM_ACCOUNT_INFO_INTEGER. It indicates that positions can be closed only by the FIFO rule. If the property value is true, then positions for each instrument can only be closed in the same order in which they were opened: the oldest one should be closed first, then the next one, etc. In case of an attempt to close positions in a different order, an error will be returned. The property value is always 'false' for accounts without hedging position management (ACCOUNT_MARGIN_MODE!=ACCOUNT_MARGIN_MODE_RETAIL_HEDGING).
    • New return code: MT_RET_REQUEST_CLOSE_ONLY — the request is rejected, because the rule "Only closing of existing positions by FIFO rule is allowed" is set for the symbol

    There are three main methods to close a position:

    • Closing from the client terminal: the trader closes the position manually, using a trading robot, based on the Signals service subscription, etc. In case of an attempt to close a position, which does not meet the FIFO rule, the trader will receive an appropriate error.
    • Closing upon Stop Loss or Take Profit activation: these orders are processed on the server side, so the position closure is not requested on the trader (terminal) side, but is initiated by the server. If Stop Loss or Take Profit triggers for a position, and this position does not comply with the FIFO rule (there is an older position for the same symbol), the position will not be closed.
    • Closing upon Stop Out triggering: such operations are also processed on the server side. In a normal mode, in which FIFO-based closing is disabled, in case of Stop Out positions are closed starting with the one having the largest loss. If this option is enabled, the open time will be additionally checked for losing positions. The server determines losing positions for each symbol, finds the oldest position for each symbol, and then closes the one which has the greatest loss among the found positions.

  6. Added options for parameter grouping via "input group". This enables visual separation of parameters based on their underlying logic.

    In the below Expert Advisor code,input parameters are grouped according to their purpose:
    input group           "Signal"
    input int             ExtBBPeriod    =20;         // Bollinger Bands period
    input double          ExtBBDeviation =2.0;        // deviation
    input ENUM_TIMEFRAMES ExtSignalTF    =PERIOD_M15; // BB timeframe
    
    input group           "Trend"
    input int             ExtMAPeriod    =13;         // Moving Average period
    input ENUM_TIMEFRAMES ExtTrendTF     =PERIOD_M15; // MA timeframe
    
    input group           "ExitRules"
    input bool            ExtUseSL       =true;       // use StopLoss
    input int             Ext_SL_Points  =50;         // StopLoss in points
    input bool            ExtUseTP       =false;      // use TakeProfit
    input int             Ext_TP_Points  =100;        // TakeProfit in points
    input bool            ExtUseTS       =true;       // use Trailing Stop
    input int             Ext_TS_Points  =30;         // Trailing Stop in points
    
    input group           "MoneyManagement"
    sinput double         ExtInitialLot  =0.1;        // initial lot value
    input bool            ExtUseAutoLot  =true;       // automatic lot calculation
    
    input group           "Auxiliary"
    sinput int            ExtMagicNumber =123456;     // EA Magic Number
    sinput bool           ExtDebugMessage=true;       // print debug messages
    When such an Expert Advisor is launched in the Strategy Tester, input parameter blocks can be collapsed or expanded by a double click on the group name, as well as all parameters within a group can be selected for optimization with a single check box.




  7. Fixed import of DLL functions with names matching MQL5 function names. Example:
    #import "lib.dll"
    int func();
    #import
    //+------------------------------------------------------------------+
    //|                                                                  |
    //+------------------------------------------------------------------+
    int func()
      {
       return(0);
      }
    //+------------------------------------------------------------------+
    //| Script program start function                                    |
    //+------------------------------------------------------------------+
    void OnStart()
      {
       Print( func() );
      }
    In earlier versions, the following error returned during compilation:
    'func' - ambiguous call to overloaded function with the same parameters
    could be one of 2 function(s)
       int func()
       int func()
    Now, instead of the error, the built-in MQL5 function with a higher priority will be used by default. The imported function can be called by explicitly specifying the scope:
    void OnStart()
      {
       Print( lib::func() );
      }
  8. Fixed specification of time in economic calendar news. Now events are delivered by taking into account the time zone of the trade server to which the terminal is connected, instead of the local computer time zone.
  9. Fixed excessive memory consumption in the Copyticks and CopyTicksRange functions.

Signals

  1. Fixed display of signal charts when working in Wine (Mac OS and Linux).

Tester

  1. Big Strategy Tester update. New start page, redesigned settings page, improved usability.

    Start page
    Now, after tester launch, instead of multiple settings the user sees a list of standard tasks, by selecting which they can quickly start testing. The new design is primarily intended for unexperienced users.

    We have selected the most frequent strategy testing and optimization tasks and we have added them in the start page. In addition, one of the previously performed tasks can be restarted from the start page. If you have run a lot of tasks and they do not fit into the start page, use the search bar. You can find a test by any parameter: program name, symbol, timeframe, modeling mode, etc.




    Hiding irrelevant parameters
    After selecting a task, the user proceeds to further testing parameters: selection of an Expert Advisor, symbol, testing period, etc. All irrelevant parameters which are not required for the selected tasks are hidden from the setup page. For example, if mathematical calculations are selected, only two parameters should be specified: selection of a program to be tested and the optimization mode. Testing period, delay and tick generation settings will be hidden.




    Convenient testing setup
    For convenience some of the parameters on the setup page have been rearranged. Extended explanations have been added for the delay and visualization parameters. In addition, testing settings can now be saved and uploaded manually, and thus a trader can quickly return to previous settings.




    Using the same tab you can quickly open the program for editing in MetaEditor.

    Profit calculation in pips
    Using the settings, you can enable profit calculation in pips. This mode accelerates testing while there is no need to recalculate profit to deposit currency using conversion rates (and thus there is no need to download the appropriate price history). Swap and commission calculations are eliminated in this mode.




    Please note that when calculating profit in pips, the deal volume does not matter. Only the number of won/lost pips is calculated for each deal. Also margin control is not performed in this mode. Use it only for quick and rough strategy estimation and then check the obtained results using more accurate modes.

    General improvements
    Testing start/stop button and progress bar have been moved to the tabs bar. Thus, the user can control the process from any Strategy Tester section. Testing start/stop commands have also been added to context menus of settings and inputs sections.




  2. The optimization chart can now be displayed in the main working area of the terminal, instead of displaying in a separate strategy tester section. This way, much more space becomes available for data analysis. The 3D visualization system has also been updated.

  3. Added saving of optimization cache for the "All symbols in Market Watch" mode.
  4. Added saving of test cache.

    In earlier versions, executed task results were saved to files only when optimizing Expert Advisors. Now, cache files are also saved during single tests, using which users can return to previous calculations and view statistics, balance, equity and deposit loading graphs, at any time. In future releases, this option will enable comparison of testing results.

    To load previous test results, use the new Tester start page: click "Previous results" and select the desired site:




  5. Significantly accelerated testing and optimization, including operations performed using the MQL5 Cloud Network.
  6. Fixes and optimized operations with frames.

MetaEditor

  1. Added ability to configure code styler.

    The MetaEditor includes a built-in code styler, which enables automatic formatting of program text in accordance with the adopted standard. Now in addition to common style, you can use other popular standards. To do this, open MetaEditor settings and select the desired style:




    The following parameters can be additionally set for the styler:

    Spaces per indent
    Sets the number of spaces used in aligning of nested constructions:
    if(condition)
      {
       //---
      }

    Replace tabs with spaces
    If this option is enabled, the styler will replace all tabs in the code with spaces. The number of characters per tab is set in the General section.

    Delete empty lines
    When this option is enabled, the styler will delete all lines having only a line break character.

    Insert spaces after commas and semicolons
    When this option is enabled, the styler will visually separate constructions with element enumerations. Example:
    // before styling
    ParameterGetRange("InpX",enable,x_cur,x_start,x_step,x_stop);
    // after styling
    ParameterGetRange("InpX", enable, x_cur, x_start, x_step, x_stop);

    Insert spaces around declaration operators
    When this option is enabled, the styler will insert spaces around the assignment, equality, comparison, and other operators. Example:
    // before styling
    if(x==1&y!=2)
      {
       int a=0;
      }
    // after styling
    if(x == 1 & y != 2)
     {
      int a = 0;
     }

  2. "Show in Navigator" command has been added to the file bookmarks context menu. Thus, the user can easily find a file opened for editing among the editor's folder structure.




  3. Fixed display of the 'union' keyword in tooltips.

The user interface has been additionally translated into 18 new languages:

  • European Region — Swedish, Lithuanian, Danish, Latvian, Estonian, Serbian, Slovenian, Slovak, Finnish, Georgian
  • Asian region — Javanese, Marathi, Bengali, Punjabi, Tamil, Telugu
  • African Region — Swahili, Hausa

The platform interface is now available in 50 languages, which are spoken by more than 4 billion people.

To set you language for the interface, navigate to the "View / Language" menu at the top of the terminal.

Documentation has been updated.

Fixes based on crash logs.

The update will be available through the Live Update system.

12 June 2019
MetaTrader 5 platform build 2085: Integration with Python and Strategy Tester improvements

Terminal

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

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

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



    Connection

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

    Functions

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


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




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




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




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

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




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

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

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





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




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

  7. Strategy Tester improvements and optimization.

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

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

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

    Task distribution in math calculation mode has become much faster.

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

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

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

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

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




    Select your platform and download the Tradays apps:


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

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

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

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

  10. Fixed data update in the Data Window when using a crosshair on a detached chart.
  11. Fixed tick history saving. In earlier versions, multiple ticks within a millisecond could be saved in the wrong order.
  12. Fixed generation of charts based on a too short price history (less than a day) available on the server.

MQL5

  1. Added MQL5 service debugging option. These applications can now be tested similar to Expert Advisors and indicators.
  2. New profit and margin calculation modes have been added in the ENUM_SYMBOL_CALC_MODE enumeration:

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

  3. The new TesterDeposit function enables the emulation of deposit operations during testing. The function can be useful when testing money management strategies.
    bool  TesterDeposit(
       double money      // the deposit amount
       );
  4. During the OnDeinit method execution, the MQL5 application does not receive any events from the terminal. Previously, applications occasionally failed to complete de-initialization (for example, to delete all created objects) due to the receiving of other events.
  5. Fixed occasional errors which could occur after a change in the custom symbol tick history for the current day.
  6. Fixed occasional application slowdown when using a large number (tens of thousands) of graphical objects.
  7. Fixed terminal freezing in the case of frequent trading history calls from MQL5 programs.
  8. Fixed iBarShift function operation. With the "exact=false" flag and request outside the data, the function returned the oldest bar number instead of the newest one.

Tester

  1. Fixed determination of the cores number on computers with processors having several NUMA nodes.
  2. Added possibility to run testing and optimization with the zero initial deposit, since deposit operations can be emulated during testing using the new TesterDeposit function.

MetaEditor

  1. The code styler command can now be added to the toolbar for quick access.
  2. Fixed switching to parameter definition and viewing of related data when using non-Unicode characters in function and variable names.

Documentation has been updated.

The update is available through the LiveUpdate system.

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.
  • 123456789101112131415