How to get started?
Now that we understand algo trading and its advantages & disadvantages. Let us know how to get started with it.
1) Getting the basics right
It is not advisable to get into algorithmic trading without a minimum experience of two-three years in the capital markets. Newbies must practice discretionary trading/paper trading during this period to sharpen their skills. Practical experience will give you a proper idea about the behaviour of different market instruments and their correspondent price behaviour. Such knowledge cannot be imparted through books & can only be gained over a while. Remember, Algorithmic Trading is a specialization. One must lay a strong foundation before aiming for the sky.
2) Data collection
A prerequisite of an effective strategy is data collection. This data can be anything ranging from Technical indicators like RSI, MACD range, Bollinger Bands, Fibonacci levels, Pivot levels, Volume, Stock price, or Fundamental metrics such as ROE, ROCE, P/E Ratio, OPM, etc. Data vendors may come in handy at this juncture.
There is a popular saying in the computing world- Garbage In Garbage Out (GIGO). At heart, the acronym tends to point that the quality of output is determined by the quality of input. Flawed or incorrect data values will give nonsense outputs or “garbage”.
Hence, utmost care must be taken while collecting the data & cleaning it. Data cleaning refers to the procedure of fixing/correcting incorrect or corrupted data values. The data set must also be checked for any outliers or distorted values.
The algorithm shall be tested on this data set to validate its efficacy.
3) Strategy Development
The next natural step is to formulate a strategy that works for you. Background knowledge of programming languages such as Java, Julia, Python, R, Matlab, C+, C++, etc will prove to be extremely beneficial. The choice of language shall rely upon the coder's comfort, frequency of trades, data structure, acceptable latency, network bandwidth, etc
Modern-day brokers have tied up with various algorithmic trading platforms such as Streak or Algoji that allow participants without any proficiency in coding to create, customize & automate their strategies. The tech-savvy may make use of platforms like AmiBroker, Omnesys NEST, Presto ATS, ODIN, FlexTrade, Algonomics, MetaTrader, and the like.
It must also be comprehended how passive/aggressive the strategy will be otherwise “quoting” or “hitting”.
a)Hitting- Placing buy orders at the ask price & sell orders at the bid price
b)Quoting- Placing buy orders at the bid price & sell orders at the ask price.
Instead of emphasizing on creating complex algorithms with too many rules, traders should focus on the clarity of strategies that can outperform the market in the long run.
The developed strategies cannot be straightaway traded in live markets. Every algorithm must go through a tedious backtesting process to prove its mettle. In this step, the algorithm is run on historical datasets to check its final outcome.
Platforms such as Kuants, TradingView Streak, Techniqo, Square Off, etc can be convenient in this regard
5) Parameter Optimization
This step shall lead you to either of the two consequences-either you will end up completely discarding the hypothesis or deriving actionable insights.
It may happen that the system does not throw up desired risk-adjusted returns based on the sample datasets. In this case, the trader must optimize the algorithm by tweaking certain rules and again backtesting it to check if the risk-reward ratio turns favorable. The idea needs to be completely scrapped if the sought results are not obtained even after multiple attempts.
In case the algorithm achieves the said purpose, the strategy must further be tested on out-of-sample data sets to avoid the risk of overfitting or over-optimization.
The trader must keep in mind that the returns generated through this methodology exceed that of buy & hold returns & that maximum drawdowns do not exceed his risk appetite.
6) Going Live & Active Risk Management
If the algorithm prevails on an out-of-sample dataset, only then it must be tested for execution. The strategy must then be connected to the API of your broker for seamless operation.
At this stage, some errors such as brokerage assumptions, liquidity, coding errors, etc can be identified. Initially, the order sizes must be small & the larger focus must be on the success of the algorithm.
The trader must actively manage his risk -putting to work Value At Risk (VaR) and Expected Shortfall (ES) measures. Total Returns (CAGR), Sharpe Ratio, Hit Ratio, Maximum Drawdown, Volatility of returns, Average profit per trade, Average loss per trade are other metrics to ascertain the performance of the strategy.
A brief explainer for these terms:
a)VaR - or Value at Risk refers to the maximum amount of loss that can be incurred in a certain time period at a given confidence level under normal circumstances
The above image shows the VaR of a portfolio at 95% confidence interval
b)Expected Shortfall (ES)- refers to the expected loss amount at a certain confidence interval once the loss amount exceeds the VaR. In other words, if VaR tells us “How bad things can get?”, ES tells us “ What is our expected loss if things do get bad? “
c)Total Returns - Compounded Annual Growth Rate (CAGR) returns must be calculated & used instead of absolute returns.
d)Sharpe Ratio- measures the risk-adjusted performance of the strategy. It verifies that the alpha obtained through the algorithm is on account of managerial skill instead of excessive risk taking.
e)Hit Ratio- is the ratio of the number of profitable trades divided by the total number of trades. Ideally, you should be striving for a hit rate of anywhere between 50-70% and a risk-reward ratio greater than 1:2.
f)Maximum Drawdown- or MDD measures the maximum fall in the portfolio value from its peak to the trough (before a new high is achieved i.e. high watermark).
The trader must immediately exit all open positions & stop the algorithm in case things go awry. Apart from this, the trader must keep an eye on evolving trends/ sectoral shifts in case of which the code might have to be altered or junked altogether. Recall that every strategy has a limited lifetime.