MetaTrader 5 build 2650: Background chart loading and MQL5 code profiler improvements

What's new in MetaTrader 5

9 October 2020

Terminal

  1. The Options tab features a new setting entitled "Preload chart data for open positions and orders".

    In order to save traffic, the trading platform downloads symbol price history only when the relevant data is requested, for example when the price chart is opened or when testing is launched. However, this may not always be convenient for actively used symbols. If you enable the new option, the charts of the symbols for which you have open positions or pending orders, will be updated in the background mode whenever you launch the platform. Thus, you will not have to wait for data download after chart opening, and the relevant data will be immediately available for analysis.




  2. Fixed generation of daily bars after weekends.
  3. Fixed chart updating. Charts could occasionally fail to update after the additional download of updated price data.
  4. Optimized updating of the account trading history cache. The optimization enables the reduction of data delays when using History* functions.
  5. Fixed display of the Comment column when displaying trading history as positions.
  6. Fixed display of the Signal subscription renewal button.

MQL5

  1. More improvements within the total update of the code profiler. The following functions have been implemented in addition to the innovations presented in build 2615:

    Added new parameters
    We have previously announced the usage of the Sampling method for the new profiler. The profiler makes pauses in the MQL program operation (~1000 times per second) and collects statistics on how many pauses were performed in certain code segments. This also includes the analysis of call stacks to determine the share of each function in the total code operation time. After profiling, users receive statistics on how many times the operation was paused and how many times each of the functions appeared in the call stack:

    • Total CPU [unit,%] — how many times the function appeared in the call stack.
    • Self CPU [unit,%] — the number of "pauses" which occurred directly within the specified function. This variable is crucial in identifying bottlenecks: according to statistics, pauses occur more often where more processor time is required.


    Added ability to disable function inlining during profiling
    During the compilation of MQL programs, functions are inlined, i.e. the function code is added directly to the function call site. This enables significant performance acceleration. However, this procedure makes the profiling of functions difficult. On order to obtain a report on "pure" functions, you can disable inlining in the MetaEditor settings:




    Updated report design
    We have redesigned the profiling report and the presentation of profiling information in the source code window. The modernized design will be more familiar to Visual Studio users.




  2. Fixed CopyTicksRange function operation. The function could sometimes return incomplete data.
  3. New error code TRADE_RETCODE_HEDGE_PROHIBITED — opening of a position or placing of a pending order is not allowed because hedge positions are prohibited. The error is returned if a user tries to execute a trading operation in the case the hedging is disabled for the account and the user already has an opposite order or position for the same symbol.
  4. Removed the ability to call MessageBox when debugging indicators. MessageBox cannot be called from indicators because it suspends the thread execution for the whole time while waiting for the user's response.
  5. Optimized and significantly accelerated addition of trading instruments to the Market Watch using the SymbolSelect function.
  6. Fixed ArrayInsert function behavior for fixed-sized arrays. Now, the behavior corresponds to its description in the documentation: when elements are inserted, the size of the destination array does not change and the elements to the right of the insert position are shifted to the right (the last 'count' elements are "dropped off"), while the elements are copied from the source to the released space.

Tester

  1. Fixed working with custom trading condition settings during testing; the settings dialog has been revised.

    • Fixed calculation of custom commissions. To enable commissions, it is now enough to specify the symbol name rather than the entire path.
    • Rearranged tabs for more efficient operation.
    • Renamed the dialog and the option enabling custom settings.
    • Optimized column width in the settings tables.
    • When the "Use custom settings" option is disabled, all other settings in the dialog are deactivated. Previously, the settings remained editable, and users might mistakenly think the settings would be applied during testing.




  2. Fixed an occasional error related to the receiving of orders from the trade history by ticket.

MetaEditor

  1. Added color scheme presets for the code editing window: light (default), dark and blue. You can customize the editor without having to configure the editor view manually.

    Additionally, it is now possible to customize the border color for the function tooltips.



     
  2. MetaEditor: All icons in the toolbars have been updated to support HiDPI monitors.

Documentation has been updated.