MetaTrader 5 build 2815: Access to the Depth of Market from Python, revamped Debugger, and Profiler improvements

What's new in MetaTrader 5

26 February 2021


  1. Added ability to access Depth of Market data via the Python API.
    Three new functions allow quick obtaining of data for statistical calculations and machine learning tasks, which can be implemented using a plethora of out-of-the-box Python libraries.
    • market_book_add — subscribes the MetaTrader 5 terminal to receive events related to changes in the Depth of Market for the specified symbol.
    • market_book_get — returns a tuple from BookInfo containing the Depth of Market records for the specified symbol.
    • market_book_release — cancels MetaTrader 5 terminal subscription to events related to changes in the Depth of Market for the specified symbol.

  2. The maximum length of Push messages has been increased from 256 to 1024 characters. Now, you can send more information from your MQL5 programs on mobile devices.
  3. Added a preliminary version of the Task Manager, which can be called by pressing the F2 key.
    The Task Manager enables monitoring of resources consumed by the platform. You can view the amount of memory consumed by charts, CPU resources used by Expert Advisors and other performance metrics. If your platform performance slows down, you can easily detect and fix the problem.

  4. Enhanced Subscriptions service. A special indication has been added for symbols having delayed quotes:
    • Symbols in Market Watch are marked with a clock icon, and the delay value is displayed in the tooltip
    • Data delay notification is displayed on charts

  5. Fixed display of the Subscriptions list when there is no trading account connection.
  6. Fixed links in emails and newsletters. All links now open in the default browser. Previously, links opened only in Internet Explorer.
  7. Fixed connections from the WebRequest function to hosts with IPv6 addresses and Cloudflare protection.
  8. Improved functionality and responsiveness of the VPS service.
  9. Improved operation under Wine and MacOS/Crossover, including the version for macOS Big Sur with the M1 processor.


  1. Fixed error in the ArrayPrint function. The function could occasionally fail to print arrays.
  2. Optimized file operations performed by File* functions. Now, file reading and writing operations run much faster.
  3. Removed the restriction requiring the specification of size for the second, third and fourth dimensions of a dynamic array, when the array is used as a function parameter. This increases code reuse and flexibility.
    void func(int &arr[ ][ ][ ][ ])
  4.  Fixed ArrayBsearch function operation. The function could return an incorrect index of the found element during a binary search.


  1. More new features have become available in the revamped debugger.
    • Arrays are now displayed in the observation window in accordance with the sorting set by ArraySetAsSeries.
    • Added support for local static variables.
    • Fixed display of the specified array element value.
    • Fixed handling of 'static' class fields.
    • Other improvements for more accurate and reliable debugging.

  2. Added option "Enable optimizations in profiling".
    Code optimization mode can be disabled in order to include more details in the profiling report. Code speed without optimization can be several times slower, but this mode provides a wider code coverage. Please note that with optimization code bottlenecks can be imprecise.
    A milder profiling mode can be set by disabling the "Enable inlining in profiling".

    The optimization management option has also been added to project settings.
    • If optimization is disabled in the project, then the new option is ignored, and thus optimization will always be disabled for profiling (including inlining operations).
    • If optimization is enabled in the project, then the new option will be taken into account during profiling compilation.

  3. Added logging for debugging and profiling processes. Environment settings are logged at operation start; collected data statistics is logged at operation stop.
    MQL5 profiler    starting 'ExpertMACD.ex5' on history with parameters:
    MQL5 profiler       symbol: 'EURUSD'
    MQL5 profiler       period: 'H1'
    MQL5 profiler       date from: '2021.01.01'
    MQL5 profiler       date to: '2021.02.22'
    MQL5 profiler       ticks mode: 'every tick'
    MQL5 profiler       execution delay: 0 ms
    MQL5 profiler       deposit: 10000
    MQL5 profiler       currency: 'USD'
    MQL5 profiler       leverage: 1:100
    MQL5 profiler       profit in pips: NO
    MQL5 profiler    profile data received (4640 bytes)
    MQL5 profiler    758 total measurements, 0/0 errors, 470 kb of stack memory analyzed
    MQL5 profiler    7782 total function frames found (1929 mql5 code, 342 built-in, 1403 other, 4108 system)


  1. Fixed specification of non-trading hours in advanced testing settings.

Updated documentation.