Working with types

All user data is stored as numeric representations. Let's add the "print debug info" block to the robot scheme, place the "value input" block into this block and enter some text. We will link the "print debug info" block with the "robot launch":

Let's launch our robot and see what has been printed to the terminal journal

The entered text has been transformed into a number. Each string value is assigned a unique and random numeric representation, that is, our text will have a different numeric representation each time the robot is launched.

All string values and their numeric representations are stored in the robot's memory. With the help of special blocks, we can explicitly indicate in which format we want to represent the value.

There are 4 blocks in total, with which you can explicitly set the format of values:

Regular string

Converts a value to a regular string

Date and time format string

Converts a value to date and time format

Integer number

Converts a value to an integer


Converts a value to a fraction

Let's put the "Regular string" format block on the "value input block":

Теперь мы явно указали, что хотим вывести текст как есть, без всяких конвертаций:

Now we've explicitly specified the format in which the value must be represented:

The need for type convertion blocks is due to the fact that MQL5 is a strongly typed programming language. This means that a variable can store a value of a specific type. Therefore, in BotBrains, all custom values are converted to the double type (fractional number).

Number of decimal places for fractional numbers

У блока приведения к типу "Дробное число" есть один параметр - количество знаков после запятой:

"Fraction" format type block has one parameter - decimal places:

Quite often, the values have many decimal places, most of which are not required. With this setting, only a limited number of decimal places can be left.

Last updated