Page cover image

Basic concepts

What BotBrains is

BotBrains is a no-code platform for trading robot development. This means you can build trading robots without any programming.

Instead of writing code for a trading robot, you can build trading robots on BotBrains using pre-made blocks that you can drag and drop onto the scheme, set their settings, and make connections between them.

You can not only develop the logic of the robot, but also create full-fledged trading interfaces. You can connect trading robots to Telegram and send messages and/or chart screenshots directly to you in Telegram - no need to do any programming, just drag and drop necessary blocks onto the scheme.

An implementation of a simple trading strategy "Moving Average Crossover" is shown in the screenshot below.

You can open this scheme in the editor by clicking on the link.

Blocks categories

The table of available blocks categories is shown below. For a complete list of all available blocks, see the "Blocks list" article.

Category

Description

Events

These blocks are activated when something happens. For example "Start of robot work" event blocks is activated once the robot is launched.

Condition

You can perform various checks using the "if" block.

Loop

Loops have many applications. For example, you can use a loop to go through all available symbols and identify the symbol that made the largest movement during the last trading session.

Indicators

Indicator is one of the key means of technical analysis. BotBrains provides a wide range of indicators: from simple volumes to Ichimoku clouds

Chart analysis

Get information on a specific chart bar, get the maximum/minimum price for a certain period of time. Draw horizontal and vertical lines on the chart.

DOM analysis

Get information on the depth of market spread and its quotes.

Transactions

Place and remove limit/stop orders. Place market orders, close position.

Variables

Change variables values. For example, in a variable you can store the number of lots your robot will trade.

Sounds

Using sound blocks you can play a certain sound when something happens. For example, you can play the "Buy signal" sound when all the conditions for opening a long position se are met.

Getting information

Get information on trading account, trading session, active limit/stop orders, history limit/stop orders, symbol, time, and history deals.

Enumerations

Enumerate symbols, active limit/stop orders, history limit/stop orders, history deal.

Telegram

Send messages and charts screenshots to your telegram.

Interface

Build a full-fledged interface of a trading robot. Individual interface elements can be modified using modification blocks. You can bind actions to interface buttons. The "input field" interface block can be used to change variable values while the robot is running. All of these blocks allow to create dynamic user interfaces.

Predefined constants

Basically, predefined constants are used for comparisons. For example, there are 3 predefined constants for position direction: buy, sell, and no direction. You can get the direction of the current open position and compare it with one of the predefined constants.

Debug

Using the "debug" block you can output debug information to the terminal journal. For example, using this block you can check that variables or constants contain correct values.

Other blocks

Terminal close, stop robot work, robot work pause. Log to file, notification in the terminal, comment on the chart.

Math operators

Addition, subtraction, multiplication, division, division remainder, square root, exponentiation. Comparisons: less than, greater than, less than or equal to, greater than or equal to.

Logic operators

There are logical operators for building conditions: AND, OR, NOT.

Teleports

There are blocks for entering and exiting from the teleport. Sometimes you need to quickly and conveniently switch to the execution of another section of the scheme - with teleports this can be done in a matter of seconds.

Type conversion blocks

By default, all user data is stored as a number. With type conversion blocks you can explicitly specify in which format you want the data to be represented. There are 4 types: integer, decimal, string, date and time.

Variable or constant select

Variable or constant select

Value input

Value input

Blocks connections

You can combine blocks by linking. Open the editor and place 2 blocks on the scheme: "Timer" even block and "Journal message" block:

Open settings of the "Timer" event block:

By default, the "Timer" block is activated once per second - you can change blocks parameters to provide the desired behavior.

Open "Journal message" block settings:

This block has only one parameter as well: "Text message".

Note, you can use variables and constants as blocks parameters values. In order to use a variable or a constant as a parameter value, you should click the switch next to a parameter input field. Working with variables and constants is cover in more detail in the correpsonding article.

Robot code generation

Pree "~" key in order to generate robot code. Go to the "Code" tab in order to see the generated code:

As you can see, the code of our trading robot has been successfully generated.

Dependencies installation

In order to launch trading robots made with BotBrains editor, you need to install the following dependencies:

  • botbrains_lib.ex5 code library

  • botbrains_lib.mqh include file

  • botbrains_constants.mqh include file

  • Sound files

Go to the MetaTrader 5 terminal and open the MetaQuotes Language Editor:

In the "Navigator" window click on the "MQL5" folder with the right mouse button. In the context menu click "Open Folder":

Then download the archive with all dependencies by clicking on the link and place all the files from this archive in the corresponding folders of the terminal.

Allow requests to the server

Each user has a license key, and it needs to be checked if your subscription is activated and some paid blocks are used.

In order for the robot to check your license key, a connection to the BotBrains server is needed. To do this, add https://botbrains.app to the list of allowed URLs for web requests.

Open your MetaTrader 5 terminal, go to "Tools -> Options -> Expert Advisors". Check the "Allow WebRequest for the following URLs" checkbox. Add the following URL to the table below: https://botbrains.app

In order for the telegram functionality to work correctly, add the following URL to this table: https://api.telegram.org

Robot launch

In order to launch your robot, you can just create a .mq5 file in the "Experts" directory, copy generated code and just paste it into the created file.

You can also just download generated code as a .mq5 file. In order for this save your project and click on the "download project" button in the right toolbar:

In the dialog box that appeared, you are given a choice:

  • Download .mq5 file only

  • Download .mq5 file and all dependencies

Move downloaded .mql5 file to "Experts" directory.

Then open the file in the MetaQuotes Language Editor and compile the code of the robot:

After the code was compiled, pay attention to the "Errors" tab of the "Toolbox" window.

Always make sure that the compilation was successful. If some errors occurred during the compilation, make sure that the robot scheme does not contain any errors.

Go to the terminal and find the robot file in the "Navigator" window. Then launch the robot by clicking twice on the robot file.

The behavior of the robot is fully consistent with the scheme we created - exactly once a second the specified message is printed.

Warning

Test the robot only on a demo account! Do not switch to real trading if you haven't fully tested the robot's performance on the demo account!

Suggest and idea

If you have any suggestions regarding the work and development of the application, feel free to suggest an idea - we will take your opinion into account. You can always contact us by the following email: support@botbrains.app

Last updated