MetaTrader 5新功能

桌面版，移动版和网页平台的更新历史

Trading Terminal

Added the ability to post screenshots of charts on
MQL5.com. When saving a screenshot, just select the appropriate option
and the screenshot will be automatically placed on www.mql5.com, while a
trader will get its address for posting on other websites and forums.

Improved the algorithm of a trend line inclination angle calculation.

Fixed display of available bars number in a chart tooltip.

Fixed display of news with the same publication time.

Added support for canceled deals display.

Fixed display of close button when closing a deal with a volume less than the minimum allowed one.

Fixed spread and tick volume calculation in charts generated by the terminal.

MQL5

Added OnTradeTransaction entry point - getting information about trade transactions performed for a trade account.

The entry point is called to transfer the data on the trade transactions performed for a trade account to MQL5 program:

adding, modifying, deleting open orders

adding, modifying, deleting orders in history

adding, modifying, deleting deals

modifying a position

execution of client's trade requests and getting the results.

The client terminal stores the history of transactions and
consistently transfers them to an Expert Advisor, if an entry point is
present. The history is limited to 1024 transactions and cleared during
the next connection.

Note that transactions processing in the
terminal is performed independent of transactions processing in MQL5
program. For example, while an Expert Advisor processes a transaction to
add a new order, the terminal can at the same time get a transaction to
delete the appropriate order and move it to history.

Fixed making long screenshots of charts by MQL5 means (ChartScreenShot function).

Fixed getting an empty last bar for the symbols built by Last prices.

Added checking the presence of available history when
executing request functions in synchronous requests of the price
history.

Added the function of ArrayFill numeric array filling. The
function is an equivalent of memset C function and allows to initialize a
memory area as efficiently as possible.

Updated ENUM_SYMBOL_SWAP_MODE enumeration - swaps accrual
parameters for open positions - new values added and part of previous
ones renamed. Previous enumeration values are still supported for
compatibility.

CCanvas
class allows to implement various graphics on custom charts of "Bitmap"
and "Bitmap Label" types. In fact, these objects turn into a surface
for drawing any image. Thus, it is possible to create custom graphical
objects, apart from the ready-made terminal ones.

The class
implements the functions for drawing lines, circles, rectangles,
polygons, their filling and filling any area in a specified color.
Besides, the client terminal distribution kit now has the example of the
class application CanvasSample
(MQL5\Scripts\Examples\Canvas\CanvasSample.mq5).

Strategy Tester

Added saving the intermediate data of the genetic
optimization - the optimization process will start from where it was
stopped, not from the beginning.

MetaEditor

Added MQL5 programs profiler - the built-in tool for
gathering program parameters during its operation. Attention is paid to
such parameters as functions execution time, number of functions calls,
separate code fragments execution time. This tool allows programmers to
analyze their application, find its critical parts and write more
optimal code.

Profiling results are exported in HTML, CSV and OpenXML formats. To
move to a specific code line, just double-click on the appropriate
profiling report line.

Trading Terminal

The client terminal supports sending messages concerning various events to iOS and Android powered devices using push notifications. With this feature, traders are always aware of all events.

Push notifications are short messages consisting of not more than 255 symbols. Such notifications are delivered immediately and they cannot be lost along the way.

Push notifications can be sent in two ways from the client terminal:

Via MQL5 application

Special SendNotification
function is available in MQL5 language allowing MQL5 application to send push notifications to MetaQuotes ID specified in the terminal settings.

Via signals function

The client terminal allows to create the signals used to notify about the market events. They are set at the "Alerts" tab of the "Toolbox" window. One type of alerting about the events is sending push notifications.

Push notifications can also be used to get information about MQL5.community website updates. To do this, enter your MetaQuotes ID at the "Contacts" tab of your user profile.

The number of sent messages is limited: not more than 1 message per 0.5 seconds and not more than 10 messages per minute.

Then, specify one or several MetaQuotes IDs separated by commas. To find out your MetaQuotes ID, open the mobile version of the terminal and go to Settings -> Messages page. That is how that page looks in the
mobile terminal for iPhone:

Press "Test" button to test messages sending. If sending is successful, you will see the appropriate message and the test notification will be delivered to your mobile device.

Added the button link to MQL5.community website at the client terminal toolbar.

"Charts" and "Objects" tabs are combined into one in the terminal settings.

32-bit version of the terminal has been compiled with the possibility to expand the available virtual address space. The volume of the available memory is expanded from 2 Gb:

Fixed the change of an object name after its creation in case "Show object properties after creation" option is enabled - the object could not be modified or deleted after changing its name without restarting the terminal.

Added prohibition on changing the path to "Bitmap" type images created from MQL5 programs.

Improved scanning for trading server access points - reduced scanning period and clarified the best point selection algorithm.

Improved display of the "Edit" graphical object when using "Wingdings" font.

Fixed moving the graphical objects with a mouse in case of the disabled date scale.

MQL5

Changed timer events processing algorithm. Timer events have been placed in the queue in any case, regardless of the presence of the events not processed by the timer. Now, new events are not added, if the queue has at least one timer event.

Added ChartTimePriceToXY and ChartXYToTimePrice functions - modifications of a chart coordinates from time/price representation to X and Y axes coordinates and vice versa for a specified chart and its subwindow.

Added ResourceCreate function - for loading a resource from a file or creating an image:

bool ResourceCreate(
conststring resource_name, // resource nameconst color& data[], // data set as an array uint img_width, // created resource image widthuint img_height, // created resource image heightuint data_xoffset, // horizontal offset of the upper left corner of the created image to the rightuint data_yoffset, // vertical downward offset of the upper left corner of the created imageuint data_width, // image total width based on data set
ENUM_COLOR_FORMAT color_format // color handling method
);

The first case of the function allows to load images and sounds from files, the second case allows only to create images dynamically. Images must be in BMP format, color depth - 24 or 32 bits, sounds can only be in WAV format. A resource size must not exceed 16 Mb.

Added ChartIndicatorGet function - getting an indicator handle on a specified chart and its subwindow by its short name.

Fixed behavior when accessing an index outside an array - position of the opening square bracket '[' before the index, which returns an error when accessing it, is specified when generating a
message to be displayed in the Expert Advisors journal.

Completed the works on adding profiling support in MQL5 language. MetaEditor profiling function is to be added in the next build.

Fixed the client terminal connection status check when launching an Expert Advisor - avoided delays caused by that check when an Expert Advisor started its operation after the terminal launch.

Added "event handling function not found" compilation error, in case there are no access points (OnStart, OnTick, etc.) in the application.

Fixed compilation when calling the class static methods from another class.

Fixed errors in '?' statement.

Renamed ENUM_ORDER_TYPE_FILLING enumeration elements:

ORDER_FILLING_AON renamed as ORDER_FILLING_FOK

ORDER_FILLING_CANCEL renamed as ORDER_FILLING_IOC

Standard Library.

Controls. Fixed the panels behavior in a separate indicator subwindow.

Added the ability to test the indicators including the ones downloaded from MQL5 Market:

Therefore, it is now possible to evaluate behavior of an indicator during the changes in history.

Strategy Tester

Added support for OpenCL programs application in tester agents.

OpenCL programs are used for performing computations on video cards that support OpenCL 1.1 or higher. Modern video cards contain hundreds of small specialized processors that can simultaneously perform simple mathematical operations with incoming data streams. The OpenCL language organizes parallel computing and provides greater speed for a certain class of tasks.

Corrections in test results reports:

fixed the charts

added holidays consideration in a position lifetime calculation.

Added export of the new report on results of tests in HTML and OpenXML formats.

Trading Terminal

Added global search in the client terminal and at MQL5.com.

The Search in the terminal allows you to quickly find information in all sections of the client terminal, Code Base and MQL5.com.It is a case-insensitive search for a substring. The search is performed in the sections selected in the search parameters:

The context menu of the search results tab contains additional commands, which depend on the type of results:

Fixed display of order volumes in the Market Depth for partially filled orders.

Fixed checking of the expiry price of a pending order in the pending order placing dialog.

MQL5

Added asynchronous sending of trade requests OrderSendAsync.

Using this feature allows to speed up placing of trade requests, and especially when placing mass request, since in this case there is no need to wait for the results of the previous request when placing a new one. Because of its asynchronous nature, this function is not suitable for placing market orders for symbols with the Request execution mode.

The function performs the initial verification of a request on the side of the client terminal and enqueues it to send to the trade server without waiting for the results of sending and receiving of confirmation from
the server.

If necessary, the operation of the function on the server is monitored by an Expert Advisor by handling the OnTrade event.

Added a trading symbol property SYMBOL_ISIN (getting through the SymbolInfoString function) - the name of the trading symbol in the international system of securities identification numbers.

ISIN, International Securities Identification Number is a 12-digit alphanumeric code that uniquely identifies a security.

The availability of this symbol property is defined on the trade server side.

MFE-Profit Correlation - a correlation between the position returns and MFE. Each trade had its maximal profit and maximal loss between opening and closing. MFE shows profit in the favorable excursion of the price. Each trade is corresponded with its return and with two parameters - MFE and MAE. Thus, we can draw each trade on a plane where MFE is plotted along the Х-axis, the return is plotted along the Y-axis. The closer is the return to the MFE, the more complete was the favorable excursion of the price was used. The straight on the graph shows approximation by function Profit=A*MFE+B. The Correlation(Profits,MFE) allows to estimate relation between the profits/losses and the MFE. The closer to 1 is this value, the better will the trades fit into the approximation straight. The closer to zero it is, the less considerable is this relation. MFE characterizes the ability to realize potential profit.

Graph of MFE-Profits Distribution - points plotted on the graph MAE (X-axis) - Profits (Y-axis) indicate positions. Values of both axes are given in the deposit currency. Thus, for each transaction we see not only the acquired profit value including swaps along the Y-axis, but also maximally possible profit during the
position lifetime. It allows us to estimate the quality of protection of the paper (unrealized) profit. Though the distribution of points along the chart gives a satisfactory view of the trade system, a linear regression, which is a least squares approximation, is given for an objective assessment. Ideally, the line should make with the X-axis an angle of 45 degree.

MAE-Profit Correlation - a correlation between the position results and MAE. MAE - Maximum Adverse Excursion. Each trade reached its maximal profit and maximal loss between opening and closing. MAE shows the loss during the adverse excursion of the price. Each trade is corresponded with its return and with two parameters - MFE and MAE. Thus, we can plot each trade on a plane where MAE is plotted along the Х-axis, the return is plotted along the Y-axis. The closer is the return to the MAE, the more complete was the protection against the adverse excursion of the price. The straight on the graph shows approximation by function Profit=A*MAE+B. The Correlation(Profits,MAE) allows to estimate relation between the profits/losses and the MAE. The closer to 1 is this value, the better will the trades fit into the approximation straight. The closer to zero it is, the less considerable is this relation. MAE characterizes the drawdown obtained within the position lifetime and characterizes the use of protective Stop Loss best of all.

Graph of MAE-Profits Distribution - Points plotted on the graph MAE (X-axis) - Profits (Y-axis) indicate positions. Values of both axes are given in the deposit currency. Thus, for each transaction we see not only the acquired profit value including swaps along the Y-axis, but also the maximal drawdown within the position lifetime. It allows us to estimate the transaction according to drawdown waiting out. Though the distribution of points along the chart gives a satisfactory view of the trade system, a linear regression, which is a least squares approximation, is given for an objective assessment. The less trades have negative values X (MAE), the better. It also allows making a decision based on the graphical analysis about maximally accepted losses, after which the possibility of taking profit is very small (if the analysis is carried out on the same currency pair and in points).

In the visual tester implemented automatic addition of the used indicators to the charts of other symbol-periods.

Fixed a bug when stopping visual testing of multicurrency Expert Advisors, which led to numerous messages "stopped by user" in the tester Journal.

Fixed optimization crash when adding a new testing agent during optimization.

MetaEditor

Enhanced MQL5 Storage control functions.

Added new commands for managing the storage of source files that make the use of the MQL5 Storage even more convenient:

Update to revision - selected files are supplemented with information from the files in the specified revision. In files with identical names data are merged. If files have been added to a revision, they will be added to the local copy. If files have been deleted from a revision, they will be deleted from the local copy.

Revert to revision - selected files are replaced by the files from the specified revision. All changes made to the selected files disappear.

Compare with the working copy - files of a selected revision are compared with their current state on the local computer.

Compare with previous revision - compare the current and the previous revision of the files.

Trading Terminal

Implemented skipping of graphical objects create by MQL5 programs when deleting objects using the Backspace key.

Through the OBJPROP_HIDDEN property set only from MQL5 programs, graphical objects are divided into manually created and automatically created objects. By default, the list shows only the manually created objects to keep the window well organized. To see all objects, click "List All".

Now objects created by programs are not deleted by the command "Delete last (Backspace)".
This prevents accidental removal of interface objects. They can be deleted programmatically or through the List of Objects (Ctrl + B) window.

Added display of the beginning and end of symbol trading in the symbol settings dialog:

MQL5

Overloading of operations allows to describe operations with the meaning equivalent to those already existing in the language and apply them to the types of data created by the programmer. For example, overloading of operator "[]" allows you to implement a class with the behavior of an array. Overloading arithmetic operators allows to implement classes for working with complex numbers. In the above cases, overloading of operations allows to use of familiar syntax and avoid creation of numerous functions like ComplexPlusComplex, IntegerPlusComplex, ComplexMinusFloat, etc.

In addition, support for operator overloading in MQL5 provides compatibility with general-purpose programming languages ​​(particularly with C++), facilitating the translation of previously written code (software libraries) into MQL5.

Static fields and methods are the property of the class, so there is no need to create class instances to access its static fields. Use of static fields and methods in the language improves its flexibility and expressiveness. For example, using these methods you can easily implement control over the number of class instances (objects).

Like with the support of operator overloading, support for operator overloading in MQL5 provides compatibility with general-purpose programming languages ​​(particularly with C++), facilitating the translation of previously written code (software libraries) into MQL5.

Added a new property of the "Edit" graphical object - OBJPROP_ALIGN that denotes the alignment of text within the edit field. The property is set and read by methods ObjectSetInteger\ObjectGetInteger.

Fixed the behavior of the ArrayIsDynamic function. When initializing a dynamic array with the initialization list, the ArrayIsDynamic function defined the array as static.

Fixed an error in an implicit conversion of double to bool, which could lead to the error "invalid ex5".

Previously, if there were less than 5 minutes to the time of pending order deletion, an incorrect error TRADE_RETCODE_INVALID_EXPIRATION was returned at the attempt of correct order modification.

Fixed generation of a negative spread when tested on open prices.

Optimized transmission of testing results using the FrameAdd function.

When you run an Expert Advisor in the strategy tester, you can create your own data array based on the simple types or simple structures. This data set can be saved using the FrameAdd() function in a special structure called a frame. During the optimization of an Expert Advisor, each agent can send a series of frames to the terminal. All the received frames are written in the file *.MQD in the folder terminal_directory/MQL5/Files/Tester expert named as the Expert Advisor. They are written in the order they are received from the agents.

Optimize passing of frames from the tester to the client terminal and increased the speed of access to the frames received from the Expert Advisor at the entry points OnTesterPass.

Fixed the context menu in the tabs of testing results.

Fixed initialization of AccountInfo during optimization of strategies (the code exactly corresponds with a single test). This error could lead to the difference between the testing results and single tests with the same parameters.

MetaEditor

Removed default highlighting the current line. In the previous versions, during the initial installation of MetaEditor highlighting of the current line was enabled by default.

In the MQL5 Wizard added support for the OnTester* entry points.

These entry points are handlers of events that are automatically generated by the strategy tester during testing (OnTester) and optimization (OnTesterInit, OnTesterPass, OnTesterDeinit) of Expert Advisors. Use of these functions in the EA allows to implement custom handling of testing and optimization results.

Added snippets for the OnTester* entry points.

For ease of writing code, MetaEditor provides the possibility to insert snippets — small template fragments of source code describing a particular construction of the MQL5 language. Insertion of a snippet is initialized by typing the keyword. After you type the keyword the cursor is changed to "Snippet available". To insert a snippet, you should press "Tab". For more information about working with snippets please read the MetaEditor Help.

Enhanced the features of MetaAssist for supporting operator overloading.

For ease of programming, MetaEditor provides various tools from auto substitutions of names and tips to the functions to anchors and hot keys - MetaAssist. These tools allow you to speed up the process of code writing, make navigation easier and help prevent errors.

Added the window displaying the differences between a source text local file and a version stored in MQL5 Storage:

Trading Terminal

Added new display mode of volumes "Amount" for forex instruments in the Depth of Market. The new mode allows you to see requests in lots and in the quoted currency.

In the dialogs of properties of Bitmap and Bitmap Label, added tooltips to show long paths of image files.

MQL5

Added new methods FrameAdd, FrameFirst, FrameNext and FrameInputs, allowing testing agents to pass their own custom data frames to the terminal and allowing the terminal to read them.

With the new methods you can implement distributed computing to produce results in any convenient form, and not only in the form of one or more numeric values. By connecting to the MQL5 Cloud Network, you can solve any distributed tasks in MQL5, not necessarily, however, related to the financial markets.

Added new entry points OnTesterInit, OnTesterDeinit and OnTesterPass. During the optimization of an Expert Advisor with these entry points, a chart to attach the EA to is created in the terminal. When a new data frame is received from testing agents, OnTesterPass is called, in which the received data can be read and analyzed. A detailed description is available in the documentation.

Added new method ResourceCreate, which allows to create a resource of an image in the memory based on the array of the description of pixels. The created resource can be assigned to graphical objects Bitmap and Bitmap Label. A detailed description is available in the documentation.

New features allow MQL5 programs to analyze the environment in which they run, and based on this make decisions about the use of various resources. These properties will be useful in complex Expert Advisors that require large amounts of resources. Now, during the optimization of such an Expert Advisor in the MQL5 Cloud Network, you can implement checks of available memory of an agent in the EA's OnInit, and in case of a potential shortage of memory not to start the testing process. Also, to make access to new properties easier, added the CTerminalInfo class. A detailed description is available in the documentation.

Fixed optimizer error, which could result in incorrect calculations with floating point.

Fixed the terminal crash error which occurred when using exceptions inside its own DLL in Windows Server 2008 R2 and Windows Server 2008.

Standard Library. Added a new class CTerminalInfo for accessing the new properties of the Expert Advisor environment.

Standard Library. Fixed an error of self-deletion of an indicator in the CAppDialog::CreateIndicator method.

Standard Library. The BackGround method has been renamed to Background in control objects.

Strategy Tester

Changed the operation of the testing method "on open prices". As before, OnTick of an Expert Advisor runs only at the opening of the bar, but instead of M1 OHLC ticks, high, low and close states the tested bar are used. Due to this, stops and pending orders may trigger at a price different from the stated one. This has led to a multiple acceleration of tests.

Increased the total speed of optimization.

The algorithm of checking restrictions on the aggregate positions volume now exactly matches that used on the server.

Standard Library. Fixed an error in the example of the custom indicator RSI.

Strategy Tester

Fixed testing and optimization of Expert Advisors downloaded from the Market, using agents with different bitness.

Fixed errors that could appear when switching to a different account opened on the same trade server.

Fixed change of location of panels in a collapsed application window.

MetaEditor

Enabled support of MQL5 Storage, a personal MQL5 source codes storage designed for the versioned storing of files and managing projects directly from MetaEditor 5 in a handy manner. Check the "Use MQL5
Storage" box in your MQL5.community profile to start using the storage.

Added the "Journal" tab in the toolbar.

Fixed search in the Code Base section.

Added an option for downloading examples from the Code Base in search results.

Added a keyboard shortcut Ctrl+W for closing a source code window.

Fixed errors reported on the forum and in crash logs.
Updated documentation.