Every strategy created with Binary Bot or DBot consists of 6 steps as shown on the diagram below. First two steps are executed only once, when a strategy starts. The following 4 steps repeat indefinitely unless user stops the strategy manually or by adding a condition to the last step. The 5th step (Sell a contract) is optional and can be removed from a strategy. If the 5th block is on the workspace, when strategy is running it keeps executing the content of the on every tick.
Steps 1, 2, and 3 are represented by the first main block.
Trade parameters is a mandatory block. Every bot will have one trade parameter block by default and you cannot add more than one trade parameter block in one bot.
Trade parameter block is responsible for the first 3 steps in the control flow:
- Selecting the market
- Assigning initial values to variables
- Setting stake, duration, barriers, and digit prediction (depending on the contract type you select)
Step 1: Trade parameters | Define you trade contract
Market & Trade Type
You can select your desired market, and asset type, and trade type you want to trade in here.
You can choose what type of contract you want to trade. For example, for the Rise/Fall trade type you can choose one of three options: Rise, Fall, or Both. If you select Rise, you won’t be able to purchase Fall in the Purchase condition block.
Default Candle Interval
This allows you to set a default time interval for blocks that read lists of candles. This is important when working with technical indicators. We’re going to cover it in the lesson about technical analysis.
Restart buy/sell on error
This block restarts the bot automatically when an error is encountered. Sometimes internet connection breaks up and the purchasing or selling contracts is unsuccessful. In this case your strategy can either start over or keep on executing. By default it is unselected for better performance.
Restart last trade on error
This block allows you to have an option to repeat the previous trade if an error is encountered during the trade. This complements the previous block. You can choose to keep trying to purchase a contract in case of an error. You can activate or deactivate as required.
Step 2: Run once at start
Almost every strategy needs to assign some initial values to variables. You can add logical blocks here as well to perform tasks which you want to run just once when your strategy starts running.
Step 3: Trade options | Define trade options
In this block you define your desired duration, stake, predictions, and barriers depending on the contract type you choose to trade. This is the essential step when setting up your trades.
Step 4:Purchase a contract | Watch and purchase your contract
In this block you can specify conditions that you set for your strategy so that it can only purchase contracts when you want it. It’s important to remember that you can only purchase one contract at a time. You want to use technical analysis to identify the right moment for purchasing. We’ll cover that later in this course.
Step 5: Sell conditions | Watch and sell your purchased contract
Some contracts can be sold before expiration. You don’t have to do that, that’s why this step is optional in the control flow, however, you can do that if you wish to.
Step 6: Restart trading conditions | Get your trade result and trade again
This step is the last one in the strategy run cycle. Binary Bot and DBot go to this step immediately after a contract expires or is sold on the Step 5.
The purpose of this step is to decide whether you want to continue trading or to stop your strategy. Typically, you would need to check your stop-loss/take-profit threshold to do so. Also, you can update some variables depending on the result of the previously purchased (and expired) contract.
Here’s the example. Please note that this example is for educational purposes, it’s created to demonstrate bot run cycle. Please use your best judgement when trading.