MetaTrader 5 build 3800: Book or Cancel orders, AI coding assistant, and enhanced ONNX support

What's new in MetaTrader 5

8 June 2023


  1. Added support for the new order filling policy — Passive / Book or Cancel (BOC).

    New order filling policy — Passive / Book or Cancel

    The BOC policy indicates that an order can only be placed in the Depth of Market (order book). If the order can be filled immediately when placed, this order is canceled. This policy guarantees that the price of the placed order will be worse than the current market price. BOC is used to implement passive trading: it is guaranteed that the order cannot be executed immediately when placed and thus it does not affect current liquidity. This filling policy is only supported for limit and stop limit orders in the Exchange Execution mode.

    The availability of the new filling policy depends on the broker.

  2. The platform switches to using Microsoft Edge WebView2 for displaying the HTML content.

    Compared to the outdated MSHTML, the new component significantly expands content displaying capabilities by providing access to modern technologies. The use of WebView2 improves the appearance of some platform sections, increases performance, and creates a more responsive interface. In particular, the new component will affect the Market, Signals and VPS sections.
    Full support for WebView2 was introduced in Windows 10. We strongly recommend that all users upgrade to the latest operating system version and install all available updates. The platform will continue to use MSHTML under Windows 7 and Wine, but the new features will not be available. The minimum recommended operating system version is Windows 10 21H2 (build 19044, November 2021).

  3. Improved Market security system. Now, in order to run the product, the user must be authorized in the platform with the same MQL5 account via which the product was purchased. The account must be specified under the Tools \ Options \ Community section:

    Specify your MQL5 account in the platform settings

    If no account or an invalid account is specified, the product will not start, and the following message will be printed in the platform journal:
    'ProductName' requires active MQL5 account in Tools->Options->Community
  4. Added Overview command to the history section context menu. The command opens a trading report for the account:

    Command to go to the trading report

  5. Fixed display errors in the two-factor authentication dialog. If the terminal had several accounts with the same number but opened with different brokers, the account connection form could fail to display the one-time password field.
  6. Implemented faster rendering of indicators with the DRAW_COLOR_CANDLES display style.
  7. Fixed trading report creation errors. On-chart profit and equity values could be displayed incorrectly under certain conditions.
  8. Added display of Costs in the trading report. The value shows the total costs incurred when performing deals relative to the symbol's current mid-point price (mid-point spread cost). This is the amount which the trader lost due to the spread. The availability of this value depends on the broker.
  9. Updated UI translations.
  10. Improved stability under Wine, especially on macOS systems. We recommend completely removing old terminals and re-installing them:

  11. Accelerated package installation and updates downloading procedures. Improved analysis of AVX availability on the user's computer when selecting a distribution package.
  12. Enabled support for TLS 1.3 in web protocols. TLS 1.0 is considered deprecated and insecure and has therefore been disabled.
  13. Fixed accounting for agent commissions in trading history reports. The relevant transactions could be ignored when calculating the final profit.
  14. Fixed the inability to change the server in the account connection dialog. The issue arose when there were several accounts in the terminal with the same number from different brokers.
From this build onwards, the installers will work only with 64-bit platform versions. Support for 32-bit versions will be discontinued. Previously installed 32-bit platform versions will work until January 1, 2024.


  1. Added new STAT_COMPLEX_CRITERION value in the ENUM_STATISTICS enumeration. Use the property to obtain the calculated complex criterion value, as a result of optimization.
  2. Improved RegressionMetric method used for calculating the regression metric based on the passed matrix or vector. Added vector_true and matrix_true parameters for passing true values which evaluate the predicted data quality.
    double vector::RegressionMetric(
       const vector& vector_true,            // true values
       const ENUM_REGRESSION_METRIC  metric  // metric
    double matrix::RegressionMetric(
       const matrix& matrix_true,            // true values
       const ENUM_REGRESSION_METRIC metric   // metric
    vector matrix::RegressionMetric(
       const matrix& matrix_true,            // true values
       const ENUM_REGRESSION_METRIC metric,  // metric
       const int                      axis   // axis
  3. Added the LinearRegression method. It returns a vector/matrix with calculated linear regression values for the passed vector/matrix.
    vector vector::LinearRegression();
    matrix matrix::LinearRegression(
       ENUM_MATRIX_AXIS axis=AXIS_NONE       // axis along which regression is calculated 
    vector vector_a;
    //--- fill the vector with prices
    //--- get a linear regression
    vector vector_r=vector_a.LinearRegression();
    The results are visualized in the graph:

    Visualizing the result returned by the LinearRegression method

  4. Added the HasNan method, which returns the number of NaN values in a matrix/vector.
    ulong vector::HasNan();
    ulong matrix::HasNan();
    When comparing the appropriate pair of elements having NaN values, the Compare and CompareByDigits methods consider these elements equal, while in case of a usual comparison of floating-point numbers NaN != NaN.

  5. Modified the OnnxTypeInfo structure which is used for operations with ONNX (Open Neural Network Exchange) models:

    struct OnnxTypeInfo
       ENUM_ONNX_TYPE       type;            // parameter type
       OnnxTensorTypeInfo   tensor;          // tensor description
       OnnxMapTypeInfo      map;             // map description
       OnnxSequenceTypeInfo sequence;        // sequence description

    The data type is specified in the structure using new substructures:

    • OnnxTensorTypeInfo — tensor
    • OnnxMapTypeInfo — map
    • OnnxSequenceTypeInfo — sequence

    struct OnnxTensorTypeInfo
       ENUM_ONNX_DATATYPE   data_type;       // data type in the tensor
       long                 dimensions[];    // number of elements
    struct OnnxMapTypeInfo
       ENUM_ONNX_DATA_TYPE  key_type;        // key type
       OnnxTypeInfo         type_info;       // value type
    struct OnnxSequenceTypeInfo
       OnnxTypeInfo         type_info;       // data type in the sequence
    Depending on OnnxTypeInfo::type (ONNX_TYPE_TENSOR, ONNX_TYPE_MAP or ONNX_TYPE_SEQUENCE), the relevant substructure is filled.

  6. Improved support for ONNX models.
  7. Added CopyIndicatorBuffer methods which enable the obtaining of indicator buffer data into a vector.
    bool vector<T>::CopyIndicatorBuffer(long indicator_handle,ulong buffer_index,ulong start_pos,ulong count);
    bool vector<T>::CopyIndicatorBuffer(long indicator_handle,ulong buffer_index,datetime start_time,ulong count);
    bool vector<T>::CopyIndicatorBuffer(long indicator_handle,ulong buffer_index,datetime start_time,datetime stop_time);
  8. Fixed operations with arrays having two or more dimensions in the FrameAdd and FrameNext methods.
  9. Fixed CRedBlackTree::Remove Standard Library method.
  10. Implemented fixes in the Fuzzy Logic library.


  1. Added integration with the advanced automatic coding assistant Copilot. Its operation is based on OpenAI models. Enter a comment or part of a function and send a prompt. The neural network will analyze the prompt and will offer coding options to implement the idea.

    Copilot coding assistant

    Depending on the file type, the string "MQL5 language", "Python language" or "C++ language" is automatically inserted at each prompt beginning. Thus, the neural network will provide the result in the required language.

    Copilot is currently free and is already enabled in the editor. There are several options available under Tools \ Options \ Copilot:

    Copilot settings

    Payment settings:

    • Use your MQL5 account: this option is currently available for free. Later, you will be able to pay for the subscription directly from your MQL5 account balance.
    • Use an OpenAI key, if you have purchased a subscription and have the relevant key.

    Prompt settings:

    • Model — a neural network which will process your requests. text-davinci-003 and gpt-3.5-turbo are currently available. Support for gpt-4 will be added soon.
    • Maximum tokens — the number of text units which the model can return in response to a prompt.
    • Variability — affects how strictly the neural network will follow the prompt. The bigger the value, the greater the result randomness. This option corresponds to the temperature parameter in OpenAI models.

  2. Added ability to view the properties of ONNX models.

    You can view the contents of the *.onnx file directly in the editor. As an example, find the project ONNX.Price.Prediction under Toolbox \ Public Projects and select Join in the context menu. The project will be downloaded to your computer and will appear in the Navigator.

    Open ONNX models directly in MetaEditor

  3. Added ability to visualize machine learning models and neural networks using Netron. This viewer supports popular models, including ONNX, TensorFlow Lite, Caffe, Keras and ncnn, among others.

    To view a model, select its file in the Navigator and click "Open in Netron". If this utility is not installed, its GitHub page will open, from which you can download the relevant installer, according to your operating system. For example, use Netron-Setup-X.X.X.exe for Windows. If the program is installed, the model will immediately open for viewing from the Navigator.

    Visualize machine learning models with Netron

    Supported formats:

    • armnn, caffemodel, circle, ckpt, cmf, dlc, dnn, h5, har, hd5, hdf5, hn, keras, kmodel,
    • lite, mar, meta, mge, mlmodel, mlnet, mlpackage, mnn, model, nb, ngf, nn, nnp,
    • om, onnx, ort, paddle, param, pb, pbtxt, pdiparams, pdmodel, pdopt, pdparams, prototxt, pt, pth, ptl,
    • rknn, t7, tfl, tflite, tmfile, tm, tnnproto, torchscript, uff, xmodel

  4. Updated UI translations.


  1. Fixed calculation of the "Average losing trade" metric in the testing report. Previously, the calculation could erroneously include entry deals if commissions were charged for such deals.
  2. Improved custom commission options in the strategy tester. To set a symbol, specify its name rather than the entire path.
  3. Updated icons in the strategy tester. New metaphors will make them easier to understand.

Fixed errors reported in crash logs.

Web Terminal

  1. Improved trading history section:

    • Added display of balance operations in the trading history, such as deposits and withdrawals, commissions, and adjustments.
    • Added display of totals in the trading history: balance, profit, commission, deposits, withdrawals and number of orders, among others.
    • Added ability to sort operations and filter the history by depth in the mobile version.

    Updated trading history section

  2. Enhanced symbol contract specifications. The following information has been added: volume limit, tick size and value, initial and hedged margin.
  3. Improved color schemes:

    • Pending orders are displayed in gray on the chart. The position color depends on the direction: red for Sell and blue for Buy. The new colors provide easier navigation especially if a lot of operations are displayed on the chart.
    • When viewing/editing a position, only this position and its levels are highlighted, while all other positions and orders become gray, and their levels are hidden from the price scale. Thus, it will be easier to manage separate operations.
    • The Stop Loss color has been changed from red to orange to avoid confusion with Sell positions.
    • Improved on-chart icons indicating position closing time. A green icon is used for positions closed by Take Profit and a red one is used for those closed by Stop Loss.

  4. Added interface translations into Arabic, Bulgarian, Vietnamese, Greek, Indonesian, Malay, Dutch, Persian, Polish, Thai, Ukrainian and Hindi. The web terminal is now available in 24 languages.
  5. Fixed Turkish UI translations.
  6. Fixed modification and deletion of pending orders in the Web Terminal mobile version.
  7. Fixed on-chart 'closed market' tooltip.
  8. Fixed display of profits in the position close button in the trading dialog. The error occurred during partial closing.
  9. Fixed display of on-chart trading notifications.
  10. Fixed volume modification using arrows in the Depth of Market.
  11. Fixed error which could cause the settings of running indicators to be reset under certain conditions.
  12. Fixed username checks when opening new accounts. Previously, an apostrophe in the name was considered an error.
  13. Fixed processing of requotes. The dialog with the requoted prices might not be displayed under certain conditions.
  14. Fixed display of the Ichimoku Kinko Hyo indicator. The Chikou-Span, Up Kumo and Down Kumo lines will be displayed with the correct offset.
  15. Fixed initial margin checks when opening new orders. The error occurred in the hedging position accounting system.
  16. Fixed scrolling in the contract specification window.

  1. The MQL5 Cloud Network website has been completely redesigned:

    Learn how to use the processing power of thousands of computers around the world to optimize your trading strategies. With the MQL5 Cloud Network, even the heaviest computations can be completed in a matter of minutes. Visit the website and find out how to participate in the network and how to earn money by providing your computer resources.

    Visit the updated MQL5 Cloud Network website

  2. Improved screenshot section in Market products. Authors can upload images up to 1920*1800 pixels to demonstrate how applications work. The screenshot gallery has also been updated. The carousel shows image thumbnails, and a click on them opens full-sized images.

    Improved screenshot section in the Market

  3. Freelance section improvements. Users will now receive more tips when placing their first orders:

    • Requirements specification examples and a reminder to add one
    • Order creation instructions
    • Template usage tips

    These tips can assist you in creating the order and in receiving the desired result.

    Freelance improvements