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.Hiện có 2 loại giá trị số nguyên:Giá trị thập phân có thể bao gồm các chữ số từ 0 đến 9 và được tích cực hoặc tiêu cực: 10, 11, 12, 1, 5,-379, 25,-12345, -1, 2. Hệ thập lục phân giá trị có thể bao gồm các chữ cái Latin từ A đến F hoặc từ một đến f, chữ số từ 0 đến 9. Họ phải bắt đầu với 0 x hoặc 0 X và có giá trị tích cực hay tiêu cực: 0x1a7b, 0xff340, 0xAC3 0X2DF23, 0X13AAB, 0X1. Giá trị của kiểu int phải trong khoảng từ - 2 147 483 648 để 2 147 483 647. Nếu giá trị của một liên tục hoặc một biến là vượt ra ngoài phạm vi trên, kết quả của hoạt động chương trình sẽ bị vô hiệu. Các giá trị của hằng số và biến kiểu int có 4 byte bộ nhớ của máy tính.Một ví dụ của việc sử dụng một biến kiểu int trong một chương trình: int nghệ thuật = 10; Ví dụ số nguyên biến int B_27 = -1; Ví dụ số nguyên biến int Num = 21; Ví dụ số nguyên biến int Max = 2147483647; Ví dụ số nguyên biến int phút =-2147483648; Ví dụ số nguyên biếnLoại đôiGiá trị của hai loại là số thực có chứa một phần phân đoạn.Ví dụ giá trị của loại hình này có thể là bất kỳ giá trị nào có một phần phân đoạn: độ nghiêng của dòng hỗ trợ, biểu tượng giá, có nghĩa là số tiền của các đơn đặt hàng mở trong vòng một ngày.Đôi khi bạn có thể phải đối mặt vấn đề chỉ định biến khi viết mã của bạn, tức là, nó không phải là luôn luôn rõ ràng để một lập trình viên loại (int hoặc đôi) biến thuộc về. Chúng ta hãy xem xét một ví dụ nhỏ:Một chương trình đã mở 12 đơn đặt hàng trong vòng một tuần. Loại của biến một mà sẽ xem xét có nghĩa là số lượng các đơn đặt hàng hàng ngày mở bằng chương trình này là gì? Câu trả lời là hiển nhiên: A = 12 đơn đặt hàng / 5 ngày. Nó có nghĩa là rằng biến A = 2.4 nên được xem xét trong chương trình như tăng gấp đôi, kể từ khi giá trị này có một phần chút ít. Loại nên là cùng một biến A nếu tổng số tiền đơn đặt hàng mở cửa trong vòng một tuần là 10? Bạn có thể nghĩ rằng nếu 2 (đơn đặt hàng 10 / 5 ngày = 2) đã không có một phần phân đoạn, biến A có thể được coi là int. Tuy nhiên, lý do này là sai. Giá trị hiện tại của một biến có thể có một phần phần bao gồm chỉ Zero. Nó là quan trọng rằng giá trị của biến này là có thật bởi bản chất của nó. Trong trường hợp này, biến A có cũng của hai loại. Khi tách cũng phải được hiển thị trong bản ghi liên tục trong chương trình: А = 2.0Các giá trị của hằng số thực và biến bao gồm một phần số nguyên, nhiệt độ thập phân, và một phần phân đoạn. Các giá trị có thể được tích cực hay tiêu cực. Một phần số nguyên và phần phân đoạn được làm bằng chữ số từ 0 đến 9. Số lượng nhân vật quan trọng sau khi dấu thập phân có thể đạt được giá trị của 15. Ví dụ: 27,12-1.0 2.5001-765456.0 198732.07 0.123456789012345 Các giá trị của đôi loại có thể dao động từ-1.7 * e-308 để 1,7 * e308. Trong bộ nhớ máy tính, các giá trị của hằng số và biến đôi loại mất 8 byte.Một ví dụ của việc sử dụng một biến đôi loại trong một chương trình: 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.Một ví dụ của việc sử dụng một biến bool loại trong một chương trình: bool aa = True; Boolean biến аа có giá trị thật sự bool B17 = TRUE; Boolean biến B17 có giá trị thật sự bool Hamma = 1; Boolean biến Hamma có giá trị thật sự bool Asd = False; Boolean biến Asd có giá trị của sai bool Nol = FALSE; Boolean biến Nol có giá trị của sai bool Prim = 0; Boolean biến Prim có giá trị của sai Loại ChuỗiGiá trị của chuỗi loại là một giá trị đại diện như là một tập các ký tự ASCII.Trong cuộc sống hàng ngày của chúng tôi, một nội dung tương tự thuộc về, ví dụ: cửa hàng tên, làm cho xe hơi, vv. Một giá trị chuỗi-loại được ghi lại như là một tập các ký tự đặt trong daáu ngoaëc (không phải được trộn lẫn với dấu ngoặc kép gấp đơn!). Dấu ngoặc kép được sử dụng chỉ để đánh dấu sự khởi đầu và cuối của một chuỗi liên tục. Giá trị chính nó là tổng thể của nhân vật đóng khung bởi các dấu ngoặc kép.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 charactersLoại màuGiá trị màu loại là một giá trị màu.Ý nghĩa của 'màu sắc' (màu xanh, đỏ, trắng, vàng, xanh lá cây, vv) là phổ biến kiến thức. Nó là dễ dàng để hình dung những gì một biến hoặc một hằng số loại màu sắc có nghĩa là. Nó là một hằng số hoặc một biến, giá trị trong đó là một màu sắc. Nó có vẻ là một chút không bình thường, nhưng nó là rất đơn giản, nói chung. Giống như giá trị của một liên tục số nguyên là một số, giá trị của một liên tục màu là một màu sắc.Các giá trị của hằng số màu sắc và các biến có thể được thể hiện là một trong ba loại:LiteralsGiá trị của loại màu sắc đại diện như một chữ bao gồm ba phần đại diện cho các giá trị số của cường độ của ba màu cơ bản: màu đỏ, màu xanh lá cây và màu xanh (RGB). Giá trị của loại này bắt đầu với 'C' và được trích dẫn bởi duy nhất báo giá.Các giá trị số của cường độ RGB nằm trong khoảng từ 0 đến 255 và có thể được ghi lại cả hai decimally và hexadecimally.Ví dụ: C'128, 128, 128' (màu xám), C'0x00, 0x00, 0xFF' (màu xanh), C'0xFF, 0x33, 0x00' (màu đỏ).Số nguyên đại diệnSố nguyên đại diện được ghi lại như là một hệ thập lục phân hoặc một số thập phân. Một số hệ thập lục phân được hiển thị như 0xRRGGBB nơi RR là giá trị của màu đỏ cường độ, GG - màu xanh lá cây, và BB - màu xanh. Hằng số thập phân không được phản ánh trực tiếp trong RGB. Họ đại diện cho giá trị thập phân của một đại diện thập lục phân số nguyên.Đại diện của các giá trị màu kiểu số nguyên và 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 ©2024 I Love Translation. All reserved.

E-mail: