Trading robots programming: tools, language for development


What programming languages ​​are trading robots written in is not an idle question and does not have an unambiguous answer. The most common and interesting question for users who are starting to engage in
algorithmic trading, is: “In what programming language is it best to create a trading robot?” There is no definite answer here, so there is no “better” option. When choosing a tool for creating a future assistant, it is necessary to take into account a large number of factors: the personal strategy used in the work, the desired functionality and settings, productivity, modularity, and others. In this article, we will talk about what knowledge, skills and tools you need to own in order to create a reliable robot advisor for stock trading, what programming language is suitable for this, and also consider the main stages of bot development.
Trading robots programming: tools, language for development

What are the advantages and disadvantages of independently developing a trading robot

Surely each participant in exchange trading has thought more than once about developing his own individual
robotic assistant that would automate the trading process. The easiest way to resolve this issue is to contact a programmer who will take into account all the wishes of the trader and create a suitable trading robot. But there are also pitfalls here:

  • perhaps the strategy you put into the bot will turn out to be profitable;
  • not every trader has the opportunity to pay for the service, since the cost of creating a script can start from $ 5 and end in thousands;
  • rarely, when the system suits the buyer after the first try, more often the code is sent for revision in order to correct the shortcomings;
  • you will not be able to figure out what a specialist wrote if you do not know the programming language, which will ultimately devalue the product.

Before resorting to the services of a specialist, you can try to develop a robotic system yourself. No programming skills are required – the service will independently assemble a consultant according to the previously specified settings. However, even here you can run into the following troubles:

  • you will not be able to connect any selected indicators to the system;
  • such robots do not involve working with analytical data and direct streams of quotes through the API.

What steps does the process of developing a robotic advisor include?

Financial analysis, embedded algorithms, trading engine

First of all, before you start developing a sales consultant, you need to clearly imagine what abilities he will have, what functionality he will include and what tasks he will cover. If you start to analyze these aspects of the robot during the programming process, there is a good chance that you will start looking for more advantageous sides, and as a result, you will later redo the entire system. The first step is to think over, formalize and develop a trading algorithm. It is important that this algorithm is described in great detail. Creation of algorithms for trading, logic of trading robots:

Note! There can be an unlimited number of conditions for a robo-advisor. It is important here that it fully meets your requirements and closes the necessary tasks, so the edge here is the developer’s imagination.

To create the most detailed primary robot image, ask yourself the following questions:

  1. You need to know at what cost to acquire this or that asset. If we posted, and the order is still hanging, the price is gone. Do we take at market rates?
  2. What if the application won back only half of itself? Selling the rest at market value? After what period of time?
  3. Disconnecting the robot before the end of the auction? How much earlier? Will it be based on a calm volatile sideways trend or, conversely, on a spike?
  4. What days will the robot trade? Throughout the week or on actively volatile days – Monday and Friday?
  5. What stopping orders will be programmed in the robot advisor?

There are a lot of such questions when analyzing markets, and it is important to work out each of them so that at the end of programming and in subsequent work, there are no troubles.

How to choose a language for programming trading robots

In the second step, it is important to decide which programming language will be used in development. If you already have certain knowledge in the field of programming and you own, for example, C #, then most likely you will write a stationary application in which the API of your broker’s trading terminal will be applied, for example, it will be the QUIK software product.
Trading robots programming: tools, language for development

Interesting! If you have not come across programming, but want to acquire these skills and develop your own bot, pay attention to the QPILE and QLUA languages, which are built into the QUIK work complex.

Debugging and testing a trading robot on a virtual account

The third step is to check our work when the robot is formed and written.

Important! The stage of testing and debugging is extremely important in this case, since even the smallest error in the system can cost a lot of money!

It is better to test the robot in a forward format. That is, we choose a short period of time, conduct a test, remove some flaws, add new elements, then take the next period of time, test and compare the results with the previous ones. Etc. If the robotic system has shown good results at each time interval, you can proceed to real testing. A virtual account is almost identical to real sales, only there is no risk of losing all your profits at the slightest mistake. However, it is still important to test the software product on minimal volumes, since no one canceled the broker’s commission fees, especially if a new, untested strategy that was not previously used by you in trading is added to all this.

Important! In trading, you need to calculate your actions several moves ahead, be prepared for failure. However, it is also important to notice the positives, even profitable micro trades during the testing phase.

Knowledge of which programming languages ​​are required to create a trading robot – bot development from A to Z

Analyzing all of the above information, one can come to the logical conclusion that choosing a language or several programming languages ​​to create a robotic platform is already a difficult stage, and it requires a deep analysis of the system. When choosing a programming language for developing a robotic investment advisor, it is important to consider the following factors:

  • availability of specific documentation;
  • whether there are reference sources for the selected programming language, so that in case of a question there is where to turn;
  • availability of free available examples;
  • chats, forums, conversations where you can ask for advice from experienced developers or amateurs, in the assortment of which there are successful works;
  • the prevalence of the exchange where you are going to use the robot consultant.

Even the smallest understanding of the programming language in which you decide to write a script will give you the opportunity to independently analyze the finished system and edit it after the work is completed. So you don’t have to ask an experienced specialist for help or advice every time, and less time will be spent.

In addition, the following programming languages ​​are used to develop various areas of the robot advisor:

  • trading engine – an affordable and simple system responsible for performing light tasks, created in C, C ++;
  • a trading robot for managing settings – this system is responsible for managing algorithms and editing the user interface, includes mechanisms for presenting trading results; a program is written in C ++, C #, Java and the like;
  • service for testing the working platform based on historical data and selection of parameters for trading – the module is responsible for testing new algorithms based on historical data, and also re-configures the current algorithms; only scripting languages ​​are used for writing.

Trading robots programming: tools, language for developmentPopular programming languages ​​based on market analysis (regardless of the development of trading robots) [/ caption]
So which programming language to write a trading robot to choose: Java, Python , C # or C ++? Today the stock market puts forward its own conditions, this also includes the development of trading robots, namely their functionality, which is limited to exchanges, given the language in which the assistant was written. The languages ​​most in demand are MetaQuotes Language 5, C #, Java, Python, and C ++. The last two are the easiest to learn. Trading robots programming: tools, language for developmentAmibroker [/ caption]

MetaQuotes Language 5

This programming language is similar to C ++; it is used to write and develop programs for the Meta Trader 5 service, which is used for trading on Forex, Futures and other exchanges. The main feature of the language is specialization in solving problems of exchange trading participants: from automated-tuned sales to their clear analysis. The syntax, as mentioned above, is close to C ++ and makes it possible to work in an object-oriented style. The MetaEditor environment is provided as an auxiliary platform with all the tools necessary for writing a trading robot.
Trading robots programming: tools, language for developmentThe main functions of the program are:

  1. Consultant is an automated trading system that is tied to a specific chart.
  2. The graphical display of the calculated dependencies is an indicator developed by the client as a supplement to the sensors already built into the system.
  3. Script is a script where the course of actions is written, created for a one-time automatic execution.
  4. Library is a collection of publicly available functions where frequently used modules of client programs are stored and distributed. Libraries do not perform any functions automatically.
  5. The included file is the initial text of frequently used modules of custom programs.


This programming language was developed by Microsoft. It is multifunctional and convenient in all respects: wide scope for writing robots, ease of use of tools, safety and reliability. The ability to create libraries, which are a collection of codes collected by experienced specialists, simplified the process of writing a trading robot. For example, a similar program StockSharp has all kinds of codes for writing an investment trading broker.

Note! By using libraries, the user saves time on building a broker and debugging code. After all, earlier a user who wanted to create an individual automatic system had to first write a library, and this requires quite serious knowledge in the field of programming. By no means, to create a software stock broker, it is enough to use the C # language.

Thus, having understood C #, you can work on any platform, since the language is not tied to any one. On it you can both test trading algorithms and write codes, scripts and trading investment brokers.


If we compare Java with the programming language described above, then we can conclude that they are almost identical. Java is an object-oriented programming language that runs many of the high-level functions that are important for building robots. The main distinguishing and positive feature of this programming language is adaptability. A trading robot that was written on one specific platform will function without problems on other platforms. Also, compared to other languages, Java masks the work of the main memory, which makes the writing process easier, that is, the user will not understand for periods what is actually happening in the developed code. Like the programming language described above, Java cannot be compiled with machine numbers.Multifunctional language clarifies instructions while solving problems.

Note! The Java programming language can be operated separately from the programmed service.


Python is the most demanded and widely used language in the field of programming. Its syntax is simple and convenient, and many built-in libraries will help you perform a variety of tasks that a bot can integrate. A large number of automated investment brokers support this programming language, which greatly facilitates the work of beginners in this field.

Tools you need to develop a trading robot

Knowing programming languages ​​is one thing, but mastering convenient and effective tools for creating a software product is another. Let’s look at a few elements that will greatly simplify the development process and script writing.


This service is the most efficient on the market for technical assessment, creation and testing of robotic systems. The main programming language here is WealthScript. It also uses various languages ​​to write CLI-enabled libraries and programs.
Trading robots programming: tools, language for developmentThe essence of the product is that the developer specifies his strategy in detail, and the service collects requests for operations. Through specialized libraries, orders are sent to the trading terminal and executed there.

Note! This scheme has many limitations, so it is difficult to work with it on Russian stock exchanges.

How to choose a programming language for creating a trading robot – programming for a trader:


MetaStock is another foreign service that includes a library of various indicators and elements for displaying your own formulas. The advantage of the platform is a simple programming language, and the disadvantage is the combination with trading terminals through secondary libraries, which also leads to limitations and problems of use on Russian financial platforms. The downside of MetaStock is that heavy strategies cannot be introduced into the robot here.
Trading robots programming: tools, language for development

Omega Research

This service provides a platform for testing robotic investment brokers, and also conducts a full mechanical analysis of them. The main programming language here is Easy Language, similar to Pascal. Of the shortcomings of the software product, one can single out frequent failures in the system and the complexity of configuration. In addition, Omega Research only supports the built-in data format and does not accept files from other systems.


Like the above-described tool, TSLab is a platform for creating trading robots, as well as analyzing and editing them, optimized specifically for the Russian stock market. The main advantage is the ability to write a trading strategy in the form of a flowchart if the user does not have programming skills.
Trading robots programming: tools, language for development


The StockSharp software tool is free in its basic version, but has an extended version of the Pro, which has the widest and most attractive functionality. The main programming language is C #.
Trading robots programming: tools, language for development


This product is the fruit of the work of the St. Petersburg Russian company Cofite. Through the terminal built into the service, you can launch robots, and develop them in the Robotlab product from the same company. Here you can also write trading strategies in the form of a flowchart, if you do not have programming skills, and then implement them in the terminal.
Trading robots programming: tools, language for development


The SmartX trading platform is not a familiar terminal, but a full-fledged software product that includes the TradeScript vector programming language, created specifically for the development of robotic investment brokers in the United States by the American company Modulus Financial Engineering
Trading robots programming: tools, language for development. The main advantages of the software product are:

  • the ability to implement testing of the trading system based on historical data; at the same time, the information does not need to be downloaded from extraneous, often paid, resources, SmartX downloads them on its own;
  • building a trading strategy based on tick changes.

Trading robots programming: tools, language for development

The main stages of developing a bot for a trading platform

Stage 1: idea and detailed descriptions of the future system

The first step is to determine in what way you want to make money on the stock exchange. In simple words – to develop your own algorithmic strategy or ideas, if there are several of them. To make it easier to formulate your idea, ask yourself four important questions, which are not easy to find answers to, but they will quickly move the development of the robot forward: What is the idea behind your trading strategy?

  1. What tasks will the trading robot you program be responsible for, and how will this affect the trading process?
  2. Is it necessary to additionally develop a graphical electronic circuit or a script for a well-written Expert Advisor?
  3. Is it possible to implement your idea as a whole in its original form technically and what is its complexity? Do you need the help of an experienced programmer or is it possible to do it yourself?

Having given clear answers to these questions, you will save your time, work out the idea in more detail and already consciously start writing the program itself.

Stage 2: preliminary testing

If you already have an algorithmic strategy or idea, you need to test it on the basis of historical data using special programs and tools that we described above.

Note! To understand the basic functionality of the robot consultant, you need to allocate several days of free time.

If you have achieved a smooth result that changes on the curve of the graph, proceed to the next step.

Stage 3: analysis of the robotic system

Before you start seriously developing a systemic investment assistant, try to analyze and isolate the possible risks. They are conventionally divided into two categories:

  • trading;
  • design.

Trading risks are all those moments that will be missed in the process of developing a trading algorithm. Design risks are the risks of power outages, loss of communication between the robot advisor and the stock exchange. These risks, unlike trading ones, can be minimized as much as possible by choosing more reliable and proven servers.

Stage 4: core

For automated sales in the stock market, an exchange trading participant needs a trading core that will make it possible to carry out trading strategies.

Stage 5: developing a trading strategy

After the kernel is created or a ready-made one is selected, you can start writing a trading strategy. First of all, it is important to understand the parameters of the algorithm, namely:

  • sales schedule (when the strategy opens and closes positions);
  • automation of a trading strategy (the fewer elements are used, the better).

As soon as the question with the parameters is closed, you need to describe the rules for opening and closing positions.

Stage 6: testing

After writing a trading strategy, you need to test it on a virtual account or real trading.

Note! At this stage, it is important to make sure that the strategy you have developed brings exactly the results that you expected, regardless of the market conditions, without making unnecessary transactions.

If there are errors somewhere, go back to 3 or 4 stages of development and edit the elements in them.

Step 7: Analyze Results

Having reached this step, you need to create a journal of transactions of the exchange trade participant. It should include deals in closed positions (trades) and automatically create analytical tables and charts, which will reflect the results of testing.

Important! It is necessary to constantly update the information and not neglect the entries in this journal.

Once you have achieved stable results, start adjusting the parameters for the trading strategy according to the current market conditions.

Is it possible to develop a trading robot for stock exchange work without programming skills?

TOP-4 affordable and easy ways to write an automated broker without knowledge of programming languages ​​There is not always time and opportunity to understand and learn programming languages, but still there is a great desire to create your own system. And it’s real!

Method 1: Writing a Trading Robot Using Your Software’s Internal Language Tools

This variant is similar to the original writing of a trading robot, but it is simpler. For example, working on the Quik platform, an exchange trader can automate the system for himself by setting certain parameters. The site developers contribute to the smooth operation by adjusting the script codes so that they respond to client requests quickly and efficiently. However, sometimes the execution of tasks is still delayed due to system failures.
Trading robots programming: tools, language for developmentRobot for Quik on LUA [/ caption]

Method 2: using an Excel spreadsheet processor

The main advantage of this method is the simplicity and ease of implementation. It is perfect for beginners who have no idea about programming languages. To write an automated investment broker, you will need to get acquainted with the most primitive language – VBA. The syntax is easy, so it won’t take long to learn it.

The disadvantages of using an Excel spreadsheet processor are slow work and some problems when integrating a robot into a trading system.

Method 3: using analytics platforms

The use of such analytical platforms as MetaStock or WealthLab does not endow the robot with trading functions; it is important to adapt them during the development process. The advantages of this method include the ability to check based on historical data, and the disadvantages are frequent failures in systems and the need to connect additional tools to the development process.

Method 4: using programming languages ​​in the process of developing a trading robot

Based on the above information, we found out that the most popular and demanded for creating an automated investment broker are such programming languages ​​as Java, Python, C #, C ++ and others. The main advantage of systems written precisely through the software method is high speed and efficiency. The user can also optimize, use various formulas and try original strategic moves in their trading. You can find the necessary formulas on the Internet and substitute them in your trading strategy, taking into account certain assets. So, we figured out how to develop our own trading robot and what is required for this. The development process is not so complicated, but it is important to understand that the slightest mistake made in it can lead a trader to losses,therefore, here it is necessary to carefully study each element of the software product, test it on virtual accounts and conduct a detailed analysis of the results obtained.

Поделиться ссылкой:

Rate this post
Rate author
Programming, investment and algorithmic trading
Add a comment