April 7

Algorithmic trading -The COMPLETE guide | Learn to be an Algo Trader!

0  comments

Last Updated on 7 April, 2022 by Samuelsson

Many people have a dream of having a computer that trades for them so that they don’t have to care for the order execution or anything else trading related. While no such trading exists, algorithmic trading comes very close, and according to us, it certainly is the best trading form out there!

Algorithmic trading, or algo trading, is when a computer is given a script or code called a trading strategy, that is executed for you. With algorithmic trading, you are free to do whatever you want while the computer takes care of the trading for you. Everything is data driven. However,  you still have to check in on your algorithmic trading strategies regularly to ensure that everything runs smoothly.

At the Robust trader, we believe that algorithmic trading work and are superior to other trading forms in many regards. It makes it possible to trade an almost limitless amount of strategies at once. In fact, we trade over 100 strategies ourselves in many different markets! Those strategies range from day trading, to longer-term position trading.

Algorithmic trading -The COMPLETE guide | Learn to be an Algo Trader!

As you might have understood, algorithmic trading is not limited to one trading form, but encompasses everything from fast-paced day trading, to much longer-term position trading!

In this complete guide to algorithmic trading, we aim to provide the most extensive guide to algorithmic trading on the web!

Here are the things we will cover:

  1. Expectations: Looking at what algorithmic trading is and debunking common misconceptions
  2. Advantages of Algorithmic Trading: Listing some of the most significant advantages of algorithmic trading
  3. What you need: Computer, Trading Software, market data…
  4. Psychology: Is Algorithmic trading easier on you than discretionary trading?
  5. Trading Strategies: Taking a look at a few of the most common trading strategies that you will trade as an algorithmic trader
  6. How to Build an Algorithmic Trading Strategy: Going through the process of finding a good and robust trading strategy; from hatching the idea to a complete, tradable system.

Table of Contents

Algorithmic Trading Glossary

Before we start, we just want to make sure that everyone is with us and knows what we mean by the following concepts:

  • Backtesting – When you backtest, you test an idea on historical data to see if it holds any merit
  • Curve fitting – Curvc fitting, means that the strategy is fit to random market data, and does not work in live trading (is covered more in-depth later)
  • Walk Forward- Walk forward is an analysis method to test the robustness of a strategy (Covered later)

1. Setting the Right Expectations

Trading is a topic that newcomers tend to approach with a somewhat irrational approach. There seems to be a widespread belief that money can be made easily, and that anybody, regardless of experience, can learn to trade just by reading a few articles, and then practicing what they have read.

This is NOT the case.

Trading is something that requires hard work and a lot of time. Since trading indeed holds great profit potential, much greater than passive investing, as an example, it is not strange that it attracts many fortune hunters. And with a constant influx of new market participants, leading to increased competition, only those better than the average fortune hunter will succeed.

With the advent of digital trading and the markets becoming more accessible to more people, the competition is constantly increasing. While a moving average cross worked very well in the sixties, most strategies of that kind do not work anymore. Trading is becoming harder, and you need to step up your game in order to get those high returns that you dream of!

Can you Make Money On Algorithmic Trading?

Yes, you certainly can make money with algorithmic trading! The game is becoming harder, but the fact is that this is impacting algorithmic trading LESS than other trading forms.

In fact, we really believe that more and more people will begin to discover the incredible benefits of algorithmic trading over discretionary trading, as the latter soon will experience very limited profit potentials with more efficient markets. Finding an edge discretionarily is MUCH more challenging than finding one through backtesting when done correctly!

Algorithmic trading is the answer to how traders will be able to continue making money in the future!1

So, How Much Can You Make?

How much money you can do in data-driven trading will mainly depend on two things:

  1. The robustness and quality of the trading strategy
  2. Position Sizing

Since the trading strategy is the base of all your trading activity, its quality and robustness, which we will cover later in this guide, dictate how much money you will make.

However, the second determinant is how much you risk. Quite naturally, if you risk double the amount you will also make double as much money. The constant balance between risk and return really is one of the hardest things you face in algorithmic trading, and trading in general.

Risk too much, and you are soon out of the game. Risk too little, and your returns might suffer.

If we were to answer this question in the best fashion possible, it should be how much you can do RISK ADJUSTED. The answer then becomes something like this.

In algorithmic trading, you can make somewhere between 1-3 times your maximum drawdown in returns. That means that if your maximum tolerated drawdown is set to 30% you could get returns between 30- 90% a year. 

This really is a broad range, but it is the best answer you will be able to get, considering that trading strategies vary in robustness and quality!

Algorithmic trading really is the trading form that is most likely to give you these kinds of fantastic returns. Unlike discretionary trading that often heavily relies on talent and the trader’s proficiency in reading the market,  algorithmic trading is replicable and can really be learned by most people.

Will I Make Money Every Day?

Many new traders believe that they will make money every day. That is never going to be the case. You will have losing days, and even losing weeks and months. However, in the long run, you will certainly make money if your strategies are robust and keep risk at a healthy level.

What you will find is that your profits are seldom going to be evenly distributed throughout time. Rather, you will find that most of your profits are made in maybe 20% of the time, while the account spends the rest of the time doing not that much in terms of growth.

In other words, if one month passes by without you making profits, that is completely normal and by no way a sign that what you do does not work!

So how hard is it to Learn Algorithmic Trading?

Learn Algorithmic Trading?
Learn Algorithmic Trading?

Algorithmic trading (data driven trading) is hard to learn if you are on your own! There so much contradictory advice, and it is impossible to know whose advice to take seriously. The fact that much of the information out there is outright detrimental to take in, does not make things easier.

In such a case, taking a trading course is probably the best thing you can do. Learning algorithmic trading by yourself is going to take years, and an investment in an algorithmic trading course will pay itself many times over! With a great course, you could be going in just a few months, creating your very own algorithmic trading strategies.

However, trading always requires a lot of work. You will have to spend many times in front of the computer in search of new strategies to trade! Still, it is really rewarding and exciting, since you learn new things all the time about the markets and how they work!

If you find trading interesting already, we are sure that you will find strategy development fun and rewarding! And if you do not find time to build enough strategies, you can always buy a trading strategy from a trusted vendor!

One Quick Tip…

Do not expect everything in trading to be perfect. Of course, you want to minimize mistakes and make the best out of everything you have, but you need to accept that very much is beyond your control.

What we see with many of our students is that they become frustrated over that everything does not go their way. All in all, it is going well for them, since they have learned a solid methodology that we have used for years. Still,  the frustration o seeing rejected orders, and things that go less smoothly, cause them a lot of frustration.

Most times, after a while, they realize that the frustration and anger does not help, and just accepted reality as it is. They understood that they are going to have issues from time to time, and that trading in some respects is an imperfect business.

Now, do not get me wrong. Automated trading works very well today, but issues still will arise from time to time! Nothing is perfect!

Change your expectations by realizing this, and you will save yourself from a lot of frustration and anger!

Ending Words

Learning algorithmic trading is hard and laborious. Put in the effort that is needed and push yourself through the first months, and you will soon be able to reap the rewards of your hard work. The feeling of trading an algorithmic trading strategy that you have developed yourself is truly amazing, and will make you want more!

If you come to the stage where you have your first strategy, we are certain that you at least have found yourself a new hobby, if not your future full-time job!

2. Advantages of Algorithmic Trading

Before we go into what you will need, let’s cover the benefits of algorithmic trading!

More Free Time

As an algorithmic trader, you do not need to sit by your computer all day! The computer will take care of the trading for you, and you are free to do other things that interest you! It certainly is possible to have a day job on the side, since you can work on your trading whenever is the best time for you. This is a clear advantage over other trading forms like daytrading, that requires you to be present during the market opening hours!

Better Risk Handling

Since the computer takes care of the order execution, there is no limit to how many markets you can trade simultaneously.

The benefits of this cannot be stressed enough! As a manual trader it would be impossible to trade more than a few markets simultaneously. Being diversified across many markets if one of the best ways to decrease the risk level of a portfolio!

The Computer Never Sleeps

Many markets are open throughout the night, and only close for a short time before opening again. Trading algorithmically will ensure that you are always ready to take a trade, even when you are asleep. This is perfect for markets such as gold, which tend to behave differently depending on in what part of the world it is currently traded the heaviest.

Being able to trade a market nearly 24/7 means that new trading opportunities arise, and in the end, more money for you!

More Money

When trading many different markets, you will more often than not realize that your strategies are uncorrelated to each other. This means that when one strategy is in drawdown, another makes a profit and vice versa. The less uncorrelated your strategies are, the more strategies you can trade simultaneously, which means more money!

Better Trading Software

Trading software is getting better and better, and more beginner-friendly. Together with the increase in computer power, you can achieve things that algorithmic traders of the past could only dream of.

Fewer Mistakes

Traders who have traded for some time know that what often keeps them from succeeding, or at least is the source of most mistakes, is themselves. Trading is hard psychologically, and automating as much of it as possible will ensure that making mistakes is kept to a minimum.

You Have An Edge

Algorithmic trading strategies are backtested rigorously before employed and traded live. This ensures that you know your odds before you start trading, and can adjust your position size accordingly.

Networking Gets Easier

Sharing knowledge about your trading methodology is a nearly impossible task if you are a discretionary trader. Algorithmic traders have the benefit of having strict, quantifiable rules that they follow, and therefore are able to easily exchange information with colleagues.

In fact, networking is one of the best ways of increasing your productivity in your trading. For example, by sharing trading strategies, you could soon have several strategies ready to trade, which could save you many days of hard work!

Easy Start for beginner

While algorithmic trading, as all trading forms, takes a long time to learn, there is one way in which algorithmic traders can jump-start their careers. By buying a trading strategy you can start to trade immediately, and do not have to spend the countless hours that are necessary to come up with a trading strategy!

Less emotional

With discretionary trading emotions play a big role in keeping you from succeding. Algorithmic trading will help you to break free from these, since the trading is carried out by a computer. As such, there is less room for you to interfere with your strategy, which will save you a lot of time in the long run!

3. What You Need

In order to start your algorithmic trading career, you will need a number of things when it comes to software and hardware:

A starting Capital: The amount of money varies depending on what markets you want to trade.

A trading platform: There are several options on the market, and we list the ones we like best for you!

Market Data: In most trading platforms you need to import market data into your trading platform to have something to work with.

Infrastructure: Servers, Computers, backups, emergency power supply, etc.

As you can see, there are a number of things that you will need. Let’s have a closer look!

The Starting Capital: How Much Money Do You Need in Algorithmic Trading (data driven trading)?

This is a question that we receive a lot, and one that is hard to answer in one sentence. The needed capital is dependant on several factors, such as what level of diversification you strive to have, your risk tolerance, and what securities you choose to trade. For example, trading futures will require more capital than trading stocks, due to the bigger size of futures contracts to stocks and ETF:s.

Let’s have a closer look at the two!

Futures

We typically tell our students that they need at least $20000-$25000 if they want to trade futures, in order to keep the risk at an acceptable level. This is because it is hard to find trading strategies on futures markets with a stop loss smaller than $750, which is an appropriate amount to risk on every trade if your account is around $25000.

Another reason is that the historical drawdown in the backtest, which we use to get an estimate of how large a drawdown we can expect in the future, is hard to get to levels that could enable trading with a smaller account than that.

Still, if you can spare more money, it would be even better, since you could start trading more markets and timeframes simultaneously, which helps with reducing risk!

However, with the advent of micro futures, the world of futures trading is now opening up to the larger masses with less money to trade! We are following this carefully and plan to soon implement it in our trading course.

Stocks and ETF:s

When it comes to trading futures and ETF:s the capital requirement is lower, and you could start with as little as a few thousand dollars.

What Should You Choose? Futures vs Stocks and ETF:s

Here at The Robust Trader, all our algorithmic trading is done on the futures markets, and there are good reasons for that. Through futures, you can get exposure to a wide range of markets, which enables superior risk handling that comes from having your profits made in many uncorrelated markets.

Here are some advantages that futures hold over ETF:s:

  1. Leverage – Futures come with inbuilt leverage, which means that you control many times the capital that it costs to enter the position. Leverage indeed is a double-edged sword but used right it will be of immense help in your trading!
  2. Liquid Markets – Many of the futures markets are more liquid than their ETF counterparts. Liquidity is very important since low trading volume will increase the spreads and lead to you paying excessive slippage.
  3. Easy to go short – Another advantage of futures is that going short is exactly as easy as going long. You do not have to worry about things like uptick rules or short selling becoming banned. If you trade futures, short selling is always an option.
  4. Many markets to trade- Futures markets offer easy access to a wide range of different markets. In our own trading, this really helps with achieving higher returns, since the markets become so uncorrelated. ( More on this later)

So if you are choosing between ETF:s and stocks, we really recommend that you go with futures offer ETF:s. They offer more flexibility which makes achieving high returns easier!

A Trading Platform

Trading Platform
Trading Platform

As an algorithmic trader, you are going to rely heavily on your trading platform and software.  You will need the platform to backtest strategies, test them for robustness, as well as to automate the order execution.

The heavy demands of a serious algorithmic trader really rule out much of the alternatives on the market.

However, that does not mean that there are no options! Trading software has gotten much better compared to only a few years ago, and there are good alternatives that have all the features that an algorithmic trader will need!

At The Robust Trader, we use Tradestation, Multicharts, and Amibroker. They all have their strengths and weaknesses.

For example, Amibroker is superior to both Multicharts and Tradestation when it comes to backtesting baskets of securities. However, Tradestation and Multicharts hold advantages in other areas, such as automatic order execution and some more advanced backtesting features.

Let’s have a look at these three platforms, and see what makes them so great! We will begin with the platform that we like they most, namely, TradeStation!

TradeStation

TradeStation
TradeStation

Tradestation is our preferred trading platform. It has survived on the market for a long time, and has been given many new features over the years. Tradestation is also a very popular platform as can be seen by Tradestation user stats.

The thing that differentiates TradeStation from the two other platforms on the list, is that TradeStation is broker, trading platform, and data provider, all in one. That is really a convenient solution, since the other options in this guide require you to buy market data from an external data provider and connect the trading platform to the broker. With Tradestation you do not have to consider any of this. You simply download the software, log into your account, and that’s it!

To get TradeStation, you need to have an account with TradeStation, if you do not want to pay the $99 monthly subscription fee. However, using the platform is free for brokerage clients, and much of the market data you need is included as well!

This is a huge plus, considering that market data can cost you quite a lot of money, which might not be bearable for traders with small capital!

Easy Coding Language

Tradestation uses a coding language called “Easylanguage” and just as the name implies, it is very easy!

Not complicating the coding part of algorithmic trading will save you a lot of time, since you want to spend your time testing ideas, and not struggling with the coding language. Easylanguage is very intuitive and easy to learn. It should not take you long at all to be able to code some simpler ideas!

For example, if I want to code the following idea in easylanguage it would look like this:

Idea: Buy if RSI2 crosses over 50

Easylanguage Code: If RSI (Close,2)  crosses over 50 then buy the next bar at open;

Easylanguage is very similar to spoken English, which is what makes it so easy to learn!

Powerful Backtesting Features

With TradeStation, you have access to many powerful backtesting data driven features, and as with all the other software on the list, Tradestation lets you optimize your trading strategy to find the best settings.

You also have access to a Walk Forward optimizer and Cluster analysis, which are two powerful methods to test the robustness of a trading strategy!

Auto Trading

Tradestation can auto trade your strategies for you with the flick of a few switches. This works really well most of the time, but you should check in on your systems daily to make sure that it runs well. However, this is not unique to Tradestation, but applies to every solution out there!

Tradestation Disadvantages

According to us, there are two major downsides to TradeStation. However before listing them let us once again remind you that TradeStation remains our top pick, despite these issues.

  1. It crashes sometimes
  2. It is slower than the competition

Tradestation has a tendency to crash sometimes. However, once it does, you just need to restart the program. It will prompt you to save your work before it closes, so you will a chance to save your data. At least that is our experience, after having used TradeStation for many years!

Fortunately, during auto trading, the platform runs smoothly and without issues. At the time of writing this guide, my TradeStation has been active on my remote server for about six months, trading 24/7, without one single crash!

As to the speed of the platform, it is slower than the competition, but that does not mean that it is a major gamechanger. We find that it does everything we want out of it, at reasonable speeds. However, if you are looking into testing massive portfolios of stocks, then you might be better off with Amibroker.

Multicharts

Multicharts
Multicharts

Multicharts is one of the best trading platforms out there. It is quite similar to TradeStation in some regards, but is not a broker nor a data provider. These are services that you need to buy yourself, which depending on how you see it could be an advantage or not. While TradeStation is convenient with its inbuilt broker connection and data feed, Multicharts leaves you with far more options. There are many brokers to choose from, and the platform supports a range of data feeds, which really means that you can set up your trading exactly as you wish!

However, all this comes at a price. Unlike Tradestation, Multicharts is not free and will cost you around $1500!

Coding Language

Multicharts uses a coding language called “powerlanguage” which is really similar to TradeStation’s Easylanguage. Most of the time the languages are cross-compatible, and you should be able to import code from one platform to the other without issues.

Since the coding language basically is a copy of that found in TradeStation, it also is really easy to learn, and suitable for people who might not be that keen to learn a whole new programming language.

Powerful Backtesting Features

Multicharts comes with powerful backtesting features just like TradeStation. You can backtest your strategy as with most other advanced trading platforms, and perform Walk Forward and Cluster Analysis testing.

Auto Trading

Multicharts includes great auto trading capabilities, and will auto trade your trading strategies for you. Just be sure to check in on the systems a few times per day to make sure that everything runs well!

Amibroker

Amibroker
Amibroker

Amibroker is another trading platform that we use at the robust trader. When it comes to portfolio backtesting on many symbols at once, this is the fastest option of the three, by far. Testing a basket of securities on 10 or more years of data is done in seconds!

Coding Language

Amibroker uses a coding language called AFL. While it is not very hard to learn, it is not as easy as Easylanguage or Powerlanguage.

Backtesting

Just like Multicharts and TradeStation, Amibroker provides powerful backtesting features like Walk Forward Analysis. As already mentioned, it is really fast, which makes this the perfect choice if you are looking to backtest baskets of symbols at once.

Auto Trading

Unfortunately, Amibroker does not come with default autotrading capabilities, but there exist solutions to connect the platform to Interactive Brokers.

If you are looking for a trading platform that will do everything, Amibroker might not be the best option. However, for strategy development and portfolio backtesting it is still a great pick!

Which Algorithmic Trading Platform Should You Go For?

We think that Tradestation is the best choice. You do not have to worry about the connection to the broker or market data, and it has all the features you will need! In addition to this, the coding language is very beginner-friendly and should not become an issue for you! Tradestation is the platform that nearly all our students use and despite its shortcomings, most are happy with it.

If there is one thing you should know about trading, it is that nothing ever will become perfect! We have touched on this one time earlier, but I think it is worth mentioning one more time!

Market Data

For both Multicharts and Amibroker you will have to find an external data provider. Keep in mind that you will need both historical data and real-time data. The former will be used in the development process when you test the strategy, and the latter is a requirement if you want to auto trade your strategies down the road.

Here we have listed some market data providers. Make sure to choose a plan with at least 10 years of historical data. You will need it!

  • E-signal
  • IQfeed
  • Barchart

Can You Use Free Market Data?

If you are serious about your trading and do more than casual tests out of pure curiosity, free market data will not suffice. In order to ensure that the backtest results you get are accurate, you have to make sure that the data is accurate too. Free market data is seldom of good quality, and could put you at risk of getting inaccurate backtesting results.

Infrastructure

In addition to the Starting Capital, a trading platform, and market data, there are some more things you will need.

A Remote Server

Leaving your strategies running on your home computer could work, but never is as good as buying a remote server to host your algorithmic trading.  When hosting your trading on your home computer there are man things that could interfere with the order execution. It could be things like connectivity issues, power outages, or some of the computer components failing.

While all this can happen to a remote server, the risk that it will is much smaller, and if it were to happen there is always someone who takes care of it for you. The server will soon be up and running again, and you can resume your trading. If your trading is hosted on your home computer and something goes wrong, you might not be there to take care of it in time!

Backups!

Backups
Backups

This point cannot be stressed enough! Always keep backups of your work! Make sure to backup the trading platform, your files, and your code. As you will learn soon, building a trading strategy takes a lot of time, and you do not want your work to disappear in the event of hardware failure!

We recommend that you backup your files to one or several cloud storing services, and keep physical copies as well. You really cannot (almost) go overboard here, since it is your collection of trading strategies that is the core of your trading business!

A Powerful Algorithmic Trading Computer

If you ever have been on trading forums, you have probably heard about traders who want advice on what computer they should get. They are worried that their computer is too slow to be able to optimize through hundreds of thousands of iterations, and ask for advice.

The truth is that you very seldom will be doing these types of massive backtesting studies, since they are so prone to curve fitting. (Which we will cover later in the article)

Besides, modern computers have gotten so powerful that you do not have to go that far up the price ranges to find something that will cover all your needs. In our article on trading computers, we go through this in greater detail!

In order to give you some tangible tips, these are our minimum recommendations for a computer that will be used for algorithmic trading.

CPU: A modern CPU with 4 or more cores.

RAM: 8gb

If you do have the money to spend however, it is not a bad idea to go up a little more in price and get something more powerful. However, do not look beyond typical retail products like Intels I7 series. Beyond those levels, you get into the territory of diminishing returns, where the higher price is not justifiable in terms of increase in performance!

4. Psychology of Algo Trading: Is it Easier Than Discretionary Trading?

Trading Psychology
Trading Psychology

Since Algorithmic trading relieves you from the burden of placing the orders manually, many people believe that algorithmic trading is easier than manual trading.

We agree that this is the case, but that does not mean that algorithmic trading relieves you from all the psychological pressures that are associated with trading.

That said, algorithmic trading really is the savior of many traders who cannot cope with the intense psychological pressure that comes with trading. Nowadays when markets are as efficient as they are, it does not take much for a traders to give back most of his or her profits in a short burst of loss of self-control, where the predefined rules no longer are followed.

If you could limit the occasions when you are making a decision as a trader, you will also limit the damage that you make to your trading. This is exactly what algorithmic trading does when you are no longer in control of the order execution, provided that you do not interfere manually!

So, if algorithmic trading is easier from the psychological standpoint, what is then that makes it psychologically demanding?

Why Algorithmic Trading is Psychologically Demanding

Even if the order execution is automated, there are few reasons why algorithmic trading still is psychologically stressful.

  1. You Still Follow the Order Execution – If you still actively check in on your trading server, as you should, you will see the profit and loss for your ongoing trades. This becomes especially stressful if you keep track of the daily changes of the account balance.
  2. When you develop the trading strategy- Finding good edges and strategies( which is a topic we will cover very soon) is hard, and could give rise to a lot of frustration and angst.
  3. When Being in a drawdown- Being in a drawdown is one of the psychologically most stressful experiences for discretionary traders. However, algorithmic traders are not spared this inconvenience, and it will strike wit