What you should know about building robots for trading

Building robots for trading. What should a beginner know

Did trading start to be too time consuming? Have you had thoughts about building a robot? What to start with? In this article we collected basic information required for beginner robot-builders.

  1. Introduction. A man is not a robot.
  2. Types of trading robots.
  3. To buy or to build.
  4. Where to find ideas for a trading robot.
  5. Stages of building a trading robot.
  6. Development and operation expenses.
  7. Conclusion.

Start to use ATAS absolutely free of charge! The first two weeks of use of the platform give access to its full functionality with 7-day history limit.

To try ATAS free of charge

Introduction. A man is not a robot.

How does a trader usually start his way? First, he starts to learn – reads articles, watches videos for traders, downloads programs and applies the lessons learnt in practice. And only then he understands that trading on the exchange provides not only wide opportunities for making money, but also endless chances to make mistakes (how to overcome a losing streak).

“Errare humanum est – It is human to err”. Roman rhetor Lucius Annaeus Seneca.

Human errors of a trader:

  1. Mechanical. In 2014, a trader of Mizuho Securities incidentally posted buy orders in the amount of 600 billion in the Japanese stock market – the price and volume were typed in one column. Fortunately, majority of orders had not been executed by the moment when they were cancelled. 
  2. Analytical. “Wrongly assessed strength and weakness of the market. Didn’t notice an important level!”
  3. Organizational. “Missed the news and trading session opening – traffic jams”.
  4. Psychological. A separate subject.

Psychologists say that negative experience is more explicit and it stays in memory longer and makes you doubt all the time. Even if the current situation seems optimal for entering into a position, the previous negative experience makes you doubt and, as a result, you lose a good entry point. A trader becomes even more self-critical after that and loses confidence.

A trader applies more efforts to overcome errors. He needs more and more time and a standard working day becomes insufficient. It results in chronic fatigue, apathy and depression. And a trader burns out.

And here appears an idea to hire a robot.

A healthy idea, but not a new one. The first concept of an automated trading system was presented by Richard Donchian in 1949, when he developed a programmable set of rules for buying and selling stock.

Robots were a pure fiction in those years, but, today, they are common in the exchange industry. As it follows from a report of the Central Bank of Russia experts, a half of all trades were executed in 2018 on the Moscow Exchange by programming algorithms.

Why do robots conquer markets? Who else but robots can:

  1. collect gigabytes of data (seasonality, politics, financial reports, warehouse stock, unemployment, etc.);
  2. analyze the situation by programmed algorithms in seconds;
  3. make a clear decision: buy or sell.

Moreover, a robot, unlike a human being, does not hang in doubts due to previous failures. It does not enter a trade when it feels bored. It does not try to prove the market that the market is wrong. It does not spend time in social networks. It does not need a lunch break.

2. Types of trading robots

The modern market offers a number of trading robots for any taste and purse.

By the level of complexity, robots could be:

  • Simplest algorithm robots offer trading models on the basis of well-known indicators. For example, we buy when a fast Moving Average crosses a slow one upward.
  • Advanced robots analyze technical analysis patterns and candles and look for patterns.
  • Professional robots use volume analysis, order flow and monitor the order book.
  • The most powerful top class robots analyze electronic media, conduct neuro linguistic analysis, collect exchange and brokerage reports, use macroeconomic laws and apply artificial intellect and machine learning systems.

By the degree of automation, robots could be:

  • Semi-automation robots. Among them – assistants, the tasks of which are posting stop and take-profit. Such robots reduce the trader’s time, when he manually manages a big portfolio, help to save time and reduce the risk of pressing a wrong button.
  • Complete automation robots. Analyzes the market, opens and closes a trade on its own.

By the frequency of execution, robots could be:

  • Standard frequency robots. Such robots trade with the same frequency as an average human trader would trade. Their algorithms are often based on classical indicators and price and volume behaviour models.
  • High frequency robots. High frequency trading (HFT) robots buy and sell positions within a fraction of a second. It’s estimated that HFT accounted for 60-73% of the overall volume of trades in the US markets in 2009 and it fell down to approximately 50% in 2012. A complex analysis of fundamental factors is not among the tasks of HFT robots. They are aimed at, for example, pushing the price in a certain direction, collect liquidity, form false patterns, hold price levels and trade impulse.

3. To buy or to build.

To buy an existing trading algorithm or to develop your own one?

Pros of buying an existing robot:

  • saves time;
  • accessible for beginners. A robot seller usually provides support in solving problems when installing the robot.

Cons of buying an existing robot:

  • when you buy an existing trading algorithm, you, most probably, will face a situation when the developers do not describe the trading models, built into the software, and such an algorithm would always follow the will of its developer;
  • the robot’s developer could fabricate results of the previous trading. In any case, there is no guarantee that successes of the robot in previous periods would bring you profit in future;
  • a multitude of sold copies of the robot might negatively influence its algorithm efficiency;
  • the cost of some robots could be compared with the cost of a car, which you want to buy after making profit from trading with the help of the robot.

An alternative idea is to create your own trading robot from scratch.


  • you get a unique software, which implements your own developments and knowledge;
  • you can optimize the software code in future by adding functions, correcting mistakes and adjusting to different markets;
  • you save money if you write the code on your own.


  • it takes time;
  • to write a unique product is more expensive than to buy an existing one;
  • the programmer can ‘borrow’ your ideas.

You should also plan expenditures on maintaining a trading algorithm. The robot would need endless improvements even after a long testing process. The reason is that the market is changing all the time and previously efficient methods stop bringing profit.

4. Where to find ideas for a trading robot.

Models of trading moving averages and other technical indicators are well-known. What are other ideas, which might be competitive and bring profit for a long time?

и формируются за конкретный период – 5, 10, 30 мин.

Try to look at the market at a different angle. For example, traders usually use charts where X-axis is the time axis and candles are formed for a certain period of time – 5, 10 and 30 minutes.

Let us imagine that we replace the time axis with the volume axis or, even better, axis of points that the price passed upward or downward. Such ideas were formed in the heads of traders that developed other chart types, which differ from standard periods.

Robot trading chart

Here’s an example of building a chart in the RangeUS format. It seems, when we look at the chart, that the market was in a range for a long time (a range is a side movement of the price, which time and again forms repeated highs and lows).

However, if you look more attentively, the bigger part of the chart is located within the time span of 3 seconds. Only high frequency algorithms are capable of working with such a range.

Robot trading chart

It is easy to notice in the above chart that ranges appear all the time while the price moves. Isn’t it a good idea for a trading algorithm? You just need to select relation of range bars for the instrument, at which such formations would appear in the chart more often.

You can notice, when reducing relations for the RangeUS chart, that the range portions often appear in those places where they appeared earlier. In other words, if you observed range formation on a certain portion earlier, the situation can repeat itself when the price comes back to it.

Robot trading

Such observations suggest the cyclic nature of the market. Portions, where the price formed a range some time ago, magically make the price form a new range again when entering this price range.

This simple but non-standard idea is based on visual pattern detection and it could be put into the basis of a trading algorithm. Do you want anything special? Download ATAS and find your own unique trading idea.

5. Stages of building a trading robot.

Let us consider the process of building a robot from scratch. We will not take into account specific features of markets, platforms and exchanges. The basic scheme is as follows:

  1. Everything starts from an idea. You notice a specific pattern, which regularly appears in your market and realize that it is interesting from the point of view of the potential of making profit on a long run.
  2. Manual testing. You formulate conditions of entry/exit and study how they work in the charts of the previous sessions. It is desirable to analyze as many days as possible, including periods of various volatility. Insert results of each date into a table. If you get a positive amount and are sure now that the idea works – visit a programmer.
  3. Technical assignment. Find programmers who have, at least, general understanding about exchanges, order flows, order reduction procedure and other exchange stuff. You find such an executor, give him specific instructions and wait for your robot to come.
  4. Back testing and optimization. Having received your robot, you start testing it on historical data. Load maximum detailed historical data into the trading algorithm (it might be difficult to find a tick trading history). Then we change the robot settings until we find an optimum, at which the robot provides the best results with acceptable losses.
  5. Front testing. Checkout procedure. The robot enters into trading at a small volume. Be prepared that the real-life market results could be worse. As a variant, such a situation might be a result of insufficient algorithm testing on historical data.

Here comes the process of repeated optimization of the trading algorithm. It might take time or never come to its end. You will add new ideas and remove old ones. It is a creative process and, after some time, your algorithm might be completely different from its original version.

6. Development and operation expenses.

There is a chance that total expenditures on development of a complex trading algorithm would exceed the profit, which you will be able to get from its use. That is why the idea of development of your own trading robot should have a sound financial feed, based on serious results of manual testing.

However, let us assume you have a robot. It makes more profit than loss in the market. What’s next? You can launch the robot on your local computer. But there is a risk of turning power or Internet off. Hackers will break your office or a house cleaner spills water on your computer. Things happen.

There is a more reliable variant – cooperation with the exchange. We have 2 variants here:

  • Installation of your robot on computers that are located in the exchange data centers;
  • Installation of your own equipment in the information processing center. This service is called co-location and envisages additional expenditures. Thus, for example, the Moscow Exchange provides a possibility to locate your equipment on its premises – equipment capacity of not more than 500 W for RUB 20,000 per month (check all tariffs).

Of course, these variants make sense only for really advanced trading algorithms, for which the rate of submitting orders and processing incoming information is of top priority.

Such robots are the most efficient, since a possibility to move the market will depend on the rate of order submission. They have the opportunity to outrun all remote algorithms, which are also oriented at the order flow and book. The algorithm that works closer to the exchange nucleus, has an advantage. It manages to pull the best prices out of the book, while the others settle for slippage.

7. Conclusions

We can make a conclusion from all the above that development of your own trading robot is a time and resource consuming entertainment. You should understand, before you start modelling your future artificial intellect, that a multitude of trading algorithms have been developed and implemented, passed back and front testing and were optimized and improved dozens of times.

However, if your robot is not aimed at fighting other robots but helping you to trade – it is an easier way. Such an algorithm can:

  • monitor various periods of various markets;
  • attract your attention only when the chart forms your favourite setup;
  • follow the rules of capital management;
  • give you more time for development or doing something else.

Понравилось? Расскажите друзьям:

Другие статьи блога: