MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal

Automated Trading Language Documentation

Subscribe to signal
Automatic system hedging 5 217 54
10.40%, 190 555.68 USD
Parabolic_HTF Indicator
Parabolic_HTF
Author: GODZILLA
Create Your Own Graphical Panels in MQL5 Create Your Own Graphical Panels in MQL5 Screenshot
SBIN-NSE, M30
Demo
Virtual pending sell stop orderVirtual pending sell stop order Try product
Virtual pending sell stop order
Author: iTC

While Loop Operator

The while operator consists of a checked expression and the operator, which must be fulfilled:

while(expression)
  operator;

If the expression is true, the operator is executed until the expression becomes false. If the expression is false, the control is passed to the next operator. The expression value is defined before the operator is executed. Therefore, if the expression is false from the very beginning, the operator will not be executed at all.

Note

If it is expected that a large number of iterations will be handled in a loop, it is advisable that you check the fact of forced program termination using the IsStopped() function.

Example:

while(k<n && !IsStopped())
  {
   y=y*x;
   k++;
  }

See also

Initialization of Variables, Visibility Scope and Lifetime of Variables, Creating and Deleting Objects


Updated: 2011.05.06