Official blocks: Trade definition (the 1. Trade parameters block)

Guide to the 1. Trade parameters block and every block inside it, in plain words: market, trade type, contract type, duration, stake, multipliers and more.

Every bot you build in the Bot Builder is made of four big boxes called root blocks. The first one is 1. Trade parameters. It is where you tell the bot what to trade (the market), how to trade it (the trade type and contract type), and for how long and for how much money (the Trade options block). In the menu on the left these blocks sit under "Trade parameters". A fresh Bot Builder already has this box filled in, so most of the time you only change the choices.

A few words used all through this guide. A tick is one price update from a market (they arrive about every second or two, depending on the market). A contract is one single trade that you buy. The stake is the money you put into one contract. The payout is the money Deriv pays you if the contract wins (it includes your stake). A barrier is a price level the contract is judged against. A proposal is Deriv's live price offer for a contract.

How a bot runs, step by step. The four root blocks run in a fixed order, and then the bot goes around again:

  1. Start. The bot connects, then runs everything in "Run once at start:" one time only.
  2. 1. Trade parameters. At the start of every round the bot reads the Trade options block (duration, stake and so on). Because it is read again each round, you can change the stake from one round to the next with a variable.
  3. 2. Purchase conditions. The bot waits for a new tick, then runs this box. It runs again on every new tick until a Purchase block runs.
  4. Purchase. The bot buys the contract.
  5. 3. Sell conditions. While the contract is open, the bot runs this box on every update of the contract. It is optional. A Sell at market price block inside it can close the contract early. If you leave it empty, the contract simply runs until it ends.
  6. 4. Restart trading conditions. When the contract has ended, the bot runs this box once. If it reaches a Trade again block, the bot goes back to step 2 and a new round starts. If it does not, the bot stops.

A bot needs the 1. Trade parameters box, a 2. Purchase conditions box with a Purchase block in it, and a Trade options block that matches the trade type. If one of them is missing or switched off, the bot will not start and the journal says which one. Each of the four root blocks can only be used once.

1. Trade parameters

  • Kind: Official (Deriv)
  • Type id: trade_definition
  • Shape: Root block (a big box with no notch above or below; other blocks go inside it)
  • Where it goes: On its own on the workspace. Only one copy is allowed. It cannot be deleted, and it is already there in a fresh Bot Builder.
  • What it does: Holds all the settings of your trade. It decides which market is traded, which kind of contract is bought, and what happens when something goes wrong. It also holds the stake and duration through the Trade options block.
  • Inputs:
    • The first group (no title) is six locked blocks: Market, Trade Type, Contract Type, Default Candle Interval, Restart buy/sell on error, Restart last trade on error (described below).
    • Two slots: "Run once at start:" (blocks that run one time when the bot starts, such as setting a variable to your first stake) and "Trade options:" (the Trade options block of your trade type).
  • How it works: When the bot starts, it reads your choices and tells the trade engine which market, contract types and candle interval to use, and the two restart switches. Then it runs the "Run once at start:" blocks. At the start of every round it runs the Trade options block, which sends the stake and duration. If you pick "Both" as the contract type, the bot prepares both sides of the trade.
  • Example: A digits bot with a first stake set once, then 5 ticks and a stake of 1.
┌─ 1. Trade parameters ────────────────────────────┐
│ Market: [ Derived ▾ ] > [ Continuous Indices ▾ ] │
│         > [ Volatility 100 Index ▾ ]             │
│ Trade Type: [ Digits ▾ ] > [ Even/Odd ▾ ]        │
│ Contract Type: [ Both ▾ ]                        │
│ Default Candle Interval: [ 1 minute ▾ ]          │
│ Restart buy/sell on error (disable for better    │
│   performance): ☐                                │
│ Restart last trade on error (...): ☑             │
│ Run once at start:                               │
│   set [ stake ▾ ] to ( 1 )                       │
│ Trade options:                                   │
│   Duration: [ Ticks ▾ ] ( 5 )                    │
│   Stake: USD ( 1 )                               │
└──────────────────────────────────────────────────┘
  • Good to know:
    • You must be logged in. If not, the bot stops with "Please log in".
    • Only blocks whose type starts with trade_definition_ can sit in the locked group. Anything else is pushed out. If a mandatory block is missing or disabled, the journal says so, for example "The Trade parameters block is mandatory and cannot be deleted/disabled."

Market

  • Kind: Official (Deriv)
  • Type id: trade_definition_market
  • Shape: Action block (a locked helper block)
  • Where it goes: The first slot inside 1. Trade parameters. It is locked: you cannot move it, delete it or disable it. If you drag it out, it jumps back.
  • What it does: Chooses the market the bot watches and trades. You pick in three steps: the market, then the submarket, then the symbol. The symbol is the exact price feed, such as Volatility 100 Index.
  • Inputs:
    • Market dropdown (for example Derived, Forex). The choices come from Deriv's live list.
    • Submarket dropdown (for example Continuous Indices). It refills when you change the market.
    • Symbol dropdown (for example Volatility 100 Index). It refills when you change the submarket.
  • How it works: The block makes no code of its own. The symbol you pick is handed to the trade engine when the bot starts, and the bot then follows the ticks of that symbol. When you change the symbol, the chart switches to it, and the Trade Type list is refreshed to what Deriv offers on that symbol.
  • Example: Picking a Volatility index.
┌─ Market ─────────────────────────────────────────┐
│ Market: [ Derived ▾ ] > [ Continuous Indices ▾ ] │
│         > [ Volatility 100 Index ▾ ]             │
└──────────────────────────────────────────────────┘
  • Good to know:
    • A few Deriv markets are hidden in this builder (the energy group and four forex pairs).
    • The lists load from Deriv. If you are offline, the dropdowns may be empty until you are connected.
    • If the bot starts with no symbol, it stops with "Underlying market is not selected".

Trade Type

  • Kind: Official (Deriv)
  • Type id: trade_definition_tradetype
  • Shape: Action block (a locked helper block)
  • Where it goes: Second slot inside 1. Trade parameters. Locked like Market.
  • What it does: Chooses the kind of trade, in two steps: a category (such as Up/Down, Digits, Multipliers, Accumulators) and then the trade type inside that category (such as Rise/Fall, Even/Odd, Over/Under, Matches/Differs). A trade type is a pair of opposite contracts.
  • Inputs:
    • Category dropdown. The categories Deriv can name here are Up/Down, Touch/No Touch, In/Out, Asians, Digits, Reset Call/Reset Put, High/Low Ticks, Only Ups/Only Downs, Call Spread/Put Spread, Multipliers and Accumulators. You only see the ones offered on your market.
    • Trade type dropdown. It refills when you change the category.
  • How it works: The trade type decides which contracts exist, so it also decides what the Contract Type list, the Purchase dropdown and the Trade options block show. For example, Digits trades get a Prediction box in Trade options, and Multipliers and Accumulators swap the Trade options block for their own block.
  • Example: Even/Odd digits.
┌─ Trade Type ──────────────────────────────┐
│ Trade Type: [ Digits ▾ ] > [ Even/Odd ▾ ] │
└───────────────────────────────────────────┘
  • Good to know:
    • After you change the trade type, check the Trade options block again. Its boxes change to match.
    • A trade type that Deriv has no durations for on your market is left out of the list.

Contract Type

  • Kind: Official (Deriv)
  • Type id: trade_definition_contracttype
  • Shape: Action block (a locked helper block)
  • Where it goes: Third slot inside 1. Trade parameters. Locked like Market.
  • What it does: Chooses which side of the trade the bot can buy. A trade type is a pair, such as Even and Odd. You can allow one side only, or "Both".
  • Inputs:
    • Contract type dropdown. When the trade type has two sides, "Both" comes first, then each side (for example Even, Odd). Multipliers offer Up and Down. Accumulators offer Buy. If nothing is available it shows "Not available".
  • How it works: If you pick one side, the bot prepares only that contract and the Purchase block can only offer that side. If you pick "Both", the bot prepares both contracts, and the Purchase block can buy either.
  • Example: Both sides allowed.
┌─ Contract Type ──────────────────────────┐
│ Contract Type: [ Both ▾ ]                │
└──────────────────────────────────────────┘
  • Good to know:
    • Deriv's own hint: if the contract type is "Both", the Purchase conditions should include both sides, using an if block.
    • Changing the trade type resets this list.

Default Candle Interval

  • Kind: Official (Deriv)
  • Type id: trade_definition_candleinterval
  • Shape: Action block (a locked helper block)
  • Where it goes: Fourth slot inside 1. Trade parameters. Locked like Market.
  • What it does: Sets the candle size the bot uses when a candle block is left on "Default". A candle sums up the price over a period of time with four numbers: open, high, low and close.
  • Inputs:
    • Interval dropdown: 1 minute, 2 minutes, 3 minutes, 5 minutes, 10 minutes, 15 minutes, 30 minutes, 1 hour, 2 hours, 4 hours, 8 hours, 1 day. A fresh builder starts on 1 minute.
  • How it works: The chosen interval is passed to the trade engine at start. Candle blocks that are set to "Default" then ask for candles of this size. If you pick a size on the candle block itself, that choice wins.
  • Example:
┌─ Default Candle Interval ────────────────┐
│ Default Candle Interval: [ 5 minutes ▾ ] │
└──────────────────────────────────────────┘
  • Good to know:
    • It does not change how long your trade lasts. That is the Duration in Trade options.
    • It only matters if your bot uses candle blocks.

Restart buy/sell on error (disable for better performance)

  • Kind: Official (Deriv)
  • Type id: trade_definition_restartbuysell
  • Shape: Action block (a locked helper block)
  • Where it goes: Fifth slot inside 1. Trade parameters. Locked like Market.
  • What it does: A tick box. When it is on, the bot tries to recover if buying or selling fails because of a price problem, instead of stopping.
  • Inputs:
    • Check box. It starts unticked (off).
  • How it works: When it is on, the bot keeps a saved copy of where it was when it reached Purchase conditions and Sell conditions. If the buy fails with "price moved" or "invalid contract proposal" (Deriv's price changed before the order was accepted), or if a sell fails, it waits a few seconds (longer after each try, up to 15 seconds), goes back to that saved point and tries again with fresh prices. When it is off, those problems are not retried: the bot stops. Connection drops, rate limits and closed markets are always waited out and retried.
  • Example:
┌─ Restart buy/sell on error ───────────────────┐
│ Restart buy/sell on error (disable for better │
│   performance): ☑                             │
└───────────────────────────────────────────────┘
  • Good to know:
    • The label itself warns that the saved copies make the bot slower. Leave it off unless you need it.
    • It is not a guarantee that a trade will be bought.

Restart last trade on error (bot ignores the unsuccessful trade)

  • Kind: Official (Deriv)
  • Type id: trade_definition_restartonerror
  • Shape: Action block (a locked helper block; it is the last one, with nothing below it)
  • Where it goes: Sixth and last slot inside 1. Trade parameters. Locked like Market.
  • What it does: A tick box. When it is on, a normal error does not stop the bot. The bot drops the failed trade and starts the round again.
  • Inputs:
    • Check box. It starts ticked (on).
  • How it works: When an error happens and the box is ticked, the bot shows the error in the journal, closes its connections, reconnects, and restarts from the Trade options block using the state saved at the start of the round. The unsuccessful trade is ignored. If the box is not ticked, the error stops the bot.
  • Example:
┌─ Restart last trade on error ────────────────┐
│ Restart last trade on error (bot ignores the │
│   unsuccessful trade): ☑                     │
└──────────────────────────────────────────────┘
  • Good to know:
    • Some errors always stop the bot, even with the box ticked. Examples: not enough balance, invalid token, a daily loss limit reached, a stake or payout in the wrong format, and "price moved".
    • Restarting after an error does not repair a bad strategy. Read the journal.

Trade options

  • Kind: Official (Deriv)
  • Type id: trade_definition_tradeoptions
  • Shape: Action block
  • Where it goes: In the "Trade options:" slot of 1. Trade parameters. One only, with nothing below it. It is used for every trade type except Multipliers and Accumulators.
  • What it does: Sets how long each contract lasts and how much you stake. For some trade types it also shows a Prediction box or Barrier boxes.
  • Inputs:
    • Duration unit dropdown: the units Deriv allows for your market and trade type (Ticks, Seconds, Minutes, Hours, Days). If Deriv's list does not arrive, the builder falls back to: Ticks 1 to 10, Seconds 15 to 3600, Minutes 1 to 1440, Hours 1 to 24, Days 1 to 365.
    • Duration number (a value socket). A fresh builder has 5.
    • Stake number (a value socket), with the currency of your account written before it. A fresh builder has 1. The allowed range is written next to it as "(min: ... - max: ...)".
    • Prediction (Digits trades only): the digit you pick, in a value socket. The allowed digits come from Deriv.
    • Barrier, or High barrier and Low barrier (trade types that need a price level): a dropdown (Offset +, Offset -, or Absolute where allowed) and a number. An offset is a distance from the entry price, an absolute is a fixed price.
  • How it works: At the start of each round the bot reads the boxes and sends the order details to the trade engine. The stake is rounded to the decimals of your currency (for example 2 for USD), so a stake like 12.232323 becomes 12.23. The bot buys on a stake basis.
  • Example: An Over/Under bot with a prediction.
┌─ 1. Trade parameters ────────────────────┐
│ Trade options:                           │
│   Duration: [ Ticks ▾ ] ( 5 )            │
│   Stake: USD ( 1 )                       │
│   Prediction: ( 4 )                      │
└──────────────────────────────────────────┘
  • Good to know:
    • The bot refuses to run with a bad stake or duration and tells you why, for example "Please enter a stake amount that's at least ...", "Maximum payout allowed is ...", "Amount must be a positive number." or "Duration value is not allowed. To run the bot, please enter a value between ... to ...".
    • If you choose Multipliers or Accumulators as the trade type, this block swaps itself for the matching block. Going back swaps it again.
    • A number with a leading zero (like 05) is tidied to 5.
    • Older saved bots may hold a hidden twin of this block, shown next as "Trade options (Payout version)".

Multiplier trade options

  • Kind: Official (Deriv)
  • Type id: trade_definition_multiplier
  • Shape: Action block
  • Where it goes: In the "Trade options:" slot of 1. Trade parameters, only when the trade type is Multipliers. One only, with nothing below it.
  • What it does: Sets the multiplier and the stake for a Multipliers trade. A multiplier contract makes your profit or loss move faster than the price, by the number you pick. It has a slot for Take Profit and Stop loss blocks.
  • Inputs:
    • Multiplier dropdown: the values Deriv offers for your market. If none arrive, the list shows 100, 200, 300, 500 and 1000.
    • Stake number, with the account currency written before it.
    • A slot inside for the Take Profit (Multiplier) and Stop loss (Multiplier) blocks. Each can be used once.
  • How it works: At the start of each round the bot sends the multiplier, the stake (rounded to the currency's decimals), and the Take Profit and Stop loss limits (rounded to 2 decimals) to the trade engine. A limit whose number is 0 or less is switched off and is not sent.
  • Example:
┌─ 1. Trade parameters ────────────────────┐
│ Trade options:                           │
│   Multiplier: [ 100 ▾ ]                  │
│   Stake: USD ( 1 )                       │
│     Take Profit: USD ( 2 )               │
│     Stop Loss: USD ( 1 )                 │
└──────────────────────────────────────────┘
  • Good to know:
    • Choosing another trade type swaps this block for Trade options.
    • Take Profit and Stop loss are limits you accept on one contract. They are not a promise of profit.
    • The same stake checks as in Trade options apply (positive number, minimum stake).

Take Profit (Multiplier)

  • Kind: Official (Deriv)
  • Type id: multiplier_take_profit
  • Shape: Action block
  • Where it goes: Inside Multiplier trade options, in its inner slot. Used once. Outside that block it is switched off automatically.
  • What it does: Closes the contract automatically when your profit reaches this amount or more. It works with the Multipliers trade type only.
  • Inputs:
    • Amount number (a value socket) with your account currency written before it. A new block starts at 0, which means "off".
  • How it works: The amount is rounded to 2 decimals and sent with the order. If the number is 0 or less, the block is greyed out and nothing is sent.
  • Example:
┌─ Multiplier trade options ───────────────┐
│ Multiplier: [ 100 ▾ ]                    │
│ Stake: USD ( 1 )                         │
│   Take Profit: USD ( 2 )                 │
└──────────────────────────────────────────┘
  • Good to know:
    • The number must be positive, or the journal says "Take profit must be a positive number."
    • Take Profit only closes a contract that is winning. It is not a safety net against losses.

Stop loss (Multiplier)

  • Kind: Official (Deriv)
  • Type id: multiplier_stop_loss
  • Shape: Action block
  • Where it goes: Inside Multiplier trade options, in its inner slot. Used once. Outside that block it is switched off automatically.
  • What it does: Closes the contract automatically when your loss reaches this amount or more. It works with the Multipliers trade type only. On the block it reads "Stop Loss".
  • Inputs:
    • Amount number (a value socket) with your account currency written before it. A new block starts at 0, which means "off".
  • How it works: The amount is rounded to 2 decimals and sent with the order. Deriv watches the contract and closes it when the loss reaches the amount. If the number is 0 or less, the block is greyed out and nothing is sent.
  • Example:
┌─ Multiplier trade options ───────────────┐
│ Multiplier: [ 100 ▾ ]                    │
│ Stake: USD ( 1 )                         │
│   Stop Loss: USD ( 1 )                   │
└──────────────────────────────────────────┘
  • Good to know:
    • The number must be positive, or the journal says "Stop loss must be a positive number."
    • It limits the loss you accept on one contract. It cannot stop other losses, such as many contracts in a row.
    • "Not confirmed in the code": whether Deriv can close a contract at a slightly worse price than the amount you set.

Accumulator trade options

  • Kind: Official (Deriv)
  • Type id: trade_definition_accumulator
  • Shape: Action block
  • Where it goes: In the "Trade options:" slot of 1. Trade parameters, only when the trade type is Accumulators. One only, with nothing below it.
  • What it does: Sets the growth rate and the stake for an Accumulators trade. An accumulator contract grows by the growth rate you pick, and Deriv decides how it ends. It has a slot for one Take Profit block.
  • Inputs:
    • Growth Rate dropdown: the rates Deriv offers, shown as percentages (for example 1%).
    • Stake number, with the account currency written before it.
    • A slot inside for the Take Profit (Accumulator) block. It can be used once.
  • How it works: At the start of each round the bot sends the growth rate, the stake (rounded to the currency's decimals) and the Take Profit limit (rounded to 2 decimals) to the trade engine.
  • Example:
┌─ 1. Trade parameters ────────────────────┐
│ Trade options:                           │
│   Growth Rate: [ 1% ▾ ]                  │
│   Stake: USD ( 1 )                       │
│     Take Profit: USD ( 5 )               │
└──────────────────────────────────────────┘
  • Good to know:
    • Choosing another trade type swaps this block for Trade options.
    • Only the Take Profit (Accumulator) block can sit in the inner slot.
    • A Take Profit of 0 means off.

Take Profit (Accumulator)

  • Kind: Official (Deriv)
  • Type id: accumulator_take_profit
  • Shape: Action block
  • Where it goes: Inside Accumulator trade options, in its inner slot. Used once. Outside that block it is switched off automatically.
  • What it does: Closes the contract automatically when your profit reaches this amount or more. It works with the Accumulators trade type only.
  • Inputs:
    • Amount number (a value socket) with your account currency written before it. A new block starts at 0, which means "off".
  • How it works: The amount is rounded to 2 decimals and sent with the order. If the number is 0 or less, the block is greyed out and nothing is sent.
  • Example:
┌─ Accumulator trade options ──────────────┐
│ Growth Rate: [ 1% ▾ ]                    │
│ Stake: USD ( 1 )                         │
│   Take Profit: USD ( 5 )                 │
└──────────────────────────────────────────┘
  • Good to know:
    • The number must be positive, or the journal says "Take profit must be a positive number."
    • It closes a winning contract at the profit you chose. It does not limit losses.

Trade options (Payout version)

  • Kind: Official (Deriv)
  • Type id: trade_definition_tradeoptions_payout
  • Shape: Action block
  • Where it goes: In the "Trade options:" slot of 1. Trade parameters, like Trade options. It is not in the menu. It exists so that older saved bots open correctly.
  • What it does: The same as Trade options, but the amount box is labelled "Payout" and the amount is treated as the payout you want, not the stake.
  • Inputs:
    • The same boxes as Trade options: duration unit, duration number, the amount, and a Prediction or Barrier box when the trade type needs one.
  • How it works: It uses the same code as Trade options. The only difference is that the order is sent on a payout basis instead of a stake basis.
  • Example:
┌─ 1. Trade parameters ────────────────────┐
│ Trade options:                           │
│   Duration: [ Minutes ▾ ] ( 5 )          │
│   Payout: USD ( 10 )                     │
└──────────────────────────────────────────┘
  • Good to know:
    • You will not find it in the menu. New bots use Trade options.
    • "Not confirmed in the code": whether the builder treats this block as the required Trade options block when it checks your bot before running.

Build a bot with these blocks

BRINOVS is free to open. Sign in with Deriv, open the Bot Builder, and try everything on a demo account.

Open BRINOVS

BRINOVS Digits is a free bot builder and trading page built on Deriv's Bot Builder. Trading carries risk and you can lose money. Nothing in this guide is financial advice or a promise of profit. Test every bot on a demo account first.

Guide home · Open BRINOVS