Last Updated on 3 March, 2021 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 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. 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 is 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.
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:
- Expectations: Looking at what algorithmic trading is and debunking common misconceptions
- Advantages of Algorithmic Trading: Listing some of the most significant advantages of algorithmic trading
- What you need: Computer, Trading Software, market data…
- Psychology: Is Algorithmic trading easier on you than discretionary trading?
- Trading Strategies: Taking a look at a few of the most common trading strategies that you will trade as an algorithmic trader
- 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.
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 – 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- 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 will mainly depend on two things:
- The robustness and quality of the trading strategy
- 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?
Algorithmic 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!
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, that 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!
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 are 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.
Traders who have traded for some time know that what often keep them from succeding, 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 an 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!
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?
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!
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:
- 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!
- 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.
- 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.
- Many markets to trade- Futures markets offers 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
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 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.
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 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!
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!
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.
- It crashes sometimes
- 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 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!
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.
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 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!
Amibroker uses a coding language called AFL. While it is not very hard to learn, it is not as easy as Easylanguage or Powerlanguage.
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.
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!
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!
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.
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!
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.
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?
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.
- 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.
- 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.
- 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 with full force if you are not prepared.
Tips to Reduce Psychological Stress
The key to reducing psychological stress is to know what you are doing. Be sure to know your set drawdown tolerance, and try to remain calm knowing that everything is normal, and going according to the plan.
At times when I personally feel stressed over what is happening to my trades and account, I find a lot of relief in just going back to my set numbers and goals. I then quite quickly realize that everything is running fine, and that there is no reason to worry.
The other tip is very practical and is to not look at your daily balance. There is no point in doing that, and it will only upset you in those times when you are losing a lot.
Good sources about Trading Psychology
If you want to read more about trading psychology we recommend you to pick up any book by Brett Steenbarger or Van Tharp.
5. The Algorithmic Trading Strategy
Now we have come to the part of that probably excites you the most, namely the trading strategy. Finding and managing algorithmic trading strategies, quite naturally, is what you will spend most of your time on as an algorithmic trader.
Let’s begin with making clear what we will cover in this section of the guide.
- The Edge And Why It’s Important
- The Main Types of Algorithmic Trading Strategies
- The Process of finding an Algorithmic Trading Strategy
- Curve fitting and robustness testing
- Managing Failing Strategies
- Creating a portfolio of Strategies
- Backtesting tips and tricks
So let’s begin!
The Edge And Why It Is Important
Every trader needs an edge. You simply cannot survive in the markets without it. Despite this, not all traders know what an edge is.
An edge is a recurrent pattern in the market that you can use to your advantage. For example, a simple edge could be that the market has a tendency to rise once it has performed two consecutive lower closes. Actually, let’s try this very idea on the SP500 cash index!
In this test, we buy once the market has performed two consecutive lower closes, and sell one day later. As you see, the curve looks alright, but not much more than that. You would not want to trade this one just yet.
Still, we can say that we have an edge, since the pattern has been successful in identifying profitable entries.
What Makes a Good Edge?
An edge is better off with a simple logic than a complex one. The more conditions your edge has, the higher the chance that it will not work in live trading. The reason for this is curve fitting, which will cover in just a moment!
If we look at the edge above, it is a simple edge. It consists of one or two conditions for the entry, depending on how you see it, and a simple time exit.
However, if you were to find an edge with performance metrics similar to the one above, with the difference that it made use of say 10 conditions, that would be way too many conditions. If I were presented with such an edge, I would disregard it almost at once. The reason once again, is curve fitting.
A trading strategy basically is a refined edge that you consider ready to trade, after having passed your robustness criteria.
By the way, if you are interested in getting edges for your trading, have a look at our unique edge membership! As a Member you get new edges every month, sent to your inbox!
Let’s now have a look at the different types of trading strategies that we use in algorithmic trading.
Different Algorithmic Trading Strategy Types
One of the beauties of algorithmic trading is that you are not limited to one type of trading. You could do daytrading, swing trading, and long term trading, all at the same time, or just choose the one that you like the most.
However, nearly all new traders who begin trading with the attitude that they want to limit themselves to only one trading form, soon change their minds as they discover the huge benefits of trading different types of strategies, in terms of diversification. If you combine strategies of different kinds, you will reduce risk as well as boost returns. We will cover this more thoroughly later in the article!
Let’s have a look at the different types of trading and bring up a couple of real-life examples of trading strategies that we trade ourselves!
Day trading is the trading form that most people want to learn. However, it is a very time-consuming trading form, and even though many claim to know how to day trade manually, the reality is that nearly no-one does anymore. The markets have simply become so efficient that it is hard to find an edge if you are a discretionary trader!
This is where algorithmic trading really helps. The chances of you becoming a successful day trader are many, many times higher as an algorithmic trader than as a discretionary trader. In algorithmic trading, you have the advanced backtesting tools and exact order execution to be able to find and take advantage of the ever more elusive edges that discretionary traders struggle with!
Still, you will find that the daytrading strategies are among the harder ones to find. There certainly is a reason why so few discretionary traders succeed in becoming profitable, so you will have to spend quite a lot of time searching, if you want to find those edges that most traders never will find.
What might come as a surprise to you, is that daytrading edges still must not be complicated. For example, have a look at this strategy. It is a day trader in the S&P 500 futures markets that I trade myself.
This strategy uses not more than 2 conditions for the entry, and still works this well! For the exit, it just closes the position when the market closes.
What I really wanted to demonstrate by showing you this daytrader, is that there really exist great trading strategies that consist of easy logics. As a beginner, that might be hard to grasp at first, which very understandable. You really have no point of reference, and for many, it is intuitive to expect that more advanced works better.
That is certainly not the case!
Daytrading in Other Markets
You can find daytrading edges in more or less any market, except for a few where lack of liquidity sometimes erratic price movements make it nearly impossible.
However, finding daytraders even in less common markets is possible. Just have a look at this daytrader in Cacao.
So as you see, it is possible to do day trading on many more markets than just equities. Combining this with automatic order execution really extends the possibilities beyond what would have been possible for a discretionary trader!
Swing trading is an excellent trading form that many traders short on time resort to. This is a trading style that is much easier to master than day trading, but that does not mean that it does not hold any good potential. Swing trading can be incredibly profitable, and is something you should include in your portfolio to complement the daytrading strategies you build!
Discretionary swing trading is easier than daytrading, and that is also the case in algorithmic trading. When you keep the positions open for a longer time period, the trades have more time to develop in the right direction. For example, look at this swing trading strategy in the Gasoline futures market that holds on to positions up to a week. Just like with the day trading strategy above, this logic is very simple, and only consists of two conditions.
(With slippage $60 round turn)
Now, this strategy, like the daytrader we showed you, is a very good strategy, and while you may very well find strategies like these ones, only a few will be this good.
Still, I do not think it hurts to show you what types of swing trading systems it is possible to come up with! And if nothing else, it serves as inspiration!
Position trading is another form of trading that easily can be traded algorithmically.
Position trading is a form of trading where you look to profit from the larger swings and trends in the market. Position traders typically hold on to their trades for many weeks or months, and therefore have a very low turnaround. This, in turn, means that they are paying very little slippage and fees, since their turnover is so low.
Let’s see what such a trading system could look like! Below is a strategy in the Soybean futures market that constantly is in the market. That is, when it exits a position, we do not go flat, but reverse the position instead. Let’s see what it looks like!
As you can see, the equity graph does not look as smooth as the other strategies shown so far, and that has to do with the smaller sample size. With strategies that trade this seldom, you simply do not have as many trades.
The Logics of Algorithmic Trading Strategies
So, we have now covered the three most common approaches to algorithmic trading in term of trading styles. Let’s now have a look at the different types of logics that we typically base our algorithmic trading strategies on.
We will just cover the three most common ones so that you get an idea of what were are dealing with!
Once we are done with this, we will show you the process of building your own algorithmic trading strategy!
Mean reversion trading strategies are strategies that take advantage of a market’s tendency to revert to its mean, after having performed an exaggerated move in one direction. Mean reversion strategies are most famous in the world of stocks and equity indexes, like the S&P 500. This is also where they tend to work the best, and when designing strategies for stocks, you will find that mean reversion is what works the best in most cases.
However, that does not mean that you cannot find mean reversion strategies on other markets than equities. Just have look at this mean reversion strategy in the Japanese Yen market!
A very well known trading strategy that is based on mean reversion is the RSI2 trading strategy that was invented by Larry Connor. While not being the most profitable strategy out there, it still does work and showcases a major edge in the market that could be refined further.
On our edge page, we have quite a few edges that are based on RSI
Trend following strategies to profit from the exact opposite tendency, namely the tendency of markets to continue further in the direction of the momentum. Thus, instead of interpreting a large swing in one direction as a sign that the market has moved excessively, you regard it to be a proof of strength. In other words, trend following strategies work by riding the market trend.
Trend following strategies are characterized by a quite low win rate, sometimes as little as 20-25%. However, this is compensated by the outsize winning trades, that compensate for the losses.
The low win rate of trend following strategies make them harder to follow than for example mean-reversion strategies. However, with automated trading that is a minor concern!
This is quite an interesting category, and to be honest, I think that we have come up with this name ourselves. So what do we mean by biased trading strategies?
Well, in certain markets there is certain behavior that cannot be ascribed any logic that we typically categorize trading strategies under. For example, it could be that a market tends to move in a certain direction at a specific time. Look at this trading strategy in Gasoline futures. It trades on a market tendency that is limited to only a few hours of the day.
When you start exploring the markets, you will find that there are many types of similar market tendencies to discover and use to your advantage! Different markets have their own special quirks, which really is one of the things that makes algorithmic trading, and trading in general, so fun!
How to Build An Algorithmic Trading Strategy
Since trading strategies are the core of your algorithmic trading business, you will spend a lot of time searching for them. You will have to come up with ideas to test, code them into your trading platform, and then put them to the test to ensure that they are robust enough to continue making profits going forward.
So, let’s cover the process of finding a trading strategy step by step!
Finding Trading Ideas
The first step, of course, is to find out what you are going to test. New traders often wonder how they ever are going to be able to find enough ideas to test to keep them busy. Yet, this nearly never becomes a problem. One idea will spark another and before you know it you will have so many ideas that you cannot see an end to it.
Here are a few tips on how you can find trading ideas to test:
- Be exposed to market data. Soon you will begin to notice how the market behaves, and turn your observations into ideas to test.
- Make notes of what you see in the data. It does not have to be coherent. A single word could be the only thing you need to hatch a trading idea!
- Read about and listen to others speaking about the markets. Listen to trading podcasts and be active on trading forums. Being exposed to the right material just once could be all it takes to hatch an idea that eventually becomes a great trading strategy!
- Take a break! Building trading strategies and testing them is hard. Taking a break helps you process all the information you have exposed yourself to. What you probably will find is that you have more ideas to test after the break than you had before!
Backtest the Idea
The step is to convert the trading idea into code, so that you can backtest the idea. Depending on how specific your trading idea is, there could be more or fewer ways of expressing what you want to test.
For example, you might be wondering what happens specifically when the RSI indicator crosses under a threshold you set. In that case, you really can just program the idea right away.
However, if your trading idea is more general, like “buy after the market has gone up too much in a down trend”, there are endless ways of trying to define:
- The downtrend
- The upswing
You will find that one idea defined differently could make huge differences to the results! So keep on testing!
Interpret the Backtest
Once the backtest has finished loading, it is time to see whether there is any merit in what you have tested. The easiest way of doing this is to simply look at the slope of the curve. If it is sloping upwards, like in the image below, you might have found something.
Other traders might instead want to pay closer attention to the performance metrics of the backtest. This is completely fine too, and is really a matter of preference!
Now, if you think the edge idea holds any merit you may continue experimenting. Try to add filters and conditions and see what happens! Many times it might just take one more condition to filter out a lot of bad trades and really improve on the strategy!
After this, there still is one thing that you must learn to do! Actually, some people would say that this is THE most important step in designing a strategy.
And we agree!
Many new traders believe that they just have to create a nice looking backtest in order to make money in the markets. However, as they soon discover, a good backtest in itself is not indicative of future performance.
In the markets, most movements are random and cannot be derived from any sort of analysis. In our search for trading strategies, we try to profit from the tendencies in the markets that are non-random, and knowing what is random and not is one of the most challenging parts of trading strategy design.
If the trading strategy just happened to match with some of the random market action during our test period, the trading strategy is just the result of pure luck. If you decide to trade such a strategy, it nearly always just falls apart, and starts to lose as soon as it is subjected to new market data.
The Perfect Trading Strategy
Curve fit trading strategies often look fantastic, since the creator has optimized every parameter to find the absolute best ones. However, the best parameters historically are unlikely to be the best ones going forward, and if you position size according to overly optimistic backtests, that could in catastrophe!
Therefore, never choose the absolute best parameter combination. Look around the optimum and choose something that has performed well, and has good surrounding values.
In our algorithmic trading course, we guide you through this in greater detail!
Do profitable Traders Curve Fit Strategies?
What separates profitable traders from losing traders is not that they do not curve fit. Instead, they have found ways of discovering which ones are curve fit BEFORE going live. When we build trading strategies a majority just fails miserably, but we very seldom trade those, because we have a process of separating the wheat from the chaff!
Let’s have a look at some methods that you can use to find out if a trading strategy is robust or not!
For a longer description of curve fitting, check out our article on the topic!
There are several methods you can use to test the robustness of a trading strategy. Here are our favorites;
- In sample and out of sample testing
- Walk Forward Analysis
- Forward Testing
In sample out of sample testing
In sample testing and out of sample testing is a method where you divide your backtesting data into two parts:
- In sample
- Out of sample
You then backtest and tweak the strategy on the in-sample data. Once you feel ready, you load the out of sample portion of the data, and see how the strategy perform on that data. If it fails, you have probably created a curve fit strategy. However, if it works you might have a strategy with a true edge in the market worth trading!
The premise of this method is that real market behavior, which is the only thing we want to trade, will persistent throughout both the data sets, while random price action will not. Therefore, if the strategy fails on the out of sample verification, it is a sign that our rules have just captured random market noise.
However, as you get more and more familiar with the markets and learn how they operate, the out of sample becomes less and less valuable to you. For example, if you have been following a market that you know has experienced a great bull run lately, you might use this knowledge in your strategy development to create a system that is biased towards a bullish market environment.
However, one of the worst mistakes that many traders make is that they indeliberately convert out of sample data to in sample data. This happens when you validate your strategy on the out of sample data, and then return to the in sample to further refine the idea since it did not pass the validation.
Out of sample data needs to be unseen not to lose its value!
Walk Forward Analysis
Walk forward analysis is another method that builds on in sample and out of sample testing. It works by applying a rolling window of in and out of sample tests, where the out of sample results are then merged to create a backtest report that is completely out of sample. So if we were testing a strategy on data between 2010 and 2019, a Walk Forward analysis of the strategy could work in the following order:
- Optimize the strategy on data between 2010 and 2012, and apply the best settings to 2013, which is the out of sample
- Now the Window is moved forward. We optimize the strategy on data between 2011 and 2013, and apply the best settings to 2014.
- And it goes on, until we have covered the whole backtest period.
As you can see, for each time we go through one of the steps above, we get one additional year of what could be said to be out of sample data. When you then merge these out of sample portions of the backtest, you get something that comes close real out of sample for the whole period.
Still, there are many ways you could curvefit the settings you use in for the Walk forward optimization itself! For example, you could adjust the length of the out of sample and in sample windows, until you find some settings what work by random chance. There is also the possibility that you curvefit the optimization ranges, meaning that you narrowed down the parameter settings to a very narow optimum
This one is quite straight forward now that you are familiar with in-sample and out of sample testing. With forward testing, you let the strategy sit and evaluate its performance after some time has passed.
The benefit of this method is that you cannot let your biases fool you, since the future is unknown.
Another benefit is that it gives us the time to step back a bit and view the strategy more realistically. When you have just created a strategy it is not uncommon to overestimate its greatness and become overly excited about its potential. If you wait some time you will gain a more objective view of the situation!
There are many mistakes you can make when testing a strategy for robustness, and that is why robustness testing is an integral part of our algorithmic trading course!
Managing Trading Strategies That Stop Working
Every trading strategy has a limited lifespan, and every strategy is going to fail eventually. It does not matter how rigorous your robustness testing procedures are, or how cautious you are. A few of your trading strategies still will fail, regardless!
Of course, rigorous robustness testing, as we teach our students, will make those failing strategies much fewer. Still, you cannot expect that all strategies continue working, and there are two main reasons for that:
- The strategy was curve fit from the beginning
- The market has changed
Even if you let your strategies go through the toughest robustness testing procedures you can think of, there still is a small, small chance that they were curvefit, and were lucky enough to pass the test anyway.
However, if you have solid robustness testing methods, the main reason that your strategies fail will not be this, but changes in the market. Markets change all the time, and if those changes happen to some behavior that your strategy was based on, that strategy may simply just stop working.
How to Deal With Failing Strategies
Since failing strategies is an inevitable part of algorithmic trading, you need to set clear rules on when you should switch a strategy of. For example, you could measure the maximum historical drawdown of the strategy, and decide to stop trading it once it goes into a drawdown that is x times deeper. You certainly want to cut your losers short and let the winners run!
Knowing how and when to switch a strategy off is essential to profitable trading, and is something we go into more in our algorithmic trading course.
Why You Need Several Strategies: The Importance of the Portfolio
As we have touched on several times in the article, there are immense benefits in spreading your risks across many different markets and timeframes. Many new traders look for the one perfect strategy, and do not realize that they need several strategies in different markets to be able to get those returns that they dream of.
These are the main reasons why you should trade several strategies:
- You will make more money, at a more consistent rate – Since two trading strategies never will be completely correlated to each other, that means that trading both will make your equity curve smoother. When the first strategy is in drawdown, the second might make a new high, which evens out the curve.The more uncorrelated trading strategies you have, the smoother the curve will get. And with a smoother curve, you can trade more strategies at the same time, which will increase the profit potential manyfold!
- The failure of one strategy does not matter as much- If you trade many trading strategies at once, the failure of one strategy will not matter that much, since some of your other strategies hopefully are making new equity highs.
- You decrease the risk- Having your profits made in different market and timeframes will help to reduce risk. For example, if one market is out of sync at the moment, there will be others that play well with your strategies.
As you can see, there is no question as to whether you should trade only one or several strategies. That is also why all our students get 10 trading strategies in varying markets, that we trade ourselves!
Backtesting Tips and Tricks
Mark to market equity curve.
When you backtest a trading strategy, you most times have two choices as to how you want to present the backtest results:
- Mark to Market
- Closed Trade Equity
Mark to market plots the trades as they developed, while closed trade equity just plots trades as they closed.
The latter might become an issue if you are using a strategy that stays in the market for a long time, and therefore could experience great swings within each trade. If these swings are not shown, as with the closed trade equity, you could misjudge the strategy’s performance. The reason is that a trade could experience a huge drawdown, without leaving a mark, if it was exited later once it had recovered.
Here are two backtests. The first chart shows the closed trade equity while the second chart shows the mark to market. The strategies are the same.
Include Slippage and Commission!
Many traders forget to include trading fees and commission in the backtest. While this might not be too serious if you are dealing with strategies with a high average trade, where commission slippage nearly goes unnoticed, you could fool yourself with strategies that have a very low average trade.
In fact, there are many tiny edges that simply may be too small to be traded profitably once commission and slippage are taken into account.
In our algorithmic trading course, we have a cheat sheet where we list the appropriate slippage amounts for each market.
Do not use the Optimizer to Find the Best Value
Most modern backtesting platforms come with an optimizer that enables you to find the best parameter settings for your strategy. Having that said, that is not how you should use the optimizer.
Running and optimization and then picking the best values right away, is very prone to curve fitting. What you want to do instead, is to run the optimization, and then look at all the values to get an overview of how the strategy performed across all the parameters. If you find that there is an optimum with surrounding strong values, then it could make sense to choose parameters close to that optimum. However, if that is not the case, there is a greater chance that you are just cherry-picking some random settings that worked well out of nothing else than luck.
We hope that this guide has made algorithmic trading easier to grasp, and that we managed to convince you that algorithmic trading is the best trading form out there for traders who are serious about their trading.