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.
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.
Logical operationsAlmost 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**.
Conditional blocksProbably 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.
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.