MQL4 Other Operations
Indexing ( [] )
**Purpose**: Accesses the i-th element of an array.
**Syntax**: array[index]
**Index Type**: Must be an integer.
**Dimensions**: Supports up to four dimensions.
**Indexing Range**: Each dimension is indexed from 0 to dimension_size - 1.
**Error Handling**: Accessing beyond array bounds results in a critical error and program termination.
**Example**: array[0] for the first element, array[49] for the last in a 50-element array.Function Call ( () )
**Purpose**: Invokes a function with arguments.
**Syntax**: FunctionName(argument1, argument2, ..., argumentN)
**Arguments**: Can be constants, variables, or expressions of the corresponding type. Separated by commas.
**Evaluation Order**: Arguments x1, ..., xn are executed strictly in this order.
**Return Value**: The expression value is the function's return value. Void return types cannot be used in assignment operations.Comma Operation ( , )
**Purpose**: Executes multiple expressions sequentially.
**Syntax**: expression1, expression2, ..., expressionN
**Evaluation Order**: Expressions are executed from left to right.
**Side Effects**: Side effects of left expressions are available before right expressions are calculated.
**Result**: The result type and value coincide with those of the rightmost expression.
**Usage**: Common in for loop initializers and update clauses.
**Example**: for(i=0, j=99; ...)Dot Operator ( . )
**Purpose**: Direct access to public members of structures and classes.
**Syntax**: Variable_name_of_structure_type.Member_name
**Example**: st.sessionName = "Asian";Scope Resolution Operation ( :: )
**Purpose**: Specifies the execution scope for functions, resolving ambiguity.
**Syntax**: [Scope_name]::FunctionName(parameters)
**Global Scope**: If Scope_name is omitted, the global scope is used.
**Function Search Order**: Class methods -> MQL4 functions -> User-defined global functions -> Imported functions.
**Class Member Definition**: Used to define class member functions: type Class_name::Function_name(parameters_description) { ... }
**Example**: ::Print(...) for global scope, kernel32::GetLastError() for imported DLL function.sizeof Operation
**Purpose**: Determines the memory size of an identifier or data type.
**Syntax**: sizeof(expression)
**Expression**: Can be any identifier or type name (except void). Cannot be a bitfield or function name.
**Array Handling**:
* Static arrays: Returns the total size (elements * type size).
* Dynamic arrays: Returns the size of the dynamic array object.
**Structure/Class Size**: Returns the actual memory size of the structure or class.
**Calculation**: Performed at the compilation stage.
**Example**: sizeof(str), sizeof(myStruct)