void func(int &arr[ ][ ][ ][ ]) { }
struct MyStruct { string Array[]; }; void OnStart() { MyStruct a1,a2; ArrayResize(a1.Array,3); ArrayResize(a2.Array,1); a1=a2; }Earlier, the "a1" array size was equal to 3 after the function call. Now, the size will be 1.
Documentation has been updated.
ENUM_FP_CLASS MathClassify( double value // real number );The enumeration contains the following values:
if(MathClassify(value)>FP_ZERO) { Print("value is not a valid number"); }
We have revised optimization criteria which include two variables, one of which is the balance. Now, the
criteria only take into account the second variable and ignore the
balance. The new optimization criteria are easier to analyze.
We have gathered feedback from MetaTrader 5 iOS users and redesigned the application considerably
Position value and magic columns have also been added to the trading history section.
import sys chart_symbol='unknown' chart_tf=1 if len(sys.argv) == 3: chart_symbol, chart_tf = sys.argv[1:3]; print("Hello world from", chart_symbol, chart_tf) >> Hello world from T.NYSE 15
Search results from external resources appear in the MetaEditor toolbox window:
long DatabaseImport( int database, // database handle received in DatabaseOpen const string table, // table name to insert data to const string filename, // file name to import data from uint flags, // combination of flags const string separator, // data separator ulong skip_rows, // number of first rows to skip const string skip_comments // string of characters, which define comments );
long DatabaseExport( int database, // database handle received in DatabaseOpen const string table_or_sql, // table name or SQL query const string filename, // CSV file name for data export uint flags, // combination of flags const string separator // data separator in the CSV file );
long DatabasePrint( int database, // database handle received in DatabaseOpen const string table_or_sql, // table or SQL query uint flags // combination of flags );
int FileSelectDialog( string caption, // window title string initial_dir, // initial directory string filter, // extension filter uint flags, // combination of flags string& filenames[], // array with file names string default_filename // default file name );The new function enables the efficient user interaction with the MQL5 program.
#property optimization_chart_mode "3d,InpX,InpY"The property allows setting the type of chart which opens at the end of optimization, as well as program parameters for the X and Y axes.
double MathArctan2( double y // the y coordinate of the point double x // the x coordinate of the point );
Added user interface translation into Punjabi (India).
Documentation has been updated.
Fixes based on crash logs.
The update will be available through the Live Update system.
class CFoo { public: struct Item { int x; }; }; //+------------------------------------------------------------------+ class CBar { public: struct Item { int x; }; }; CBar::Item item; // proper declaration of the Item structure from the Bar class Item item; // incorrect declarationAdded namespace support which provides more possibilities when using third-party code/libraries in MQL5 applications.
#define PrintFunctionName() Print(__FUNCTION__) namespace NS { void func() { PrintFunctionName(); } struct C { int x; C() { PrintFunctionName(); }; }; } struct C { int x; C() { PrintFunctionName(); }; }; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void func() { PrintFunctionName(); } //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { func(); NS::func(); C c; NS::C ac; }Upon execution the following result is displayed as output:
class A { void operator=(const A &)=delete; // prohibit object copying operator }; class B : public A { }; //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { A a1,a2; B b1,b2; a1=a2; b1=b2; }In this example, the compiler will return errors for "a1=a2" and "b1=b2":
input group "Signal" input int ExtBBPeriod =20; // Bollinger Bands period input double ExtBBDeviation =2.0; // deviation input ENUM_TIMEFRAMES ExtSignalTF =PERIOD_M15; // BB timeframe input group "Trend" input int ExtMAPeriod =13; // Moving Average period input ENUM_TIMEFRAMES ExtTrendTF =PERIOD_M15; // MA timeframe input group "ExitRules" input bool ExtUseSL =true; // use StopLoss input int Ext_SL_Points =50; // StopLoss in points input bool ExtUseTP =false; // use TakeProfit input int Ext_TP_Points =100; // TakeProfit in points input bool ExtUseTS =true; // use Trailing Stop input int Ext_TS_Points =30; // Trailing Stop in points input group "MoneyManagement" sinput double ExtInitialLot =0.1; // initial lot value input bool ExtUseAutoLot =true; // automatic lot calculation input group "Auxiliary" sinput int ExtMagicNumber =123456; // EA Magic Number sinput bool ExtDebugMessage=true; // print debug messagesWhen such an Expert Advisor is launched in the Strategy Tester, input parameter blocks can be collapsed or expanded by a double click on the group name, as well as all parameters within a group can be selected for optimization with a single check box.
#import "lib.dll" int func(); #import //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int func() { return(0); } //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { Print( func() ); }In earlier versions, the following error returned during compilation:
'func' - ambiguous call to overloaded function with the same parameters could be one of 2 function(s) int func() int func()Now, instead of the error, the built-in MQL5 function with a higher priority will be used by default. The imported function can be called by explicitly specifying the scope:
void OnStart() { Print( lib::func() ); }
if(condition) { //--- }
// before styling ParameterGetRange("InpX",enable,x_cur,x_start,x_step,x_stop); // after styling ParameterGetRange("InpX", enable, x_cur, x_start, x_step, x_stop);
// before styling if(x==1&y!=2) { int a=0; } // after styling if(x == 1 & y != 2) { int a = 0; }
The user interface has been additionally translated into 18 new languages:
The platform interface is now available in 50 languages, which are spoken by more than 4 billion people.
To set you language for the interface, navigate to the "View / Language" menu at the top of the terminal.
Documentation has been updated.
Fixes based on crash logs.
The update will be available through the Live Update system.
Python is a modern high-level programming language for developing scripts and applications. It contains multiple libraries for machine learning, process automation, as well as data analysis and visualization.
MetaTrader package for Python is designed for efficient and fast obtaining of exchange data via interprocessor communication, directly from the MetaTrader 5 terminal. The data received via this pathway can be further used for statistical calculations and machine learning.
Connection
Functions
bool TesterDeposit( double money // the deposit amount );
Documentation has been updated.
The update is available through the LiveUpdate system.
bool CalendarCountryById( const long country_id, // country ID MqlCalendarCountry& country // country description );CalendarEventById — gets event description by identifier.
bool CalendarEventById( const long event_id, // event ID MqlCalendarEvent& event // event description );CalendarValueById — gets event value description by identifier.
bool CalendarValueById( const long value_id, // value ID MqlCalendarValue& value // value description );CalendarEventByCountry — gets the array of available events for the country.
bool CalendarEventByCountry( string country_code, // country code MqlCalendarEvent& events[] // array of events );CalendarEventByCurrency — gets the array of available events for the affected currency.
bool CalendarEventByCurrency( string currency, // currency MqlCalendarEvent& events[] // array of events );CalendarValueHistoryByEvent — gets the array of values for the specified time period, by event identifier.
bool CalendarValueHistoryByEvent( ulong event_id, // event ID MqlCalendarValue& values[], // array of values datetime datetime_from, // period beginning date datetime datetime_to=0 // period end date );CalendarValueHistory — gets the array of values for the specified time period for all events, filtered by country and/or currency.
bool CalendarValueHistory( MqlCalendarValue& values[], // array of values datetime datetime_from, // beginning of period datetime datetime_to=0, // end of period string country_code=NULL, // country code string currency=NULL // currency );CalendarValueLastByEvent — gets an array of last event values by identifier. This function enables the request of the values which have appeared since the previous request. The in/out parameter "change_id" is additionally used for this operation.
bool CalendarValueHistory( ulong event_id, // event ID ulong& change_id, // last calendar change ID MqlCalendarValue& values[] // array of values );CalendarValueLast — gets the array of last values for all events, filtered by country and/or currency. This function enables the request of the values which have appeared since the previous request. Similarly to CalendarValueLastByEvent, the "change_id" property is used for the request.
bool CalendarValueHistory( ulong event_id, // event ID ulong& change_id, // last calendar change ID MqlCalendarValue& values[], // array of values string country_code=NULL, // country code string currency=NULL // currency );
struct MqlCalendarCountry { ulong id; // country ID in ISO 3166-1 string name; // text name of the country string code; // code name of the country in ISO 3166-1 alpha-2 string currency; // country currency code string currency_symbol; // country currency symbol/sign string url_name; // country name used in URL on mql5.com };MqlCalendarEvent — event description.
struct MqlCalendarEvent { ulong id; // event ID ENUM_CALENDAR_EVENT_TYPE type; // event type ENUM_CALENDAR_EVENT_SECTOR sector; // sector to which the event belongs ENUM_CALENDAR_EVENT_FREQUENCY frequency; // event release frequency ENUM_CALENDAR_EVENT_TIMEMODE time_mode; // event release time mode ulong country_id; // country ID ENUM_CALENDAR_EVENT_UNIT unit; // unit for the event values ENUM_CALENDAR_EVENT_IMPORTANCE importance; // event importance ENUM_CALENDAR_EVENT_MULTIPLIER multiplier; // event importance multiplier uint digits; // number of decimal places in the event value string source_url; // source URL string event_code; // event code string name; // text name of the event in the terminal language };MqlCalendarValue — event value description.
struct MqlCalendarValue { ulong id; // value ID ulong event_id; // event ID datetime time; // event date and time datetime period; // period, for which the event is published int revision; // published indicator revision in relation to the reported period long actual_value; // current event value long prev_value; // previous event value long revised_prev_value; // revised previous event value long forecast_value; // forecast event value ENUM_CALENDAR_EVENT_IMPACRT impact_type; // potential impact on the currency rate };
enum ENUM_CALENDAR_EVENT_FREQUENCY { CALENDAR_FREQUENCY_NONE =0, // not used CALENDAR_FREQUENCY_WEEK =1, // weekly CALENDAR_FREQUENCY_MONTH =2, // monthly CALENDAR_FREQUENCY_QUARTER =3, // quarterly CALENDAR_FREQUENCY_YEAR =4, // yearly CALENDAR_FREQUENCY_DAY =5, // daily }; enum ENUM_CALENDAR_EVENT_TYPE { CALENDAR_TYPE_EVENT =0, // event (meeting, speech, etc.) CALENDAR_TYPE_INDICATOR =1, // indicator CALENDAR_TYPE_HOLIDAY =2, // holiday }; enum ENUM_CALENDAR_EVENT_SECTOR { CALENDAR_SECTOR_NONE =0, // no CALENDAR_SECTOR_MARKET =1, // market CALENDAR_SECTOR_GDP =2, // GDP CALENDAR_SECTOR_JOBS =3, // jobs CALENDAR_SECTOR_PRICES =4, // prices CALENDAR_SECTOR_MONEY =5, // money CALENDAR_SECTOR_TRADE =6, // trade CALENDAR_SECTOR_GOVERNMENT =7, // government CALENDAR_SECTOR_BUSINESS =8, // business CALENDAR_SECTOR_CONSUMER =9, // consumer CALENDAR_SECTOR_HOUSING =10, // housing CALENDAR_SECTOR_TAXES =11, // taxes CALENDAR_SECTOR_HOLIDAYS =12, // holidays }; enum ENUM_CALENDAR_EVENT_IMPORTANCE { CALENDAR_IMPORTANCE_NONE =0, // no CALENDAR_IMPORTANCE_LOW =1, // low CALENDAR_IMPORTANCE_MODERATE =2, // moderate CALENDAR_IMPORTANCE_HIGH =3, // high }; enum ENUM_CALENDAR_EVENT_UNIT { CALENDAR_UNIT_NONE =0, // no CALENDAR_UNIT_PERCENT =1, // percent CALENDAR_UNIT_CURRENCY =2, // national currency CALENDAR_UNIT_HOUR =3, // number of hours CALENDAR_UNIT_JOB =4, // number of jobs CALENDAR_UNIT_RIG =5, // number of rigs CALENDAR_UNIT_USD =6, // US dollar CALENDAR_UNIT_PEOPLE =7, // number of people CALENDAR_UNIT_MORTGAGE =8, // number of mortgages CALENDAR_UNIT_VOTE =9, // number of votes CALENDAR_UNIT_BARREL =10, // number of barrels CALENDAR_UNIT_CUBICFEET =11, // volume in cubic feet CALENDAR_UNIT_POSITION =12, // number of job positions CALENDAR_UNIT_BUILDING =13 // number of buildings }; enum ENUM_CALENDAR_EVENT_MULTIPLIER { CALENDAR_MULTIPLIER_NONE =0, // no CALENDAR_MULTIPLIER_THOUSANDS =1, // thousands CALENDAR_MULTIPLIER_MILLIONS =2, // millions CALENDAR_MULTIPLIER_BILLIONS =3, // billions CALENDAR_MULTIPLIER_TRILLIONS =4, // trillions }; enum ENUM_CALENDAR_EVENT_IMPACRT { CALENDAR_IMPACT_NA =0, // not available CALENDAR_IMPACT_POSITIVE =1, // positive CALENDAR_IMPACT_NEGATIVE =2, // negative }; enum ENUM_CALENDAR_EVENT_TIMEMODE { CALENDAR_TIMEMODE_DATETIME =0, // the source publishes the exact time CALENDAR_TIMEMODE_DATE =1, // the event takes the whole day CALENDAR_TIMEMODE_NOTIME =2, // the source does not publish the event time CALENDAR_TIMEMODE_TENTATIVE =3, // the source provides only date, but does not publish the exact time in advance, exact time is added when event occurs };
ERR_CALENDAR_MORE_DATA =5400, // the array is too small for the whole result (values which fit in the array were passed) ERR_CALENDAR_TIMEOUT =5401, // timed out waiting for a response to the calendar data request ERR_CALENDAR_NO_DATA =5402, // data not found
bool CharArrayToStruct( void& struct_object, // structure const uchar& char_array[], // array uint start_pos=0 // starting position in the array );StructToCharArray copies a POD structure to a uchar array.
bool StructToCharArray( const void& struct_object, // structure uchar& char_array[], // array uint start_pos=0 // starting position in the array );
ushort MathSwap(ushort value); uint MathSwap(uint value); ulong MathSwap(ulong value);
bool StringReserve( string& string_var, // string uint new_capacity // buffer size for the string );StringSetLength sets the specified string length in characters.
bool StringSetLength( string& string_var, // string uint new_length // new string length );
bool ArrayRemove( void& array[], // array of any type uint start, // the index to start removal uint count=WHOLE_ARRAY // number of elements );ArrayInsert inserts to a receiver array the specified number of elements from the source array, starting with the specified index.
bool ArrayInsert( void& dst_array[], // receiver array const void& src_array[], // source array uint dst_start, // index in the receiver array where to insert uint src_start=0, // index in the source array to start copying uint count=WHOLE_ARRAY // number of inserted elements );ArrayReverse reverses in an array the specified number of elements starting with the specified index.
bool ArrayReverse( void& array[], // array of any type uint start=0, // index to start reversing uint count=WHOLE_ARRAY // number of elements );
int CustomBookAdd( const string symbol, // symbol name const MqlBookInfo& books[] // an array with the DOM elements descriptions uint count=WHOLE_ARRAY // number of elements to be used );
bool CustomSymbolCreate( const string symbol_name, // custom symbol name const string symbol_path="", // name of the group in which the symbol will be created const string symbol_origin=NULL // name of the symbol based on which the custom symbol will be created );The name of the symbol, from which the properties of for the custom symbol should be copied, is specified in the "symbol_origin" parameter.
Added user interface translation into Croatian.
Documentation has been updated.