MQL4 Reference
Basics
Operations & Expressions
Assignment operation
|
The value of the expression that includes the given operation is the value of the left operand after assignment.
Assigning the y value to the x variable y = x;
The following operations unite arithmetic or bitwise operations with operation of assignment:
Adding x to the y variable y += x;
Subtracting x from the y variable y -= x;
Multiplying the y variable by x y *= x;
Dividing the y variable by x y /= x;
Module x value of y y %= x;
Logical shift of y representation to the right by x bit y >>= x;
Logical shift of y representation to the left by x bit y <<= x;
Bitwise operation AND y &= x;
Bitwise operation OR y |= x;
Bitwise operation exclusive OR
of x and y binary notations y ^= x;
There can be only one operation of assignment in an expression. Bitwise operations are performed with integer
numbers only. The logical shift operation uses values of x less than 5 binary digits. The greater digits are rejected,
so the shift is for the range of 0 to 31 bit. By %= operation (y value by module of x), the result sign is equal to the sign of divided number.
|
|
|