How to set up advanced parameters for Deriv’s trading bot

In our previous blog, we went through the DBot fundamentals, such as setting up mandatory blocks and running a simple strategy to trade options and multipliers with DBot. 

Now let’s see how you can customise the mandatory blocks even further to upgrade your trading strategy.

Each block of your strategy has slots that can be filled with additional and more accurate instructions to your bot. Here are the three main actions that will help to add this information:

1. Set up your variables

In the trading automation world, variables are like boxes where important information is stored. For example, if you want to use your stake value somewhere else in the strategy, and not only in the ‘Trade parameters’ block, you can create your own block for it.

The first crucial thing to remember when working with variables is to name them properly and keep them organised because it makes it easier to find and place them correctly the next time you need them. It’s just like labelling the boxes when you are moving. Having all your books in the box that says ‘Books’ will save you lots of time when it comes to unpacking.

As English is a widely used language in programming, it’s a common practice to name the variables of trading bots in English too. Plus, if you ever need help from our customer service, it will be much easier to assist you if the details of your DBot strategy are easy to read and understand.

To create a variable, go to the ‘Utility’ tab on the left-hand side of the DBot’s dashboard, and click ‘Variables’. Type in the name of the variable you want to create, e.g. ‘Current stake’ and click ‘Create’. 

3.1. Create New Variable on D Bot – Deriv's Trading Bot

The new variable you have just created will appear in the same window and will be available in two versions:

3.2. New Variable on D Bot – Deriv's Trading Bot

The first one is used to define your preferred stake amount once, while the second one can be used at any other part of your strategy and will represent this amount.

So, if you use the ‘Current stake’ block in multiple places of your strategy, you don’t have to edit the number in every single place manually. For example, you can set a rule to sell your contract only if your profit is bigger than your stake, and this variable will tell your bot which number to use as your stake amount. 

2. Assign a value to your variable

To tell your bot your stake amount, you need to assign a value to your ‘Current stake’ variable.

You can put different kinds of information into your variables, just like boxes can be filled with different items. The label you put on the box indicates what type of content is inside and how it should be handled. A box of china, for example, needs extra care, while a box of paperwork is not as fragile. 

In trading, the process of putting information into variables is called assigning a value, and the labels are referred to as data types. Different fields require different data types, and when you assign a certain type to your variable, it tells your bot how to handle it. There are many varieties of data types, but with DBot, you will only use 3:

  • Text – letters only
  • Numbers – numeric symbols only
  • Boolean – a logical value with true or false sequence

When you assign a specific data type to your variable, DBot identifies it implicitly. It means that if you try to enter numeric symbols into the text field or vice versa, it will trigger an error message.

To assign a value to your variable, you need to drag your newly created ‘Current stake’ variable that has the empty slot in it and drag it to your workspace.

3.3. New Variable on The Workspace of D Bot – Deriv's Trading Bot

Since the ‘Current stake’ variable can only be defined by a number, you need to assign a numeric value to it. 

Click the ‘Utility’ tab once again, and then click ‘Math’. 

Select the block under the ‘Number’, and drag it to your ‘Current stake block on the workspace, attaching it to the blank slot. 

Your current stake now equals zero. You can change it to any number you want by typing it inside the block. 

3.4. Assigning A Value to The New Variable on D Bot – Deriv's Trading Bot

If you were to assign a text value to your variable, you would need to do the same thing, but choose the ‘Text’ tab instead of ‘Math’. With the help of text, you can create a custom notification for yourself, for example, notifying you that you gained profit.

Notify Block on D Bot – Deriv's Trading Bot

And a variable with the boolean data type can be a part of more complex instructions for your bot:

If Then Bloc on D Bot – Deriv's Trading Bot

3. Set up your operations

After creating your custom variables, you need to instruct your bot on what to do with them with the help of operations – the blocks that allow your trading bot to perform certain actions. Here are the main types of operations available on DBot:

Mathematical operations

This type of operation can be found under the same ‘Math’ tab. It performs different kinds of calculations, such as comparing numbers, sum, round, and other more complex actions.

3.5. Mathematical Operations on D Bot – Deriv's Trading Bot

Operations with text

These operations can be found under the ‘Text’ and ‘Notifications’ tabs and are mainly used to join text variables together. For example, you can set a custom notification that will pop up when you’ve gained profit. 

3.6. Text Operations on D Bot – Deriv's Trading Bot

3.7. Notifications Tab on D Bot – Deriv's Trading Bot

Logical operations

Logical operations are one of the most commonly used blocks as they set the logic of the strategy. These blocks can be found under the ‘Logic’ tab and are usually based on the if/then pattern. The most popular logical operation is the Conditional block. You can set up your ‘Sell conditions’ block with the Conditional block, instructing your bot to sell the contract at a market price.

3.8. Logical Operations on D Bot – Deriv's Trading Bot

Regardless of its purpose, each operation block requires variables to function. You can create as many as you need, following our instructions above, and simply drag them into the block you are building.

Once you get more comfortable with the variables and operations, you can use them to customise your mandatory blocks or set up your optional blocks, which we will discuss in our How to set up optional parameters to enhance your DBot strategy blog.

For now, you can always practice on your risk-free demo account with 10,000 USD of virtual currency. But just like with trading on any other platform, the crucial part of any strategy is to understand when is the best time to buy or sell an asset.