For Algo to work for us, it is important to make one that fits us the best and make it simple keeping in mind that in real-world.
In the previous part, we saw how we start with ideating a strategy, build the initial rules, improvise the rules and keep in mind causality (cause and effect relationship).
We will now discuss the nature of the system, scalability, as well as important of time frames.
For Algo to work for us, it is important to make one that fits us the best (i.e. works for us) and make it simple keeping in mind that in real-world, we have to take practical considerations, as we move from theory to practice.
You may say that you will drive a BMW at 220 kmph in Mumbai, but if the roads do not support a speed more than 120 kmph, you cannot drive at 220 kmph.
Let us look at three more parameters of creating Algos:
Nature of system:
What type of system are you developing? Is it trend-following or is it mean-reverting. Are you building a Pair Trading Model? Is it a Long-Only system or do you want to take both Long side and short side trades?
Will you square off positions at end of the day or will it be overnight. These are the next few questions which one has to answer.
If it is a positional Long/Short model, then we can trade in the stocks which have Futures and Options so our universe is restricted to just 200-odd stocks which are currently available.
Are you designing the Algo for your own trading or is it for multiple clients or an institution. What is the size of money that you want to deploy on the Algo?
If you are looking to put say Rs 10 lakh into a Long Only strategy for yourself, I do not need to worry about liquidity and the impact cost.
Well, if you are looking to put let’s say Rs 10 crores into an equity markets Long Only Strategy for an institution, and it will have maximum 10 stocks position, then you need to add a volume filter check when selecting your universe of stocks.
So you want to put Rs 1 crore per stock. Then you may need to pick up stocks whose Average daily traded Value over the last 6 months is minimum 20 Crores.
This will make your model realistic in the real world. A stock whose Average Daily Value may be Rs 10 lakh, cannot absorb Rs 1 crore of Capital.
Especially think of it when you have to exit this position, you may shake the price significantly against you and have a huge impact cost.
This is key aspect in determining success or failure of the Algo System for a trader. Everybody does not have the same appetite for risk.
One trader may be comfortable holding a position for the day and exiting at the close of the candle at Day-end. Another trader may like to check every hour and get in or out depending on the price at the close of the hour.
Are you comfortable waiting until the end of the day? The time frame whether it is 1 minute, 3 minutes, 5 minutes, 30 minutes, 60 minutes, 2 hours, 4 hours, daily, weekly has to be decided.
Also, you may choose multiple time frames. This gets very interesting.
We know that the markets have a noise factor, and we land up paying transaction costs and brokerage, which hurts the trend following systems.
Instead of that, why don’t we choose a daily time frame for checking, if the signal is a buy or sell, and then checking on hourly time frame again for the Buy or Sell?
If the daily signal is in a buy mode and the hourly is also in a buy mode, only then we will buy. It is like at home, when the father and mother have differences of opinion and arguments, the child does not feel happy.
When Father and Mother are in sync, the child is happy – in other words, it means that when both daily and hourly indicators signal buy then the system should initiate longs positions.
The time frame will finally determine the number of trades an average profit per trade along with the average holding period of the trade, and you need to be comfortable with that.
(This is part 2 of the 4-part series on writing Algos)
(The author is a Co-Founder at Dravyaniti Consulting LLP)Disclaimer: The views and investment tips expressed by investment experts on moneycontrol.com are his own, and not that of the website or its management. Moneycontrol.com advises users to check with certified experts before taking any investment decisions.Subscribe to Moneycontrol Pro and gain access to curated markets data, exclusive trading recommendations, independent equity analysis, actionable investment ideas, nuanced takes on macro, corporate and policy actions, practical insights from market gurus and much more.