MQL4 Integer Types

Data Types and Sizes

  • **char**: 1 byte (8 bits), signed. Range: -128 to 127.
  • **uchar**: 1 byte (8 bits), unsigned. Range: 0 to 255.
  • **short**: 2 bytes (16 bits), signed. Range: -32,768 to 32,767.
  • **ushort**: 2 bytes (16 bits), unsigned. Range: 0 to 65,535.
  • **int**: 4 bytes (32 bits), signed. Range: -2,147,483,648 to 2,147,483,647.
  • **uint**: 4 bytes (32 bits), unsigned. Range: 0 to 4,294,967,295.
  • **long**: 8 bytes (64 bits), signed. Range: -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.
  • **ulong**: 8 bytes (64 bits), unsigned. Range: 0 to 18,446,744,073,709,551,615.
  • Unsigned Type Behavior

  • Unsigned integer types (uchar, ushort, uint, ulong) are intended for positive values only.
  • Assigning negative values to unsigned types can lead to unexpected results and infinite loops due to value wrapping.
  • Hexadecimal Notation

  • Hexadecimal numbers are represented using digits 0-9 and letters a-f (or A-F for values 10-15).
  • They must start with 0x or 0X prefix.
  • Examples: 0x0A, 0x12, 0X12, 0x2f, 0xA3, 0Xa3, 0X7C7.
  • Related Topics

  • [Typecasting](/basis/types/casting)
  • [Character Constants](/basis/types/integer/symbolconstants)
  • [Datetime Type](/basis/types/integer/datetime)
  • [Color Type](/basis/types/integer/color)
  • [Bool Type](/basis/types/integer/boolconst)
  • [Enumerations](/basis/types/integer/enumeration)