Bot fundamentals \ Operations with text, numbers, and logical values

Mathematical operations

There’s 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


DBot


Operations with text

There’s a bunch 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 how it looks like.

Binary Bot


DBot



Logical operations

Almost every trading strategy uses the logical operations. For example, a strategy can compare 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


DBot


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 the strategy flow.

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


DBot

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

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

Deriv (Investments) Europe Ltd (W Business Centre, Level 3, Triq Dun Karm, Birkirkara BKR 9033, Malta) is licensed in Malta and regulated by the Malta Financial Services Authority under the Investment Services Act to provide investment services in the European Union (licence no. IS/70156). It is also authorised and subject to limited regulation by the Financial Conduct Authority in the UK. Details about the extent of our authorisation and regulation by the Financial Conduct Authority are available from us on request.

Deriv (MX) Ltd, Millennium House, Level 1, Victoria Road, Douglas IM2 4RW, Isle of Man, is licensed and regulated in Great Britain by the Gambling Commission under account no. 39172 and by the Gambling Supervision Commission in the Isle of Man.

Deriv (Europe) Limited, W Business Centre, Level 3, Triq Dun Karm, Birkirkara BKR 9033, Malta, is licensed and regulated for synthetic indices by the Malta Gaming Authority (licence no. MGA/B2C/102/2000), by the Gambling Commission for clients in Great Britain (account no. 39495), and by the Revenue Commissioners for clients in Ireland (licence no. 1010285).

Deriv Investments (Europe) Ltd is authorised to deal on its own account and is both the manufacturer and distributor of its products.

This information is intended for Retail & Professional clients.

CFDs offered by Deriv Investments (Europe) Ltd are considered complex derivatives and may not be suitable for retail clients.They may be affected by changes in currency exchange rates; If you invest in this product you may lose some or all of the money you invest; The value of your investment may go down as well as up.
CFDs offered by Deriv Investments (Europe) ltd also come with a high risk of losing money rapidly due to leverage. 63% of retail investor accounts lose money when trading CFDs with Deriv Investments (Europe) ltd. You should consider whether you understand how CFDs work and whether you can afford to take the high risk of losing your money.

+18 Icon Please trade responsibly. For more information about responsible trading please click here.