Algorithmic Trading – Part I (Introduction)

Preface

This article is primary for traders & investors who are looking to enter the world of algorithmic trading.

Introduction

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.

Algorithms

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.)

Misconceptions

  • 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.

Advantages

  • 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

Disadvantages

  • 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

Performance Calculation

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

= 40%

Just for reference, 40% is a very decent performance if you are trading a large portfolio.

Factors Affecting Performance

  1. Trading Algorithm (Strategy)
    1. This is the single most important factor. If your trading rules are good, you will make money else you will lose.
  2. Risk Management & Monitoring
    1. No matter how good your strategy is, it must be monitored by an independent risk management component.
    2. 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.
  3. Costs
    1. Building a consistently profitable algorithmic trading system can be very costly
    2. Software development cost may be high
    3. 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
    4. Infrastructure costs
    5. You will also have to take into account the taxes you will need to pay
  4. Bad Infrastructure
    1. Bad infrastructure can also affect your system’s performance.
    2. Poor internet connection
    3. Unstable trading systems of broker (Ideally broker’s trading systems must have close to zero downtime/outage)
  5. Lack of Knowledge
    1. You must understand how stock market works
    2. You must have sound knowledge of the markets you are trading
    3. Understanding order life cycle & order matching in the exchange is very important

Conclusion

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.

I have around 15 years of experience developing Financial Software. I took a break from my career to start my own algorithmic trading setup. This new journey started well and along with my own proprietary trading systems, I also started building automation systems for retail traders, fund managers and HNIs. I was employed with firms like Morgan Stanley, HSBC & SunGard. I work on various technologies, but my strengths are building server side cloud based algorithmic trading systems built primarily using Java programming language. Apart from all of this, I am a big fan of Formula 1 racing :-)

14 thoughts on “Algorithmic Trading – Part I (Introduction)”
  • shaik babu says:

    very good stuff

    February 26, 2018 at 3:46 am
    • Admin says:

      Thank you!

      April 9, 2018 at 5:24 am
  • sagar says:

    Great Perspective for beginner’s…

    March 9, 2018 at 2:33 pm
    • Admin says:

      Thank you!

      April 9, 2018 at 5:24 am
  • Sujit Kumar says:

    I have seen Algo trading is completly dependent on technical only. They largely follow curves on chart and gives less profit so I think it will only improve 10% of your performance when you are using very good algo. One cannot ignore news, Fundamentals, Economic Data, sentiments, market depth, currency etc which is very important while trading.

    April 7, 2018 at 7:55 am
    • stockdev says:

      Well, there is not doubt that news, fundamentals & other factors you mentioned do affect the price of a stock. However if you decide to calculate & predict the impact of these factors on the stock price, it is very close to impossible for individuals. It will need a team of highly sophisticated data scientists & market experts to come with such an algorithm.

      So we as retail traders or individual developers simply ignore these factors with an assumption that these factors will affect the price. And once it starts affecting our algorithms must be good enough to spot it.

      April 9, 2018 at 4:22 am
  • bd says:

    Wonderful and close to reality

    April 8, 2018 at 10:15 am
    • Admin says:

      Thank you!

      April 9, 2018 at 5:24 am
  • Parthiban says:

    Really good article for a beginner….Keep it up guys!!!

    July 13, 2018 at 12:23 pm
    • Admin says:

      Thank you, we appreciate your feedback!

      July 16, 2018 at 5:25 am
  • PMS says:

    What about the Mutual Funds which were solely dependent on ALGO in US/UK had suffered losses & had to wind up

    September 8, 2018 at 9:11 am
    • Admin says:

      Algorithmic trading does not mean profits all the time. It simply means automation of trading activities. Profits & loss depend on how good your trading rules (algorithm) are.

      September 26, 2018 at 11:47 am
  • shethuraman says:

    I want your algo trading software.just i have same idea.can you coding? pls mail for me .or call my cell.9444614108.

    Thankyou

    January 14, 2019 at 1:02 pm
    • Admin says:

      Please go through our website, there is enough help material to get your started.

      January 17, 2019 at 4:21 am

Comments are closed.