|
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 |
---|---|---|---|---|
1 |
-128 |
127 |
char |
|
1 |
0 |
255 |
unsigned char, BYTE |
|
1 |
0(false) |
1(true) |
bool |
|
2 |
-32 768 |
32 767 |
short, wchar_t |
|
2 |
0 |
65 535 |
unsigned short, WORD |
|
4 |
- 2 147 483 648 |
2 147 483 647 |
int |
|
4 |
0 |
4 294 967 295 |
unsigned int, DWORD |
|
4 |
-1 |
16 777 215 |
int, COLORREF |
|
8 |
-9 223 372 036 854 775 808 |
9 223 372 036 854 775 807 |
__int64 |
|
8 |
0 |
18 446 744 073 709 551 615 |
unsigned __int64 |
|
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