Detected Country () : English
Data Type And Variable -

Welcome to CodingForex.Com!

Knowledge portal where you can learn how to create forex indicators and robot.

Click button below to choose level that suite you:

Data Type And Variable

Level Newbie [2017-11-02 13:18:51] - by hillzx
Featured Image

If you want to learn a programming language, whatever the language type, you have to use a variable, because the variable is something to accommodate data or information in programming.

Simply we assume that the variable is a container, take the example image above (the glass), the glass can be filled by the data, this time the data is water.

We have 3 glasses, the first glass is empty, the glass is half-filled, the third glass is full. If we write in MQL will be like this :


gelas1 = 0;
gelas2 = 0.5;
gelas3 = 1;

OK .. But in reality, the data is kind of different. Data is not always a number, data is sometimes a combination of letters + numbers + symbols. Officially MQL introduces several types of data that can be used (official link) but there are some important data types known, such data types include:

  1. integer (numbers are not decimals, do not use commas)
  2. boolean (true & false)
  3. string (a combination of letters + character + number), eg "I", "aku123", "haha + hihi + 888", each data string must be enclosed by quotation marks
  4. double (decimal numbers, use commas)
  5. color (color), example Blue, Red, Green
  6. datetime (day month year hour minute second)
  7. enum (enumeration variable)

Here's an example of how to create a variable:


string nama;
int nomorsepatu;
bool menikah;
color warnarambut;
datetime tanggallahir;
double tinggibadan;

nama = "Mas HiLLzX";
nomorsepatu = 45;
menikah = true;
warnarambut = Black;
tanggallahir=D'1985.07.19 12:30:27';  // Year Month Day Hours Minutes Seconds

Congratulation! You have finished this article.

- Provided by HiLLzSoft Studio -