MQL5 Language Basics Arithmetic Operators
MQL5 Language Basics Arithmetic Operators
/*
ARITHMETIC OPERATIONS
Arithme c opera ons include addive and mul plica ve opera ons
Examples:
// k = variable
// 5 = constant
sum of variables = i = j + 5;
difference of variables = i = j - k;
product of variable z = x * y;
NB: >>> increment and decrement opera ons are applied only to variables, they
>>> The prefix increment (++i) and decrement (--i) are applied to the
the variable right before this variable is used in an expression
>>> The post incerement (i++) and decrement (i--) are applied to the
*/
//EXAMPLES
double x = 100;
double a = x + 100;
double b = -x;
double c = x / 20;
// x++; x--;
double f = ++x;
//+------------------------------------------------------------------+
//| h ps://www.mql5.com |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
int OnInit()
//---
//---
return(INIT_SUCCEEDED);
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//---
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
void OnTick()
//---
//+------------------------------------------------------------------+