Bot fundamentals / operations with text, numbers, and logical values

Hi Deriv Community,

Here’s a simple guide on Bot fundamentals/operations with text, numbers, and logical values.

Mathematical operations

There’s a whole set of blocks to perform mathematical operations on variables in Binary Bot and DBot. Those blocks are available under the Math section in the Blocks menu.

Binary Bot



Operations with text

There is a lot of things you can do with text in Binary Bot and DBot including adding strings, splitting strings, converting them to upper or lower case, trimming spaces, etc. But the most commonly used block is the one that allows you to join strings together. Here’s what it looks like.

Binary Bot


Logical operations

Almost every trading strategy uses logical operations. For example, a strategy can compare the current price with the signal provided by a technical indicator to make a decision to purchase or sell contracts. The result of any logical operation is the logical value. In programming, the logical value is called Boolean value and can take one of two possible values - True or False.

Binary Bot


Conditional blocks

Probably the most important blocks in Binary Bot and DBot. It is used by all strategies. It helps Bots to be smarter and be able to make decisions about purchasing contracts and controlling the strategy flow.

Conditional blocks allow you to perform different operations depending on the condition you specify.


In this example, the bot will perform only one of 3 possible operations depending on the value of the current stake.

  • If the current stake is strictly less than 1, increase the current stake by 1.
  • If the current stake is strictly greater than 2, set the current stake to 2.
  • In any other case, send a Text message to Journal.

Note: Please be reminded that these options are only available for Dbot and Binary Bot on desktop not on mobile.

If you have any questions, please visit our Help Centre or contact us via Live Chat and WhatsApp.