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( const void& array[], // Printed array uint digits=_Digits, // The number of decimal places const string separator=NULL, // A separator between the values of the structure fields ulong start=0, // The index of the first displayed element ulong count=WHOLE_ARRAY, // The number of displayed elements ulong 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.//--- Prints the values of the last 10 bars MqlRates rates[]; if(CopyRates(_Symbol,_Period,1,10,rates)) { ArrayPrint(rates); Print("Проверка\n[time]\t[open]\t[high]\t[low]\t[close]\t[tick_volume]\t[spread]\t[real_volume]"); for(int i=0;i<10;i++) { PrintFormat("[%d]\t%s\t%G\t%G\t%G\t%G\t%G\t%G\t%I64d\t",i, TimeToString(rates[i].time,TIME_DATE|TIME_MINUTES|TIME_SECONDS), rates[i].open,rates[i].high,rates[i].low,rates[i].close, rates[i].tick_volume,rates[i].spread,rates[i].real_volume); } } else PrintFormat("CopyRates failed, error code=%d",GetLastError()); //--- A log example /* [time] [open] [high] [low] [close] [tick_volume] [spread] [real_volume] [0] 2016.11.09 04:00:00 1.11242 1.12314 1.11187 1.12295 18110 10 17300175000 [1] 2016.11.09 05:00:00 1.12296 1.12825 1.11930 1.12747 17829 9 15632176000 [2] 2016.11.09 06:00:00 1.12747 1.12991 1.12586 1.12744 13458 10 9593492000 [3] 2016.11.09 07:00:00 1.12743 1.12763 1.11988 1.12194 15362 9 12352245000 [4] 2016.11.09 08:00:00 1.12194 1.12262 1.11058 1.11172 16833 9 12961333000 [5] 2016.11.09 09:00:00 1.11173 1.11348 1.10803 1.11052 15933 8 10720384000 [6] 2016.11.09 10:00:00 1.11052 1.11065 1.10289 1.10528 11888 9 8084811000 [7] 2016.11.09 11:00:00 1.10512 1.11041 1.10472 1.10915 7284 10 5087113000 [8] 2016.11.09 12:00:00 1.10915 1.11079 1.10892 1.10904 8710 9 6769629000 [9] 2016.11.09 13:00:00 1.10904 1.10913 1.10223 1.10263 8956 7 7192138000 Check [time] [open] [high] [low] [close] [tick_volume] [spread] [real_volume] [0] 2016.11.09 04:00:00 1.11242 1.12314 1.11187 1.12295 18110 10 17300175000 [1] 2016.11.09 05:00:00 1.12296 1.12825 1.1193 1.12747 17829 9 15632176000 [2] 2016.11.09 06:00:00 1.12747 1.12991 1.12586 1.12744 13458 10 9593492000 [3] 2016.11.09 07:00:00 1.12743 1.12763 1.11988 1.12194 15362 9 12352245000 [4] 2016.11.09 08:00:00 1.12194 1.12262 1.11058 1.11172 16833 9 12961333000 [5] 2016.11.09 09:00:00 1.11173 1.11348 1.10803 1.11052 15933 8 10720384000 [6] 2016.11.09 10:00:00 1.11052 1.11065 1.10289 1.10528 11888 9 8084811000 [7] 2016.11.09 11:00:00 1.10512 1.11041 1.10472 1.10915 7284 10 5087113000 [8] 2016.11.09 12:00:00 1.10915 1.11079 1.10892 1.10904 8710 9 6769629000 [9] 2016.11.09 13:00:00 1.10904 1.10913 1.10223 1.10263 8956 7 7192138000 */
- Fixed error in the addition of strings of type S1=S2+S1
- 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.
void OnStart() { 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 reserve ArrayResize(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 reserve ArrayResize(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 either ArrayResize(arr,1); Print("Array size:",ArraySize(arr)," Memory used:",MQLInfoInteger(MQL_MEMORY_USED)," MB"); //--- Unused memory will be released after the removal of the reserve ArrayResize(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.
Plotting a chart based on three data series using GraphPlot:#include <Graphics/Graphic.mqh> double Func1(double x) { return MathPow(x,2); } double Func2(double x) { return MathPow(x,3); } double Func3(double x) { return MathPow(x,4); } void OnStart() { GraphPlot(Func1,Func2,Func3,-2,2,0.05,CURVE_LINES); }
The result:
Plotting a chart based on a data array using GraphPlot:#include <Math/Stat/Binomial.mqh> #include <Graphics/Graphic.mqh> void OnStart(void) { double vars[101]; double results[101]; const int N=2000; //--- MathSequence(0,N,20,vars); MathProbabilityDensityBinomial(vars,N,M_PI/10,true,results); ArrayPrint(results,4); GraphPlot(results); //--- }
The result: - 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.
- TestStat.mq5 — the main test script for checking calculation results
- TestPrecision.mq5 — test of calculation precision
- TestBenchmark.mq5 — the test includes computing performance measurement
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.
Only the random delay mode was available in earlier versions. - Fixed generation of the tick volume of bars in the 'M1 based OHLC' mode.
- Fixed specification of order and position opening time up to milliseconds when trading in the hedging mode.
- Fixed "old tick" error, which could appear during multi-currency or multi-timeframe testing in the 'real ticks' mode.
- Improved CopyTicks performance speed when the requested ticks are read from a database located on a disk.
MetaEditor
- The file context menu in the Navigator and in the toolbox now
features commands for working with the versioned source code repository
MQL5 Storage.
- Fixed an error that could occasionally break the integrity of the local MQL5 Storage database when working with more than 1024 files in the repository.
- Fixed display of the file tree of MQL5 Storage.
- Fixed file display after a mass text replacement.
Updated documentation.