17 September 2022
17 September 2022
Terminal
MQL5
bool vector<TDst>::Assign(const vector<TSrc> &assign); bool matrix<TDst>::Assign(const matrix<TSrc> &assign);Example:
//--- copying matrices matrix b={}; matrix a=b; a.Assign(b); //--- copying an array to a matrix double arr[5][5]={{1,2},{3,4},{5,6}}; Print("array arr"); ArrayPrint(arr); b.Assign(arr); Print("matrix b \n",b); /* array arr [,0] [,1] [,2] [,3] [,4] [0,] 1.00000 2.00000 0.00000 0.00000 0.00000 [1,] 3.00000 4.00000 0.00000 0.00000 0.00000 [2,] 5.00000 6.00000 0.00000 0.00000 0.00000 [3,] 0.00000 0.00000 0.00000 0.00000 0.00000 [4,] 0.00000 0.00000 0.00000 0.00000 0.00000 matrix b [[1,2,0,0,0] [3,4,0,0,0] [5,6,0,0,0] [0,0,0,0,0] [0,0,0,0,0]] */
bool matrix::CopyRates(string symbol,ENUM_TIMEFRAMES period,ulong rates_mask,ulong from,ulong count); bool vector::CopyRates(string symbol,ENUM_TIMEFRAMES period,ulong rates_mask,ulong from,ulong count);The copied data type is specified in the rates_mask parameter using the ENUM_COPY_RATES enumeration. The following values are available:
Fixed error when changing a constant parameter which has been passed to a function as an object pointer reference.
The const specifier declares a variable as a constant to prevent it from being changed during program execution. It only allows one-time variable initialization during declaration. An example of constant variables in the OnCalculate function:
int OnCalculate (const int rates_total, // price[] array size const int prev_calculated, // bars processed on previous call const int begin, // meaningful data starts at const double& price[] // array for calculation );
The below example contains a compiler error which allowed an implicit pointer casting for reference parameters:
class A {}; const A *a = new A; void foo( const A*& b ) { b = a; } void OnStart() { A *b; foo(b); // not allowed Print( a,":",b ); }The compiler will detect such illegal operations and will return the relevant error.
MetaEditor
New MetaTrader 5 Web Terminal
We
have released a revised MetaTrader 5 Web Terminal which features an
updated interface and a redesigned core. The new interface is similar to
the terminal version for iPad:
It also features a plethora of new functions:
Try the new web terminal at www.mql5.com right now. It will soon become available for your brokers.