Creating a basic trading strategy gives you a fully functional trading bot. Once you set up your mandatory blocks and throw in a few advanced parameters, your DBot can perform trades on your behalf automatically.
But there is more to it. You can enhance your strategy by setting up the optional Sell conditions block and including additional instructions to the mandatory Restart trading conditions block.
Before we jump into the details of how you can do it, here is a quick tip to make your DBot journey much easier: use the search bar to find the blocks you need.
The search bar is located in the top left corner and can save you a lot of time if you don’t remember the exact location of each block in the menu. Just type in its name, and pick it from the search results.
Set up the optional Sell conditions block
You may remember that we already mentioned the Sell conditions block briefly when we were going through the process of setting up mandatory blocks. This block lets you sell your contract before it expires.
There are two main reasons to sell your contract before its expiration:
- To secure your profit: if your trade is winning, and you don’t want to risk losing your profit if the price starts moving against your prediction.
- To cut your loss: if your trade is losing, and you want to protect yourself from losing more if the price keeps moving against your prediction.
In a way, this feature is similar to take profit and stop loss, as it allows you to secure potential profits and cut potential losses. But unlike take profit and stop loss on DBot, which can only be applied once a contract is closed, the Sell conditions block can sell your contract while your trade is still running.
Bear in mind that not all contracts can be sold — it depends on various factors — such as asset’s type or the trade duration (for example, tick contracts can’t be sold). Once a contract is purchased, you’ll see the ‘Sell’ button in your trade summary on the right if you can sell the contract or the ‘Resale not offered’ message if you can’t.
Here is how you instruct DBot to sell your contract:
1. Click the ‘Analysis’ tab, then the ‘Contract’ subtab, and select the ‘Sell profit/loss’ block. This block calculates how much profit or loss you could make after selling your contract.
2. Set up the following instructions to tell your bot to sell the contract at a market price if such an option is available, and only if the profit is more than 1 USD.
You can adjust the number anytime to match your own strategy. Alternatively, you can replace the number with the ‘Stake amount’ variable, which will instruct your bot to sell your contract if the profit from the sale is higher than your stake.
Set up take profit and stop loss
Unlike other platforms, where a contract is closed upon reaching take profit or stop loss level, DBot can compare results of every trade with take profit/stop loss amounts and then decides whether to continue or stop trading. To teach your bot how to make this comparison, you need to set the following instructions:
- Create ‘Trade result’, ‘Stop loss’, and ‘Take profit’ variables.
- Place 3 ‘Set’ blocks into the ‘Run once at start’ section of the ‘Trade parameters’ mandatory block, and select one of the variables you have just created in each one of them.
- Assign values to your new variables: 0 for the ‘Trade result’ and your preferred amounts for ‘Stop loss’ and ‘Take profit’.
- Set up the following parameters using the same 3 variables, along with ‘Change’, ‘Contract details’, ‘Conditional’, and ‘Compare’ blocks.
These instructions will tell your bot to compare the results of each trade against the stop loss and take profit amounts you set up. The bot will stop trading if your trade result exceeds your take profit level or surpasses your stop loss level. Otherwise, it will continue opening trades.
Once you have all these parameters set and the mandatory parameters, your trading bot will be able to perform a full cycle strategy – buy a contract, sell it, and continue or stop trading.
But you can improve your bot even further and teach it how to analyse markets and determine the best time to buy a contract. Let’s move on to our How to use technical analysis with Deriv’s trading bot to find out more.
Meanwhile, you can always practice setting up your strategy with your risk-free demo account pre-loaded with virtual currency – practice makes perfect!