MQL4 - automated forex trading   /  

Documentation

MQL4 Reference  Basics  Operations & Expressions  Other operations

 

Indexing
At addressing to the i-th element of array, the expression value is the value of the variable with serial number of i.

Example:

array[i] = 3; //Assign the value of 3 to the i-th element of the array.

Only an integer can be index of an array. Four-dimensional and below arrays are allowed. Each measurement is indexed from 0 to measurement size-1. In particular case, for a one-dimensional array consisting of 50 elements, the reference to the first element will look like array[0], that to the the last element will array[49].

At access beyond the array, the executing subsystem will generate the error of ERR_ARRAY_INDEX_OUT_OF_RANGE that can be got through the GetLastError() function.

Call for function with x1,x2,...,xn arguments.
Each argument can represent a constant, a variable, or an expression of the corresponding type. The arguments passed are separated by commas and must be inside of parentheses, the opening parenthesis to follow the name of the called function.

The expression value is the value returned by the function. If the returned value is of the void type, such function call cannot be placed to the right in the assignment operation. Please make sure that the expressions x1,x2,...,xn are executed exactly in this order.

Example:

double SL=Bid-25*Point;
int    ticket=OrderSend(Symbol(),OP_BUY,1,Ask,3,SL,Ask+25*Point,"My comment",123,0,Red);

Comma operation
Expressions separated by commas are executed from left to right. All side effects of the left expression calculation can appear before the right expression is calculated. The result type and value coincide with those of the right expression. The list of parameters to be passed (see above) can be considered as an example.

Example:

for(i=0,j=99; i<100; i++,j--) Print(array[i][j]);