spin to win a prize!

Don't miss our exciting new year promo!

Ultimate Guide to Algorithmic Trading

Ultimate Guide to Algorithmic Trading

The use of algorithms in trading (algotrading) is a trend of the last decades, which has changed the market in many ways. Any automatic system can easily surpass a human in speed, productivity, and endurance, while it would be almost impossible to compete with a machine.

What is Algotrading?

So, let's start with the basics. What is algotrading? At the moment there is a huge number, including absolutely ridiculous and incredible myths about algorithmic systems. For example, some people, far from trading, believe that there is a huge computer, the size of a five-story house, which is connected to the Internet, which reads all the news of the world and simultaneously digests them and makes bets on the markets. That it is so smart that it simply guesses the future.

Algotrading is a style of trading on financial markets, in which a certain trading algorithm, which includes the rules for opening, closing, and tracking of positions, calculation of the position volume, etc. is implemented by software, connected to a data source, and communicating with the server using trade requests (we will consider all this in more detail later). Simply put - a trader formulates the rules of the trading system, tests and adjusts it, and then the automated trading system operates in the market without the direct participation of the trader, who only has to monitor the efficiency of its work.

That is, the main task of algotrading comes down to the precise fulfillment of signals from its system. Hence the second name of this approach - is trading using mechanical trading systems (MTS). In forex trading, they are called Expert Advisors. The name "algotrading" appeals more because it immediately indicates the essence of this approach - trading based on the algorithm. The term "mechanical" means the consistent execution of all signals of the trading system, regardless of one's judgment of the current market situation. It should also be noted that the term "mechanical trading system" does not mean an automatic trading system, which itself performs transactions in the market without human participation or with minimal participation. A mechanical trading system can also be manual.

What is the basis of this style of trading, and what are its main ideas? First of all, it is impossible to guess the future. It is hidden to mere mortals. Secondly, the market or prices of financial instruments is a random system and every next price can be higher or lower than the previous one and it is impossible to predict it. Thirdly, algotraders or quantum traders work only with the probability of the future price falling into one or another range based on some rules or calculations made on the analysis of the previous price series of one or several financial instruments. At the same time, these rules can be constant or can change themselves over time with the market changes. That is they are looking for constantly repeating dependencies on historical data, which with a certain degree of probability can be repeated in the future. Fourth, the very essence of algorithmic trading and algorithmic research is the selection of these very rules or families of robots. The selection can be manual - using some mathematical or physical models, can be automatic - using a search of rules, and can also be genetic - when the rules are invented by the computer itself.

Everything else that you hear about algotrading as a prediction system is fiction and fantasy: you cannot predict the future.

Another important thing to understand about the algorithms is that each of them has parameters, which distinguish one robot from another even within the same family. Parameters are certain numerical characteristics of a trading rule - indicator period or a certain threshold of volatility, above which the robot starts or stops its work. Parameter selection is an integral part of the research process and there are a lot of variants of how to do it. For simplicity, we can say that the basic method is a simple enumeration of different numbers and evaluation of the robot's results for each set of parameters at some interval in the past (called "in-sample" and checking its performance at the next interval "out - of - sample").

It should be noted that the level of financial success provided by a trading system is not the only criterion for evaluating the efficiency of a strategy, but that is a topic for another discussion. The criteria for estimating the quality of a robot are usually the absolute gain or return, the Sharpe ratio or the return on maximal drawdown, the number of trades, as well as their combinations and many other parameters, which we will discuss later.

The trading strategy algorithm should be written in a special programming language to test the algorithm on historical data and subsequently use it to create signals for opening-closing positions in a specialized program of technical analysis. For the foreign exchange market, unfortunately, there are not many alternatives.

It is safe to say that every algorithmic firm working in this direction for many years, all these approaches are constantly improving, and as in a huge castle when you open another door, the researcher immediately sees the next one.

We want to emphasize again: as the conclusion of the foregoing, algorithmic trading is neither a myth nor a miracle. It is as much a scientific work as the invention of new materials or drugs, it is as much a research and production process as other human activities. No matter how much people search for a grail or a way to turn metal into gold, there is no such thing, just as there are no robots that predict the future.

Is It That Easy To Benefit from Automated Trading Systems?

But since whole groups of programmers and scientists are working on the development of trading systems, what are the chances for ordinary people like you and us to succeed in this business? The fact that there are chances is proved by the long-lasting monitoring of automated trading systems.

Nevertheless, many systems are no longer in existence. We would say about 99% of them. Therefore, if you see a good performance for 2-3 years, it, unfortunately, does not mean that it will also exist tomorrow.

According to our observations, not a single system using Martingale or grid trading ended up with withdrawal of all earnings. The end is always the same for such systems - Stop Out. Also, strategies based on some temporal properties of a traded instrument do not survive for a long period. Not everyone will remember, but in 2009-2012 there were popular bots that traded only buying gold. It seems that there were similar bots for CAD too.

What is the idea behind this? If you want to attain yield with robots you will have to understand their structure and operating principles. If only to be able to tell the difference between a piece of junk and a potentially good robot. So far, we see the popularity of any robot that has been monitored for at least a couple of years. This is true even if the principle of such a bot's work is supposed to be temporary. It is important to understand that there are strategies that demonstrate excellent results in a short period but are doomed to failure in the long term. Such strategies are akin to gambling, where the result is unknown. Like a roulette player who believes he can take his yields at any time, but comes back the next day and leaves all his winnings in the casino, this approach to the trading makes no sense. That is, it makes sense - the same as for the roulette player.

Of course, creating a long-term successful trading system is not easy. Successful investment funds spend millions of dollars a year to develop such systems. It requires a lot of effort and time, understanding and knowledge, endless searching for new algorithms, and improving old ones.

Is Manual Trading so Bad that Many Are Thinking About Expert Advisors?

Manual trading has its pros and cons. But the angle of the material now forces us to talk only about the cons. So, the disadvantages of manual trading:

Misunderstanding the market

This does not apply to experienced players; beginners rather suffer from this. What are the reasons? There are several of them: non-scientific literature, gurus, lack of serious research, and scientific basis. Many books on trading are written by people who are far from the exact disciplines, and knowledge verification methodologies. That is why these books contain unscientific or even anti-scientific knowledge. The knowledge that misleads the reader. Also, books designed to analyze stock markets cannot, without some modification and careful testing of ideas, be applied to the foreign exchange market. The vast majority of sources (literature, training courses, video guides) that purport to teach a person about trading do not teach a person to look for market inefficiencies. A person is not offered a universal way to work with information. In general, training is reduced to rote memorization of some trading rules, knowing which a person will always be "on the right side". Such an approach to teaching newcomers breeds people unable to react to new circumstances and study the subject independently. As a result of all of the above, most traders have problems with the perception of reality. As if drivers on the road were blindfolded or could only turn left.

Psychology

Many people very often fail to follow their own rules. In other words, even when you have a ready and tested market anomaly or inefficiency on your hands, you still can't use it correctly. Human psychology creates many risks here. Mistakes are inevitable and significant. The human factor is enormous.

The physical limitations of the body

The process of creating a trading system with statistically significant results requires an enormous expenditure of energy, time, and effort. Weeks and even months are spent on testing their trading systems.

Yes, at present several different solutions reduce time spent on testing a trading system. However, even the use of such software does not save traders from the following disadvantage.

Dependence of the system testing results in the trader's personality

The successful or unsuccessful development of a trading system strongly depends on the trader himself, on his experience, ideas, and trading approach. When you're testing a new trading system in Forex Tester, it might be quite obvious to you why you didn't enter this trade, while you entered that one with a double lot. And another trader who is testing the same system by the same rules will enter the first trade and miss the second one. As a result, whose tests will be reliable? Right, no one. Hence the following disadvantage.

The complexity of repeating the results of trading using the system

Here the man posted his system on the forum, described all the trading rules, and showed a beautiful performance. And the evil traders have lowered his system. Why did this happen? Exactly for the reason, we mentioned above - the dependence of the result on the trader. And if one trader is successful to trade on the system with a return and another one is not, it does not mean that the other trader is not experienced enough or not good enough, or does not understand something. Just his views on the market may be different from those of the first trader, that's all.

Non-systematicity

And the last disadvantage of manual trading - is non-systematic in the creation of his trading system. There is no clear algorithm, or technology when creating a trading system. It depends again on the trader's personality and his experience, views on the market, and trading.

The most serious drawbacks in our opinion are the last two. Some people have been trading on their systems for years, but they do not succeed in teaching and explaining how these systems work. Also, sometimes systems stop working, and you don't know why or how to fix them.

Advantages of Algorithmic Trading

A transparent, scientific understanding of the mechanics of the market

Algotraders have a clear understanding of price movements and market design, otherwise, their algorithms simply wouldn't work. A scientific approach to market research guarantees that you have a true understanding of how the market works. This is guaranteed by the use of technical means as well as statistically significant sampling during the search for inefficiencies. And the deeper you dive into algorithmic trading, the more comprehensive your knowledge of the markets.

There's no psychological problem

It's still there because an algotrader is human too. It just ceases to play a decisive role in trading and becomes secondary. Yes, bots don't panic, don't tilt, and don't overestimate themselves, unlike live traders. But the same live trader sits and watches them.

Market research using technical means

An algotrader does not need to spend his funds on market research or spend a decade learning to trade by looking at charts before he begins to generate a decent return. Market research for him is the use of special programs that do all the work quickly, accurately, and reliably. And this is a direct savings of capital and time. Of course, the study of such programs also takes time. Sometimes it takes several years. But the final benefits are obvious. In addition, this approach allows you to stay on the "cutting edge" all the time. Have only working, tested strategies. Timely shake up the portfolio of bots and change the inefficiencies they use. This maximizes the amount of time you'll be in the black.

Speed

One of the advantages of using robots is speed. A trading robot can track dozens, or hundreds of quotes, make complex calculations instantly, make a decision, and immediately place orders. No human could ever analyze so much information so quickly. Traders who use in their trading system large volumes of complex calculations, who entrust trading to a robot, get an advantage over their colleagues, trading the old-fashioned way. Traders who don't use robots are forced to reduce the number of traded instruments, increase the time frames used and abandon promising, but complicated trading systems.

Accuracy

Another positive aspect of using trading robots is their accuracy. A trading robot does not make mistakes (unless a mistake was made in the program code during its creation), all input and output data can be calculated to within a few decimal places, if necessary. The robot will not accidentally enter an extra zero or put a comma in the wrong place when placing an order. Manual traders can sometimes make mistakes both in calculation and in placing orders.

Scalability

This is, in our opinion, a major plus. If you want to add functionality to your trading system, you just need to add some more code. For example, you can get nice reports and graphs at any time, you can set up robot alerts by SMS, and you can complicate your trading strategy endlessly. You can create hundreds and thousands of trading robots, and the whole army will work for you round the clock. By trading manually you will have to spend more of your time if you want to expand your trading possibilities, even hire additional assistants, or refuse to expand your activities.

Disadvantages of Algorithmic Trading

The complexity of algorithms

The smartness of the algorithm is very important, and it depends on the experience of the algotrader. This is similar to manual trading - an inexperienced trader loses funds, while an experienced trader earns. In this case, of course, the more complex the algorithm, the more likely it is to make a mistake. On the other hand, the more complex the algorithm, the less likely it is that it will be repeated - at least by manual traders.

Psychology

Psychology in algorithmic trading recedes into the background, but it is still present. So, traders, especially beginners, often start to interfere in the trading of their Expert Advisors. This raises the question of trusting their Expert Advisor. If you trust your development, then you can put it on a real account and not interfere in any way until it is absolutely clear that an error was made in the algorithm design. But it is not an easy task to sit and watch how your trading robot is quietly sinking day after day, even if you know for sure that it is supposed to. But, of course, watching is much easier than if you had to open these same losing trades every day with your system.

Common Myths and Misconceptions about Algotrading

90% of trading success depends on psychology

As we mentioned above, psychology does not influence the process of algotrading too much, in contrast to trading manually. Even if you trade on your own and your system is losing, you will lose no matter how hard you fight your emotions. And building a good manual trading system is not such an easy task. But trading with an Expert Advisor is much easier for a person who is not well prepared psychologically.

Algotrading does not work

Yes, with all the facts presented a large number of people believe that robots are not capable of bringing earnings. Crazy, but true. Barclays systematic trader index shows an excellent example of how algotraders have been consistently earning a substantial income for over twenty years. Algotrading with realistic expectations of returns and drawdowns with a proper, adequate understanding of how the market works is quite a successful business.

Testing does not work

We periodically see such statements on the Internet. Testing is a very important element of algotrading that helps us understand how a particular strategy behaved in the past. However, testing has several limitations and peculiarities, without understanding which it is useless. Yes, testing does not work if you do not understand what you are doing and how to test the system with satisfactory accuracy. But in case you know and understand perfectly well what you are doing, testing is an indispensable thing.

Grids and Martingale work

Yes, these types of systems do work, but not for very long. As a rule, not long enough for a trader to withdraw his deposit before losing it. Especially dangerous are the systems that have managed not to lose at least a couple of years. They accumulate hundreds of thousands of dollars on PAM accounts before they are lost. As a rule, investors either do not understand what they are risking, or they understand it very well but hope it will not happen to them, that they will be able to sense the moment of losing the capital beforehand and manage to withdraw their capital and considerable return.

Indicators do not work

Now it's very fashionable to curse indicators. Every second thinks that indicators do not work. And while they think so, traders benefit from indicator systems, and algotraders successfully use indicator Expert Advisors. An indicator is simply some transformation of price into a different, more convenient mathematical format. Like a real price, the stream is converted into a Japanese candlestick. It's about the same.

How to Install an Expert Advisor on MetaTrader 4?

Since the trading robot for currency trades is represented by a software algorithm, you need to install it correctly and correctly. Here is a step-by-step instruction on how to connect the advisor to a trading platform.

Loading the Expert Advisor. The manufacturers place the file with the software on their official website. The trader downloads the folder with the advisor. The structure of the file is represented directly by the robot, settings, and archive with additional indicators.

Installation. The trader unzips the archive and installs it on the trading floor. It is sufficient to follow the standard instructions: all of the elements of the file are copied and placed in the appropriate folders of the terminal. After these manipulations, the robot is installed on the platform, but it is not activated.

Connection to the chart. If the trading terminal has already been started, you need to restart it so that the data is updated and begins to work synchronously. For the program to start analyzing charts, check the checkboxes to allow automatic trading through the platform. Then using the navigator panel with the mouse drag and drop the Expert Advisor on the chart.

Adjustment of the robot. Before trading, the trader adapts the system to the active strategy. This is done by adjusting the program. If necessary, the input parameters of the Expert Advisor are loaded. For the advisor to correctly respond to all changes in the currency market, a periodic adjustment of the strategy will be required.

Getting started. Having completed all the installation and setup steps correctly, the user will find a robot icon and a smiling smiley face in the upper right corner. It is important to understand that the program will not start trading immediately after installation, it should take enough time for all the preset parameters to coincide with a successful trade.

Pay attention that the advisor trades only in the active terminal. When the client turns off his device, the work will stop.