Official blocks: Tick and candle analysis

Every Deriv block that reads market ticks, last digits, accumulator stats and candles, plus the block that runs your own checks on every single tick.

Official blocks: Tick and candle analysis

This group of blocks lets your bot look at the market itself, before and between trades. A tick is one price update of a market. A candle is a summary of the price over a fixed slice of time, such as one minute. Each candle holds four prices: Open (the first price), High (the highest), Low (the lowest) and Close (the last), plus the Open Time (the moment the candle began, given as a count of seconds).

In the Bot Builder you find these blocks under Analysis, in the sub-menu called Tick and candle analysis. Most of them are value blocks: they give you a number, a list of numbers or a candle, and you plug them into other blocks (for example into an if test, or into the Input List of an indicator). One block, Run on every tick, is a section of its own that holds your action blocks.

All of these blocks use the market and the candle size you chose in Trade parameters. The bot reads up to the latest 1000 ticks (or 1000 candles) from Deriv, oldest first and newest last. Where a block says "Default" for the candle interval, it means the candle size chosen in Trade parameters (60 seconds, one minute, if none is chosen).

These blocks only describe the past. They do not know what the market will do next, and nothing here protects your stake.

In a running bot, Run on every tick runs at the start of each round of the bot's loop (before the purchase conditions are checked, while a contract is open, and after it ends). The value blocks run at the moment the block they sit in runs.

A tip for lists: the "Make a list of..." blocks and the "Candles List" block give you lists. The indicator blocks (see the Indicators section of this guide) take such a list as their Input List.

Run on every tick

  • Kind: Official (Deriv)
  • Type id: tick_analysis
  • Shape: Action block (a section that holds action blocks)
  • Where it goes: On the empty workspace, outside every other root block (Deriv says "Place this block outside of any root block"). You can use more than one.
  • What it does: Runs the blocks you put inside it once for every new tick, whatever the trade is doing. Use it to watch the market, keep a counter, or update an indicator, even when no contract is open.
  • Inputs:
    • The label reads "The content of this block is called on every tick". Below it is an empty space: drop your action blocks there. There are no fields to type.
  • How it works: The bot keeps a list of all the Run on every tick sections. In its main loop (while it waits to buy, while a contract runs, and after a trade) it checks the time of the newest tick. If that tick is new, it runs every section in the list once. If the tick is the same as last time, it does nothing, so your blocks never run twice for the same tick.
  • Example:
┌─ The content of this block is called on every tick ──────────┐
│ set [ last_d ▾ ] to ( Last Digit )                           │
│ if < ( last_d ) = ( 7 ) >                                    │
│ then  print ( "seven!" )                                     │
└──────────────────────────────────────────────────────────────┘

On each new tick, the bot saves the last digit in the variable last_d and prints a note when it is 7.

  • Good to know:
    • It does not buy or sell by itself. It only runs the blocks you place inside it.
    • If the market is closed, the bot waits and tries again every few seconds.
    • Everything inside runs on every new tick, so keep it light.

Last Tick

  • Kind: Official (Deriv)
  • Type id: tick
  • Shape: Value block (gives a number)
  • Where it goes: Anywhere a number is wanted. Needs a market chosen in Trade parameters.
  • What it does: Gives the price of the newest tick of your market, as a number.
  • Inputs:
    • No fields. It is just the label "Last Tick".
  • Gives back: A number, for example 1234.56. Its help name is "Last tick".
  • How it works: The bot asks for the recent ticks of the chosen market and takes the newest one. If this block sits directly inside a Notify or Print block, it gives the price as text with the right number of decimals (so 1234.50 does not lose its last zero).
  • Example:
┌─ 2. Purchase conditions ─────────────────────────────────────┐
│ if < ( Last Tick ) > ( 1234.5 ) >                            │
│ then  Purchase [ Rise ▾ ]                                    │
└──────────────────────────────────────────────────────────────┘

The bot buys Rise when the newest price is above 1234.5.

  • Good to know:
    • It is the latest price only. It says nothing about the next price.
    • If the market is closed, the block gives the text MarketIsClosed instead of a number.

Last Tick String

  • Kind: Official (Deriv)
  • Type id: tick_string
  • Shape: Value block (gives text)
  • Where it goes: Anywhere text is wanted. It is not in the Bot Builder menu; it only appears if a saved bot file contains it.
  • What it does: Gives the price of the newest tick as text, written with the market's usual number of decimals.
  • Inputs:
    • No fields. It is just the label "Last Tick String".
  • Gives back: Text, for example "1234.50". Its help name is "Tick value".
  • How it works: It does the same as Last Tick, but always turns the price into text with the right number of decimals. This keeps trailing zeros.
  • Example:
┌─ Run on every tick ──────────────────────────────────────────┐
│ print ( Last Tick String )                                   │
└──────────────────────────────────────────────────────────────┘

The bot prints the newest price with all its decimals.

  • Good to know:
    • Use Last Tick when you need to do maths or compare sizes.
    • If the market is closed, the block gives the text MarketIsClosed.

Last Digit

  • Kind: Official (Deriv)
  • Type id: last_digit
  • Shape: Value block (gives a number)
  • Where it goes: Anywhere a number is wanted. Needs a market chosen in Trade parameters.
  • What it does: Gives the last digit (0 to 9) of the newest tick price. This is the digit that Digits contracts (Matches, Differs, Even, Odd, Over, Under) are based on.
  • Inputs:
    • No fields. It is just the label "Last Digit".
  • Gives back: A whole number from 0 to 9. Its help name is "Last Digit".
  • How it works: The bot takes the newest price as text, with the market's own number of decimals, and reads its final character. So the price 1234.50 gives 0, not 5.
  • Example:
┌─ 2. Purchase conditions ─────────────────────────────────────┐
│ if < ( Last Digit ) ≥ ( 5 ) >                                │
│ then  Purchase [ Over ▾ ]                                    │
└──────────────────────────────────────────────────────────────┘

The bot buys when the newest digit is 5 or more.

  • Good to know:
    • Each digit is random from tick to tick. A digit that just appeared does not make the next digit more or less likely.
    • Zeros at the end count, because the price keeps its fixed decimals.

Current Stat

  • Kind: Official (Deriv)
  • Type id: stat
  • Shape: Value block (gives a number)
  • Where it goes: Anywhere a number is wanted. Meant for bots that trade Accumulators.
  • What it does: Gives the newest number from the "ticks stayed in" statistics that Deriv sends for Accumulators. In plain words: how many ticks in a row the price stayed inside the Accumulators range, in the latest count.
  • Inputs:
    • No fields. It is just the label "Current Stat".
  • Gives back: A number (the first entry of the stat list). It can be empty if Deriv does not answer.
  • How it works: The bot sends Deriv a price request for an Accumulators contract, using the stake, currency, growth rate and market from your Trade parameters. It waits for the answer, reads the "ticks stayed in" list, and gives back its first entry. Then it stops that request so a new call gets fresh numbers.
  • Example:
┌─ Run on every tick ──────────────────────────────────────────┐
│ set [ stay ▾ ] to ( Current Stat )                           │
└──────────────────────────────────────────────────────────────┘

On every tick the variable stay holds the latest Accumulators stat.

  • Good to know:
    • Needs a live connection to Deriv.
    • Without Accumulators set up in Trade parameters, the result is not reliable. Not confirmed in the code what you get then.
    • It makes a new request each time, so using it on every tick adds extra traffic.

Current stat list

  • Kind: Official (Deriv)
  • Type id: stat_list
  • Shape: Value block (gives a list)
  • Where it goes: Anywhere a list is wanted. Meant for bots that trade Accumulators.
  • What it does: Gives a list of the "ticks stayed in" numbers that Deriv sends for Accumulators. Each number says how long the price stayed in range before it broke out.
  • Inputs:
    • No fields. It is just the label "Current stat list".
  • Gives back: A list of numbers, starting with the newest, with at most 100 entries (the code keeps the latest 100, although the help text says 1000).
  • How it works: It works like Current Stat: it asks Deriv for an Accumulators price offer, waits for the answer, then cuts the "ticks stayed in" list to the first 100 entries. It then stops the request.
  • Example:
┌─ Run on every tick ──────────────────────────────────────────┐
│ set [ stats ▾ ] to ( Current stat list )                     │
└──────────────────────────────────────────────────────────────┘

The variable stats now holds up to 100 recent stats.

  • Good to know:
    • Needs a live connection to Deriv.
    • Use it to see how long runs usually last. It does not tell you when the next break-out will happen.

Ticks list

  • Kind: Official (Deriv)
  • Type id: ticks
  • Shape: Value block (gives a list)
  • Where it goes: Anywhere a list is wanted, for example in the Input List of an indicator. Needs a market chosen in Trade parameters.
  • What it does: Gives a list with the last 1000 tick prices of your market, oldest first and newest last.
  • Inputs:
    • No fields. It is just the label "Ticks list".
  • Gives back: A list of numbers. Its help name is "Tick list".
  • How it works: The bot asks for the recent ticks of the chosen market and keeps only the price of each one. If this block sits directly inside a Notify or Print block, the prices come out as text with the right decimals.
  • Example:
┌─ Run on every tick ──────────────────────────────────────────┐
│ set [ sma ▾ ] to Simple Moving Average                       │
│   Input List ( Ticks list )                                  │
│   Period ( 10 )                                              │
└──────────────────────────────────────────────────────────────┘

The indicator averages the latest 10 tick prices.

  • Good to know:
    • If the market has fewer than 1000 ticks of history, you get a shorter list.
    • The list is only as long as the market history that Deriv sends.

Ticks String List

  • Kind: Official (Deriv)
  • Type id: ticks_string
  • Shape: Value block (gives a list)
  • Where it goes: Anywhere a list is wanted. It is not in the Bot Builder menu; it only appears if a saved bot file contains it.
  • What it does: Gives the last 1000 tick prices as a list of text items, each written with the market's usual number of decimals.
  • Inputs:
    • No fields. It is just the label "Ticks String List".
  • Gives back: A list of text items. Its help name is "Tick List String".
  • How it works: It works like Ticks list, but every price is turned into text with the right decimals.
  • Example:
┌─ Run on every tick ──────────────────────────────────────────┐
│ print ( Ticks String List )                                  │
└──────────────────────────────────────────────────────────────┘

The bot prints all the recent prices as text.

  • Good to know:
    • Indicators need numbers. Use Ticks list for them, not this block.

Last digits list

  • Kind: Official (Deriv)
  • Type id: lastDigitList
  • Shape: Value block (gives a list)
  • Where it goes: Anywhere a list is wanted. Needs a market chosen in Trade parameters.
  • What it does: Gives a list of the last digit of each of the last 1000 tick prices, oldest first and newest last. Use it to count how often each digit showed up.
  • Inputs:
    • No fields. It is just the label "Last digits list".
  • Gives back: A list of whole numbers from 0 to 9. Its help name is "Last Digits List".
  • How it works: The bot gets the last 1000 ticks, writes each price with the market's fixed number of decimals, and takes the final digit of each one.
  • Example:
┌─ Run on every tick ──────────────────────────────────────────┐
│ set [ digits ▾ ] to ( Last digits list )                     │
└──────────────────────────────────────────────────────────────┘

The variable digits holds up to 1000 digits you can count or look through.

  • Good to know:
    • Past digits do not change the odds of the next digit. Counting them shows what happened, not what will happen.

Direction is

  • Kind: Official (Deriv)
  • Type id: check_direction
  • Shape: True/false block
  • Where it goes: Anywhere a true/false test is wanted, for example after an if. Needs a market chosen in Trade parameters.
  • What it does: Tests whether the last price move was a rise, a fall, or no change. Its help name is "Market direction".
  • Inputs:
    • Direction dropdown: Rise, Fall or No Change. The first choice in the list is Rise.
  • Gives back: True if the newest tick price compared with the one before matches your choice, otherwise false.
  • How it works: The bot looks at the last two ticks. If the newest is higher the direction is "rise", if lower it is "fall", otherwise it is "no change". It then checks that against your dropdown.
  • Example:
┌─ 2. Purchase conditions ─────────────────────────────────────┐
│ if < Direction is [ Rise ▾ ] >                               │
│ then  Purchase [ Rise ▾ ]                                    │
└──────────────────────────────────────────────────────────────┘

If the last tick moved up, the bot buys Rise.

  • Good to know:
    • It looks at only the last two ticks, so it flips often.
    • "No Change" is also the answer when there are fewer than two ticks.
    • A rise just now does not mean another rise is coming.

Is candle black?

  • Kind: Official (Deriv)
  • Type id: is_candle_black
  • Shape: True/false block
  • Where it goes: Anywhere a true/false test is wanted, except inside Trade parameters. The candle socket must be filled.
  • What it does: Tests whether a candle is "black". A black candle is one that closed lower than it opened.
  • Inputs:
    • Candle socket: plug in a candle, for example the Get candle block. Only candle blocks fit.
  • Gives back: True if the candle's Close is lower than its Open, otherwise false.
  • How it works: The bot checks that the given item is a real candle, then compares its Close with its Open. If it is not a candle, the bot stops with the error "Given candle is not valid".
  • Example:
┌─ 2. Purchase conditions ─────────────────────────────────────┐
│ if < Is candle (in candle list get # from end ( 1 )          │
│      with interval: [ 1 minute ▾ ]) black? >                 │
│ then  Purchase [ Fall ▾ ]                                    │
└──────────────────────────────────────────────────────────────┘

If the newest 1 minute candle closed below its open, the bot buys Fall.

  • Good to know:
    • A candle that closed at exactly its open price is not black.
    • The help text mentions "the last candle", but the code checks the candle you plug in.

In candles list read

  • Kind: Official (Deriv)
  • Type id: read_ohlc
  • Shape: Value block (gives a number)
  • Where it goes: Anywhere a number is wanted. Needs a market chosen in Trade parameters. The index socket must be filled.
  • What it does: Reads one price of one candle in a single step: you say which price (Open, High, Low, Close or Open Time), which candle (counted from the newest), and the candle size. Its help name is "Read candle value (1)".
  • Inputs:
    • Candle property dropdown: Open, High, Low, Close, Open Time. The menu starts with Open.
    • # from end socket: a whole number. 1 is the newest candle, 2 the one before. The menu fills it with 1.
    • with interval dropdown: Default, 1 minute, 2 minutes, 3 minutes, 5 minutes, 10 minutes, 15 minutes, 30 minutes, 1 hour, 2 hours, 4 hours, 8 hours, 1 day. The menu starts with Default.
  • Gives back: A number: the chosen price of that candle (for Open Time, the time as a count of seconds).
  • How it works: The bot gets the candle list for that size, takes the candle at your position from the end, and returns the chosen price. If you give a number that is not a positive whole number, the bot stops with "Index must be a positive integer".
  • Example:
┌─ 2. Purchase conditions ─────────────────────────────────────┐
│ if < In candles list read [ Close ▾ ] # from end ( 1 )       │
│      with interval: [ 5 minutes ▾ ] > ( 1234.5 ) >           │
│ then  Purchase [ Rise ▾ ]                                    │
└──────────────────────────────────────────────────────────────┘

If the newest 5 minute candle has a Close above 1234.5, the bot buys Rise.

  • Good to know:
    • "Default" means the candle size set in Trade parameters (60 seconds if none).
    • The newest candle may still be forming, so its Close can change.

Read ... value in candle

  • Kind: Official (Deriv)
  • Type id: read_ohlc_obj
  • Shape: Value block (gives a number)
  • Where it goes: Anywhere a number is wanted. The candle socket must be filled.
  • What it does: Reads one price from a candle that you already have, for example one given by the Get candle block. Its help name is "Read candle value (2)".
  • Inputs:
    • Candle property dropdown: Open, High, Low, Close, Open Time. The menu starts with Open.
    • Candle socket: a candle block, for example Get candle.
  • Gives back: A number: the chosen price of that candle.
  • How it works: The bot checks that the item is a real candle (with Open, High, Low, Close and Open Time) and returns the field you picked. If it is not a candle, the bot stops with "Given candle is not valid".
  • Example:
┌─ Run on every tick ──────────────────────────────────────────┐
│ set [ top ▾ ] to Read [ High ▾ ] value in candle             │
│   ( in candle list get # from end ( 2 )                      │
│      with interval: [ Default ▾ ] )                          │
└──────────────────────────────────────────────────────────────┘

The variable top holds the High of the candle before the newest one.

  • Good to know:
    • Use it when you want several prices from one candle: get the candle once, store it in a variable, then read from the variable.

Make a List of ... values in candles list with interval:

  • Kind: Official (Deriv)
  • Type id: ohlc_values
  • Shape: Value block (gives a list)
  • Where it goes: Anywhere a list is wanted, for example in the Input List of an indicator. Needs a market chosen in Trade parameters.
  • What it does: Gives one list that holds the chosen price (Open, High, Low, Close or Open Time) of every candle at the chosen size. Its help name is "Create a list of candle values (1)". The Bot Builder label reads "Make a List of {property} values in candles list with interval: {size}".
  • Inputs:
    • Candle property dropdown: Open, High, Low, Close, Open Time. The menu starts with Open.
    • with interval dropdown: Default, 1 minute, 2 minutes, 3 minutes, 5 minutes, 10 minutes, 15 minutes, 30 minutes, 1 hour, 2 hours, 4 hours, 8 hours, 1 day. The menu starts with Default.
  • Gives back: A list of numbers, oldest candle first.
  • How it works: The bot gets the candle list for that size (up to 1000 candles) and keeps only the chosen field of each candle.
  • Example:
┌─ Run on every tick ──────────────────────────────────────────┐
│ set [ sma ▾ ] to Simple Moving Average                       │
│   Input List ( Make a List of [ Close ▾ ] values in          │
│     candles list with interval: [ 1 minute ▾ ] )             │
│   Period ( 10 )                                              │
└──────────────────────────────────────────────────────────────┘

The indicator averages the Close of the latest 10 one minute candles.

  • Good to know:
    • Pick Close for most indicators. Open Time is a time stamp, not a price.

Make a list of ... values from candles list

  • Kind: Official (Deriv)
  • Type id: ohlc_values_in_list
  • Shape: Value block (gives a list)
  • Where it goes: Anywhere a list is wanted. The candle list socket must be filled.
  • What it does: Takes a candle list you already have (for example from the Candles List block) and gives one list with the chosen price of each candle. Its help name is "Create a list of candle values (2)".
  • Inputs:
    • Candle property dropdown: Open, High, Low, Close, Open Time. If empty, the code uses Open. The menu starts with Open.
    • Candles list socket: a list of candles, for example the Candles List block.
  • Gives back: A list of numbers, in the same order as the candle list.
  • How it works: The bot checks that the socket holds a list in which every item is a real candle, then picks the chosen field from each one. If not, the bot stops with "Given candle list is not valid".
  • Example:
┌─ Run on every tick ──────────────────────────────────────────┐
│ set [ highs ▾ ] to Make a list of [ High ▾ ] values          │
│   from candles list ( Candles List with interval here 2:     │
│                       [ 5 minutes ▾ ] )                      │
└──────────────────────────────────────────────────────────────┘

The variable highs holds the High of every 5 minute candle.

  • Good to know:
    • Handy if you load the candle list once and then want several kinds of price from it.

In candle list get # from end

  • Kind: Official (Deriv)
  • Type id: get_ohlc
  • Shape: Value block (gives a candle)
  • Where it goes: Anywhere a candle is wanted, for example in Is candle black? or Read value in candle. The index socket must be filled.
  • What it does: Gives you one whole candle (with its Open, High, Low, Close and Open Time) from the list of candles at the chosen size. Its help name is "Get candle".
  • Inputs:
    • # from end socket: a whole number. 1 is the newest candle, 2 the one before. The menu fills it with 1.
    • with interval dropdown: Default, 1 minute, 2 minutes, 3 minutes, 5 minutes, 10 minutes, 15 minutes, 30 minutes, 1 hour, 2 hours, 4 hours, 8 hours, 1 day. The menu starts with Default.
  • Gives back: One candle (not a plain number). Only blocks that want a candle accept it.
  • How it works: The bot gets the candle list for that size and picks the candle at your position from the end. If you give a number that is not a positive whole number, the bot stops with "Index must be a positive integer".
  • Example:
┌─ 2. Purchase conditions ─────────────────────────────────────┐
│ if < Is candle (in candle list get # from end ( 1 )          │
│      with interval: [ 15 minutes ▾ ]) black? >               │
│ then  Purchase [ Fall ▾ ]                                    │
└──────────────────────────────────────────────────────────────┘

The bot buys Fall when the newest 15 minute candle is black.

  • Good to know:
    • A candle is not a number. Put it into a candle socket, or read a price from it with Read value in candle.

Candles List with interval here 2:

  • Kind: Official (Deriv)
  • Type id: ohlc
  • Shape: Value block (gives a list)
  • Where it goes: Anywhere a list is wanted. Best used with Make a list of ... values from candles list. Needs a market chosen in Trade parameters.
  • What it does: Gives the whole list of candles at the chosen size, up to 1000 of them, oldest first. Each item is a full candle. Its help name is "Get candle list".
  • Inputs:
    • Candle interval dropdown: Default, 1 minute, 2 minutes, 3 minutes, 5 minutes, 10 minutes, 15 minutes, 30 minutes, 1 hour, 2 hours, 4 hours, 8 hours, 1 day. The menu starts with Default.
  • Gives back: A list of candles.
  • How it works: The bot asks Deriv for the candles of the chosen market and size and returns them all. The label text "here 2" is part of the block's name in the Bot Builder.
  • Example:
┌─ Run on every tick ──────────────────────────────────────────┐
│ set [ highs ▾ ] to Make a list of [ High ▾ ] values          │
│   from candles list ( Candles List with interval here 2:     │
│                       [ 5 minutes ▾ ] )                      │
└──────────────────────────────────────────────────────────────┘

The variable highs holds the High of every 5 minute candle.

  • Good to know:
    • A list of candles is not a list of numbers. Indicators will not accept it directly; turn it into numbers first.
    • The newest candle may still be forming.

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