Download MetaTrader 5

Integer Types

In MQL5 integers are represented by eleven types. Some types can be used together with other ones, if required by the program logic, but in this case it's necessary to remember the rules of typecasting.

The table below lists the characteristics of each type. Besides, the last column features a type in C++ corresponding to each type.

Type

Size in Bytes

Minimum Value

Maximum Value

C++ Analog

char

1

-128

127

char

uchar

1

0

255

unsigned char, BYTE

bool

1

0(false)

1(true)

bool

short

2

-32 768

32 767

short, wchar_t

ushort

2

0

65 535

unsigned short, WORD

int

4

- 2 147 483 648

2 147 483 647

int

uint

4

0

4 294 967 295

unsigned int, DWORD

color

4

-1

16 777 215

int, COLORREF

long

8

-9 223 372 036 854 775 808

9 223 372 036 854 775 807

__int64

ulong

8

0

18 446 744 073 709 551 615

unsigned __int64

datetime

8

0 (1970.01.01 0:00:00)

32 535 244 799 (3000.12.31 23:59:59)

__time64_t

Integer type values can also be presented as numeric constants, color literals, date-time literals, character constants and enumerations.

See also

Conversion Functions, Numerical Type Constants


Updated: 2015.12.03