MQL4 Bool Type

Overview

  • Stores logical values: true or false.
  • Numeric representation: 1 for true, 0 for false.
  • Internal representation: 1-byte integer.
  • Usage in Logical Expressions

  • Any integer or real type/expression can be used in logical expressions.
  • Zero values are interpreted as false.
  • All other values (non-zero) are interpreted as true.
  • Examples

    bool a = true;
    bool b = false;
    bool c = 1;

    int i = 5; double d = -2.5;

    if(i) Print("i is true"); // Output: i is true if(d) Print("d is true"); // Output: d is true

    i = 0; if(i) Print("i is true"); // Output: (no output) else Print("i is false"); // Output: i is false

    d = 0.0; if(d) Print("d is true"); // Output: (no output) else Print("d is false"); // Output: d is false

    Related Topics

  • [Boolean Operations](/basis/operations/bool)
  • [Precedence Rules](/basis/operations/rules)