Data TypesIt is a common knowledge that only equitype values can be ad dịch - Data TypesIt is a common knowledge that only equitype values can be ad Việt làm thế nào để nói

Data TypesIt is a common knowledge

Data Types


It is a common knowledge that only equitype values can be added or subtracted. For example, apples can be added to apples, but apples cannot be added to square meters or to temperature. Similar limitations can be found in most of modern algorithmic languages.

Like normal objects of life have certain types characterizing their color (red, blue, yellow, green), their taste (bitter, sour, sweet), amount (one and a half, two, seven), MQL4 uses data of different types. Speaking about data type, we will mean the type of the value of a constant, of a variable and the value returned by a function (the notion of function is considered in the section of Functions).

In MQL4, the following types are distinguished (for the values of constants, variables, and the values returned by functions):

int - integers;
double - real numbers;
bool - Boolean (logical) values;
string - values of string type;
color - values of color type;
datetime - values of date and time.
Type int


The values of int type are integers. This type includes values that are integer by their nature. The following values are integers, for example: amount of bars in the symbol window (16000 bars), amount of opened and pending orders (3 orders), distance in points between the current symbol price and the order Open Price (15 points). Amounts representing such objects as events can also be integers only. For example, the amount of attempts to open an order cannot be equal to one and a half, but only to one, two, three, etc.

There are 2 types of integer values:

Decimal values can consist of digits from 0 to 9 and be either positive or negative: 10, 11, 12, 1, 5, -379, 25, -12345, -1, 2.
Hexadecimal values can consist of Latin letters from A to F or from a to f, digits from 0 to 9. They must begin with 0x or 0X and take positive or negative values: 0x1a7b, 0xff340, 0xAC3 0X2DF23, 0X13AAB, 0X1.
Values of int type must be within the range from -2 147 483 648 to 2 147 483 647. If the value of a constant or a variable is beyond the above range, the result of the program operation will be void. The values of constants and variables of int type take 4 bytes of the memory of a computer.

An example of using a variable of int type in a program:

int Art = 10; // Example integer variable int B_27 = -1; // Example integer variable int Num = 21; // Example integer variable int Max = 2147483647; // Example integer variable int Min = -2147483648; // Example integer variable


Type double


The value of double type are real numbers that contain a fractional part.

Example values of this type can be any values that have a fractional part: inclination of the supporting line, symbol price, mean amount of orders opened within a day.

Sometimes you can face problems designating variables when writing your code, i.e., it is not always clear to a programmer what type (int or double) the variable belongs to. Let us consider a small example:

A program has opened 12 orders within a week. What is the type of variable A that considers the mean amount of orders daily opened by this program? The answer is obvious: A = 12 orders / 5 days. It means that variable A = 2.4 should be considered in the program as double, since this value has a fractional part. What type should be the same variable A if the total amount of orders opened within a week is 10? You can think that if 2 (10 orders / 5 days = 2) has no fractional part, variable A can be considered as int. However, this reasoning is wrong. The current value of a variable can have a fraction part consisting of only zeros. It is important that that value of this variable is real by its nature. In this case, variable A has also to be of double type. The separating point must also be shown in the constant record in the program: А = 2.0

The values of real constants and variables consist of an integer part, a decimal point, and a fractional part. The values can be positive or negative. The integer part and the fractional part are made of digits from 0 to 9. The amount of significant figures after decimal point can reach the value of 15.

Example:
27.12 -1.0 2.5001 -765456.0 198732.07 0.123456789012345

The values of double type may range from -1.7 * e-308 to 1.7 * e308. In the computer memory, the values of constants and variables of double type take 8 bytes.

An example of using a variable of double type in a program:

double Art = 10.123; // Example real variable double B_27 = -1.0; // Example real variable double Num = 0.5; // Example real variable double MMM = -12.07; // Example real variable double Price_1 = 1.2756; // Example real variable


Type bool


The values of bool type are values of Boolean (logical) type that contain falsehood or truth.

In order to learn the notion of Boolean type, let's consider a small example from our everyday life. Say, a teacher needs to account the presence of textbooks of the pupils. In this case, the teacher will list all pupils on a sheet of paper and then will tick in a right line whether a pupil has a textbook or not. For example, the teacher may use tick marks and dashes in the table:

List of Pupils Textbook on Physics Textbook on Biology Textbook on Chemistry
1 Smith V - -
2 Jones V - V
3 Brown - V V
... ... ... ... ...
25 Thompson V V V


The values in right columns can be of only 2 types: true or false. These values cannot be attributed to either of the types considered above since they are not numbers at all. They are not the values of color, taste, amount, etc., either. However, they bear an important sense. In MQL4, such values are named Boolean, or logical, values. Constants and variables of bool type are characterized through that they can only take 2 possible values: true (True, TRUE, 1) or false (False, FALSE, 0). The values of constants and variables of bool type take 4 bytes in the computer memory.

An example of using a variable of bool type in a program:

bool aa = True; // Boolean variable аа has the value of true bool B17 = TRUE; // Boolean variable B17 has the value of true bool Hamma = 1; // Boolean variable Hamma has the value of true bool Asd = False; // Boolean variable Asd has the value of false bool Nol = FALSE; // Boolean variable Nol has the value of false bool Prim = 0; // Boolean variable Prim has the value of false


Type string


The value of string type is a value represented as a set of ASCII characters.

In our everyday life, a similar content belongs to, for example, store names, car makes, etc. A string-type value is recorded as a set of characters placed in double quotes (not to be mixed with doubled single quotes!). Quotes are used only to mark the beginning and the end of a string constant. The value itself is the totality of characters framed by the quotes.

If there is a necessity to introduce a double quote ("), you should put a reverse slash () before it. Any special character constants following the reverse slash () can be introduced in a string. The length of a string constant ranges from 0 to 255 characters. If the length of a string constant exceeds its maximum, the excessive characters on the right-hand side will be truncated and compiler will give the corresponding warning. A combination of two characters, the first of which is the reverse slash (), is commonly accepted and perceived by most programs as an instruction to execute a certain text formatting. This combination is not displayed in the text. For example, the combination of
indicates the necessity of a line feed; demands tabulation, etc.

The value of string type is recorded as a set of characters framed by double quotes: "MetaTrader 4", " Stop Loss", "Ssssstop_Loss", "stoploss", "10 pips". The string value as such is the set of characters. The quotes are used only to mark the value borders. The internal representation is a structure of 8 bytes.

An example of using a variable of string type in a program:

string Prefix = "MetaTrader 4"; // Example string variable string Postfix = "_of_my_progr. OK"; // Example string variable string Name_Mass = "History"; // Example string variable string text ="Upper Line
Lower Line"; // the text contains line feed characters


Type color


The value of color type is a chromatic value.

The meaning of 'color' (blue, red, white, yellow, green, etc.) is a common knowledge. It is easy to imagine what a variable or a constant of color type may mean. It is a constant or a variable, the value of which is a color. It may seem to be a bit unusual, but it is very simple, generally speaking. Like the value of an integer constant is a number, the value of a color constant is a color.

The values of color constants and variables can be represented as one of three kinds:

Literals

The value of color type represented as a literal consists of three parts representing the numeric values of intensity of three basic colors: red, green and blue (RGB). The value of this kind starts with 'C' and is quoted by single quotes.

The numeric values of RGB intensity range from 0 to 255 and can be recorded both decimally and hexadecimally.

Examples: C'128,128,128' (gray), C'0x00,0x00,0xFF' (blue), C'0xFF,0x33,0x00' (red).

Integer Representation

Integer representation is recorded as a hexadecimal or a decimal number. A hexadecimal number is displayed as 0xRRGGBB where RR is the value of red intensity, GG - green, and BB - blue. Decimal constants are not directly reflected in RGB. They represent the decimal value of a hexadecimal integer representation.

Representation of the values of color type as integers and as hexadecima
0/5000
Từ: -
Sang: -
Kết quả (Việt) 1: [Sao chép]
Sao chép!
Loại dữ liệuNó là phổ biến kiến thức rằng chỉ có giá trị equitype có thể được thêm hoặc trừ. Ví dụ, táo có thể được thêm vào táo, nhưng táo không thể được thêm vào để mét vuông hoặc để nhiệt độ. Hạn chế tương tự có thể được tìm thấy trong hầu hết các ngôn ngữ algorithmic hiện đại.Giống như các đối tượng bình thường của cuộc sống có một số loại characterizing của màu sắc (màu đỏ, màu xanh, màu vàng, màu xanh lá cây), của hương vị (cay đắng, chua, ngọt), số lượng (một và một nửa, hai, bảy), MQL4 sử dụng dữ liệu loại khác nhau. Phát biểu về kiểu dữ liệu, chúng tôi sẽ có nghĩa là các loại của giá trị của một liên tục, trong một biến và giá trị trả về bởi một chức năng (khái niệm về chức năng được coi là trong phần của chức năng).Ở MQL4, các loại sau đây được phân biệt (cho các giá trị của hằng số, biến, và các giá trị trả về bởi chức năng):int - số nguyên; đôi - số thực; bool - giá trị Boolean (hợp lý); Chuỗi - giá trị của chuỗi loại; màu - giá trị loại màu sắc; DateTime - giá trị ngày và thời gian. Kiểu intCác giá trị của kiểu int là các số nguyên. Loại này bao gồm giá trị là số nguyên bởi bản chất của họ. Các giá trị sau đây là các số nguyên, ví dụ: số tiền của các quán bar trong cửa sổ biểu tượng (16000 thanh), số lượng mở và đang chờ xử lý đơn đặt hàng (đơn đặt hàng 3), khoảng cách ở điểm giữa giá biểu tượng hiện tại và bộ giá mở rộng (15 điểm). Số lượng đại diện cho các đối tượng như sự kiện cũng có thể là số nguyên chỉ. Ví dụ, số lượng các nỗ lực để mở một đơn đặt hàng không thể tương đương với một và một nửa, nhưng chỉ để một, hai, ba, vv.There are 2 types of integer values:Decimal values can consist of digits from 0 to 9 and be either positive or negative: 10, 11, 12, 1, 5, -379, 25, -12345, -1, 2. Hexadecimal values can consist of Latin letters from A to F or from a to f, digits from 0 to 9. They must begin with 0x or 0X and take positive or negative values: 0x1a7b, 0xff340, 0xAC3 0X2DF23, 0X13AAB, 0X1. Values of int type must be within the range from -2 147 483 648 to 2 147 483 647. If the value of a constant or a variable is beyond the above range, the result of the program operation will be void. The values of constants and variables of int type take 4 bytes of the memory of a computer.An example of using a variable of int type in a program: int Art = 10; // Example integer variable int B_27 = -1; // Example integer variable int Num = 21; // Example integer variable int Max = 2147483647; // Example integer variable int Min = -2147483648; // Example integer variableType doubleThe value of double type are real numbers that contain a fractional part.Example values of this type can be any values that have a fractional part: inclination of the supporting line, symbol price, mean amount of orders opened within a day.Sometimes you can face problems designating variables when writing your code, i.e., it is not always clear to a programmer what type (int or double) the variable belongs to. Let us consider a small example:A program has opened 12 orders within a week. What is the type of variable A that considers the mean amount of orders daily opened by this program? The answer is obvious: A = 12 orders / 5 days. It means that variable A = 2.4 should be considered in the program as double, since this value has a fractional part. What type should be the same variable A if the total amount of orders opened within a week is 10? You can think that if 2 (10 orders / 5 days = 2) has no fractional part, variable A can be considered as int. However, this reasoning is wrong. The current value of a variable can have a fraction part consisting of only zeros. It is important that that value of this variable is real by its nature. In this case, variable A has also to be of double type. The separating point must also be shown in the constant record in the program: А = 2.0The values of real constants and variables consist of an integer part, a decimal point, and a fractional part. The values can be positive or negative. The integer part and the fractional part are made of digits from 0 to 9. The amount of significant figures after decimal point can reach the value of 15. Example: 27.12 -1.0 2.5001 -765456.0 198732.07 0.123456789012345 The values of double type may range from -1.7 * e-308 to 1.7 * e308. In the computer memory, the values of constants and variables of double type take 8 bytes.An example of using a variable of double type in a program: nghệ thuật đôi = 10.123; Ví dụ thực sự biến đôi B_27 =-1.0; Ví dụ thực sự biến đôi Num = 0,5; Ví dụ thực sự biến đôi MMM =-12.07; Ví dụ thực sự biến đôi Price_1 = 1.2756; Ví dụ thực sự biếnLoại boolGiá trị bool loại là giá trị Boolean (hợp lý) loại chứa falsehood hay thử thách.Để tìm hiểu các khái niệm của kiểu Boolean, chúng ta hãy xem xét một ví dụ nhỏ từ cuộc sống hàng ngày của chúng tôi. Nói rằng, một giáo viên cần để giải thích sự hiện diện của sách giáo khoa của các em học sinh. Trong trường hợp này, các giáo viên sẽ liệt kê tất cả các em học sinh trên một tờ giấy và sau đó sẽ đánh dấu trong một dòng đúng cho dù một học sinh có một cuốn sách hay không. Ví dụ, các giáo viên có thể sử dụng nhãn hiệu đánh dấu và dấu gạch ngang trong bảng:Danh sách các sách giáo khoa của học sinh về vật lý sách giáo khoa về sinh học sách giáo khoa về hóa học 1 Smith V-- 2 Jones V - V Brown 3 - V V ... ... ... ... ... 25 Thompson V V V Các giá trị trong cột bên phải có thể chỉ có 2 loại: đúng hay sai. Những giá trị này không thể được quy cho một trong các loại được coi là ở trên vì chúng không phải con số ở tất cả. Chúng không phải giá trị màu, hương vị, số lượng, vv, hoặc là. Tuy nhiên, họ mang một ý nghĩa quan trọng. Trong MQL4, các giá trị được đặt tên giá trị Boolean, hay hợp lý. Hằng số và biến loại bool được đặc trưng qua rằng chúng chỉ có giá trị có thể 2: đúng (thật sự, thật sự, 1) hoặc sai (False, FALSE, 0). Các giá trị của hằng số và biến loại bool mất 4 byte trong bộ nhớ máy tính.An example of using a variable of bool type in a program: bool aa = True; // Boolean variable аа has the value of true bool B17 = TRUE; // Boolean variable B17 has the value of true bool Hamma = 1; // Boolean variable Hamma has the value of true bool Asd = False; // Boolean variable Asd has the value of false bool Nol = FALSE; // Boolean variable Nol has the value of false bool Prim = 0; // Boolean variable Prim has the value of false Type stringThe value of string type is a value represented as a set of ASCII characters.In our everyday life, a similar content belongs to, for example, store names, car makes, etc. A string-type value is recorded as a set of characters placed in double quotes (not to be mixed with doubled single quotes!). Quotes are used only to mark the beginning and the end of a string constant. The value itself is the totality of characters framed by the quotes.If there is a necessity to introduce a double quote ("), you should put a reverse slash () before it. Any special character constants following the reverse slash () can be introduced in a string. The length of a string constant ranges from 0 to 255 characters. If the length of a string constant exceeds its maximum, the excessive characters on the right-hand side will be truncated and compiler will give the corresponding warning. A combination of two characters, the first of which is the reverse slash (), is commonly accepted and perceived by most programs as an instruction to execute a certain text formatting. This combination is not displayed in the text. For example, the combination of
indicates the necessity of a line feed; demands tabulation, etc.
The value of string type is recorded as a set of characters framed by double quotes: "MetaTrader 4", " Stop Loss", "Ssssstop_Loss", "stoploss", "10 pips". The string value as such is the set of characters. The quotes are used only to mark the value borders. The internal representation is a structure of 8 bytes.

An example of using a variable of string type in a program:

string Prefix = "MetaTrader 4"; // Example string variable string Postfix = "_of_my_progr. OK"; // Example string variable string Name_Mass = "History"; // Example string variable string text ="Upper Line
Lower Line"; // the text contains line feed characters


Type color


The value of color type is a chromatic value.

The meaning of 'color' (blue, red, white, yellow, green, etc.) is a common knowledge. It is easy to imagine what a variable or a constant of color type may mean. It is a constant or a variable, the value of which is a color. It may seem to be a bit unusual, but it is very simple, generally speaking. Like the value of an integer constant is a number, the value of a color constant is a color.

The values of color constants and variables can be represented as one of three kinds:

Literals

The value of color type represented as a literal consists of three parts representing the numeric values of intensity of three basic colors: red, green and blue (RGB). The value of this kind starts with 'C' and is quoted by single quotes.

The numeric values of RGB intensity range from 0 to 255 and can be recorded both decimally and hexadecimally.

Examples: C'128,128,128' (gray), C'0x00,0x00,0xFF' (blue), C'0xFF,0x33,0x00' (red).

Integer Representation

Integer representation is recorded as a hexadecimal or a decimal number. A hexadecimal number is displayed as 0xRRGGBB where RR is the value of red intensity, GG - green, and BB - blue. Decimal constants are not directly reflected in RGB. They represent the decimal value of a hexadecimal integer representation.

Representation of the values of color type as integers and as hexadecima
đang được dịch, vui lòng đợi..
 
Các ngôn ngữ khác
Hỗ trợ công cụ dịch thuật: Albania, Amharic, Anh, Armenia, Azerbaijan, Ba Lan, Ba Tư, Bantu, Basque, Belarus, Bengal, Bosnia, Bulgaria, Bồ Đào Nha, Catalan, Cebuano, Chichewa, Corsi, Creole (Haiti), Croatia, Do Thái, Estonia, Filipino, Frisia, Gael Scotland, Galicia, George, Gujarat, Hausa, Hawaii, Hindi, Hmong, Hungary, Hy Lạp, Hà Lan, Hà Lan (Nam Phi), Hàn, Iceland, Igbo, Ireland, Java, Kannada, Kazakh, Khmer, Kinyarwanda, Klingon, Kurd, Kyrgyz, Latinh, Latvia, Litva, Luxembourg, Lào, Macedonia, Malagasy, Malayalam, Malta, Maori, Marathi, Myanmar, Mã Lai, Mông Cổ, Na Uy, Nepal, Nga, Nhật, Odia (Oriya), Pashto, Pháp, Phát hiện ngôn ngữ, Phần Lan, Punjab, Quốc tế ngữ, Rumani, Samoa, Serbia, Sesotho, Shona, Sindhi, Sinhala, Slovak, Slovenia, Somali, Sunda, Swahili, Séc, Tajik, Tamil, Tatar, Telugu, Thái, Thổ Nhĩ Kỳ, Thụy Điển, Tiếng Indonesia, Tiếng Ý, Trung, Trung (Phồn thể), Turkmen, Tây Ban Nha, Ukraina, Urdu, Uyghur, Uzbek, Việt, Xứ Wales, Yiddish, Yoruba, Zulu, Đan Mạch, Đức, Ả Rập, dịch ngôn ngữ.

Copyright ©2025 I Love Translation. All reserved.

E-mail: