Forum

Multidimensional array size depending on a parameter: how to get this?

Hello everybdy, according to documentation (https://www.mql5.com/en/articles/567), when declaring an array, its size can be specified directly as a number or using a predefined constant: #define SIZE 3 double Variable[SIZE]; Unfortunately this seems not to work with multidimensional array, that

Using multiple (demo) accounts with Metatrader 5

Hello everybody, if I wanted to test different Expert Advisors operating in real time on different accounts, the only way to achieve this is to make several different installation of Metatrader 5 in the same pc but in different directories, and then to connect each Metatrader 5 to a different (demo)

How to use more than one local agent in Strategy Tester?

Hello everybody, as far as I can read here https://www.mql5.com/en/articles/341 it seems that disabling the use of remote agents should allow to use all the local agents for testing/optimization purposes using the Strategy Tester. However it seems that in my case, from what I can read from the log

Type conversion of a whole array: is it possible?

Hello everybody, in my code I use a function that calculates the average value of an array of type double: double Average( double &arr[]) { int size= ArraySize (arr); //--- check if (size<= 0 ) { Print ( __FUNCTION__ + ": array size error" ); return ( EMPTY_VALUE ); }

Copying one dimension of a multidimensional array to a single dimensional one

Hello everybody, suppose I have a multidimensional array int myarr[ 3 ][ 4 ] is it possible then to have access to a single dimensional projection of it in this way: int temparr[ 4 ]; temparr=myarr[0][]; or using ArrayCopy in the same way: ArrayCopy (temparr,myarr[ 0 ][], 0 , 0 , WHOLE_ARRAY

Static array whose size depend on input parameters

Hello everybody, I would like to use an array whose size is specified by some input parameter, for example: //--- input parameters input int L= 5 ; // some number //--- Other parameters double teta[L+ 2 ]; But in this way i get an error at compilation: '[' - invalid index value

How to get info about deal time?

Hello everybody, I need help to understand which is the simplest way to get informations abut the time execution of an order. In my EA, order is placed, and results are collected using this code: bool success= OrderSend (mrequest,mresult); Where mresult is a MqlTradeResult structure. From the

What's wrong with this simple trade request structure?

Hello everybody I have written a simple EA that randomly places at every tick a buy or sell order, below I put the relevant part of the code. However, when I try to use it on EURUSD, where Market orders are allowed (price specification is not required), I always get a trade return code 10015

Generating uniformly distributed random numbers

Hello everybody, I need help on how to generate uniformly distributed random numbers in MQL5. I know that for MQL4 there exists a function mathinrangerandom that does this job, is there anythig equivalent for MQL5

Writing bid-ask prices on a csv file

Hello everybody, what I would like to do is to write a simple expert advisor that does this three steps: 1) open a csv file for writing; 2) writes bid and ask prices in that csv files, in different lines; 3) closes the file. I would like to put these three steps respectively in OnInit, OnTick and