This article is primary for traders & investors who are looking to enter the world of algorithmic trading.
Algorithmic trading refers to the use of computers to buy, sell or hold a stock. Computers are given a set of rules or instructions also called as algorithm, based on which computers make decisions. Algorithmic trading can be semi or fully automated.
- Semi-Auto Mode: Computers give suggestions which helps traders to make better decisions. Traders make a final decision on whether an order should be sent to the exchange.
- Full-Auto Mode: Computers place orders onto exchange without any manual intervention.
An algorithm plays the role of a trader’s brain in algorithmic trading system. An algorithm has 2 basic components:
- Rules: Define trading logic
- Example: Buy when price moves above moving average
- Parameters: Allows traders to customize rules
- Example: Moving average calculation period (N days)
Algorithms in the trading world can be broadly categorized into 2 categories:
- Fixed Algorithms
- These algorithms have fixed set of rules which can be customized using parameters
- Self-Learning Algorithms
- These algorithms make use of machine learning techniques. They have fixed rules as well; but some of the decisions they take are based on machine-learning. So the behavior of these algorithms is difficult to determine.
- They are complex in nature & difficult to write as well
- A highly sophisticated machine learning algorithm can give extremely good results & is capable of handling different phases of the market (high/low volatility, uptrend, downtrend, sideways trend etc.)
- A common misconception among beginners is that algorithmic trading is like a money making machine. This is absolutely wrong; algorithmic trading has its pros & cons.
- Just start algo-trading on your computer & forget about it (it will make money). This is not true in most successful algorithmic setups. The algorithmic systems require monitoring. In sophisticated systems, this monitoring is also automated. But you still need to be present in case any event occurs, which the system is not designed to handle. Some examples are:
- Internet connectivity issues
- Broker system issues
- Bugs in the code of algorithms
- Extreme movement in stock markets caused by major events like war, election results etc.
- Takes away emotions
- Orders are entered rapidly & you can easily monitor and trade any number of stocks
- No data entry errors
- Automated monitoring and alert systems mean that you do not have to constantly monitor your portfolio as well as the market
- If your strategy code has bugs, then you may get unexpected results & could lead to extreme losses if not monitored
- Most algorithms are not capable of handling extreme market events, so you may face losses on events like war, election results etc.
- You need decent understanding of markets as well as technology (programming language)
- A computer cannot handle an event that it is not programmed to handle, even machine learning is not guaranteed to be able to successfully handle all events
To keep it simple, let us look at the most basic way of calculating performance.
Let’s assume you assign 100,000/- to your trading system & your system generated a profit of 45,000/- in one year. The total expense of trading is 5,000/- (brokerage, taxes etc.).
So you generated a net profit of (45,000 – 5,000) = 40,000/- on an investment of 100,000/-.
In percentage terms, you generated 40% per annum return on your investment.
% return = Net Profit / Total Investment * 100
= (45,000 – 5,000) / 100,000 * 100
= 40,000 / 100,000 * 100
Just for reference, 40% is a very decent performance if you are trading a large portfolio.
Factors Affecting Performance
- Trading Algorithm (Strategy)
- This is the single most important factor. If your trading rules are good, you will make money else you will lose.
- Risk Management & Monitoring
- No matter how good your strategy is, it must be monitored by an independent risk management component.
- Let us say you have a good trading strategy and you modified it to make it even better. But you made a mistake in your code & the strategy started placing wrong orders. The risk management component can send an alert in such scenarios or even stop a trading strategy.
- Building a consistently profitable algorithmic trading system can be very costly
- Software development cost may be high
- If your strategy generates a lot of orders for a small profit, then you may end up paying more brokerage than the profit you make
- Infrastructure costs
- You will also have to take into account the taxes you will need to pay
- Bad Infrastructure
- Bad infrastructure can also affect your system’s performance.
- Poor internet connection
- Unstable trading systems of broker (Ideally broker’s trading systems must have close to zero downtime/outage)
- Lack of Knowledge
- You must understand how stock market works
- You must have sound knowledge of the markets you are trading
- Understanding order life cycle & order matching in the exchange is very important
Algorithmic trading is a better way to trade markets, but you must understand its pros & cons. In most cases, the algo-trading setup that gives consistent profits is complex in nature. Initial phase of building algo-trading system involves a lot of efforts, but once it is ready then you can enjoy the benefits.
In next article, we will look at how to build a profitable algorithmic trading system.