What's new in MetaTrader 5

24 November 2016

Terminal

The order of entries in the terminal and MetaEditor journals has changed. Before the update, the latest log entries were featured first. Now the oldest entries are shown in the beginning of the journal. A more conventional reverse sorting order makes reading the journal easier.

In addition, it is now possible to hide the 'Time' and 'Source' columns using the journal context menu.

In the hedging mode, the ticket of a closed position is now displayed for the orders and deals in the trading history. This makes it easier to find related opening and closing operations.

Fixed an error that caused copying of SL/TP from an existing position to a new position on the same instrument. The error could occur when using One Click Trading functions (for example, from the chart or from the Market Watch window) in the hedging mode.

Fixed display of arrow objects on ultra-high-definition screens (4K).

MQL5

A new ArrayPrint function has been added, which prints simple types and structures to the array log.

void ArrayPrint(
constvoid& array[], // Printed arrayuint digits=_Digits, // The number of decimal placesconststring separator=NULL, // A separator between the values of the structure fieldsulong start=0, // The index of the first displayed elementulong count=WHOLE_ARRAY, // The number of displayed elementsulong flags=ARRAYPRINT_HEADER|ARRAYPRINT_INDEX|ARRAYPRINT_LIMIT|ARRAYPRINT_ALIGN
);

ArrayPrint does not print all fields of a structure array to logs – array fields and pointer fields of objects are skipped. If you want to print all fields of a structure, you should use a custom function for the mass printing with a desired formatting.

The behavior of the ArrayResize function has changed. If -1 is passed as the reserve_size parameter, the function only releases unused (reserved) memory if the function does not increase the array size. Setting the new array size to 0 with reserve_size=-1 is equivalent to the ArrayFree call. The new behavior allows optimizing memory usage in MQL5 programs.

voidOnStart()
{
int arr[];
//--- Amount of memory initially used Print("Array size:",ArraySize(arr)," Memory used:",MQLInfoInteger(MQL_MEMORY_USED)," MB");
//--- Amount of memory used for the array of size 1, with a reserveArrayResize(arr,1,1024*1024);
Print("Array size:",ArraySize(arr)," Memory used:",MQLInfoInteger(MQL_MEMORY_USED)," MB");
//--- After the increase of the array, the amount of memory used will not change due to the reserveArrayResize(arr,1024*512,1024*1024);
Print("Array size:",ArraySize(arr)," Memory used:",MQLInfoInteger(MQL_MEMORY_USED)," MB");
//--- After reducing the array, the memory size will not change eitherArrayResize(arr,1);
Print("Array size:",ArraySize(arr)," Memory used:",MQLInfoInteger(MQL_MEMORY_USED)," MB");
//--- Unused memory will be released after the removal of the reserveArrayResize(arr,1,-1);
Print("Array size:",ArraySize(arr)," Memory used:",MQLInfoInteger(MQL_MEMORY_USED)," MB");
}

Chart drawing functions have been added to the Standard Library. To use the new functionality, include MQL5\Include\Graphics\Graphic.mqh to your project.

Updated functions for working with mathematical statistics in the Standard Library. We have thoroughly checked the quality and accuracy of all functions both in the MQL5 version and in the source R language. Unit tests are distributed along with the static library; the tests enable control over the accuracy and performance speed. They are available in the directory \MQL5\Scripts\UnitTests\Stat.

Tester

The updated version features advanced settings for configuring execution delays during testing. Now you can test your Expert Advisors in a variety of trading conditions, including the ideal case without a delay and any custom set delay.