Vivek Gadodia
In the previous part of this series, we saw some important factors to deal with such as the nature of the algo, keeping in mind the scalability of the algo and how timeframe affects an algo.
In this part, we will move on to the more important question – will the algo work in future the way it has worked in the past.
The future may be similar to the past, but not the same as the past. There is a difference, and here we are going to understand some of those.
Creating Algo is a four-part series. Here are:
Part 1: Interested in designing algos? Follow these tips Part 2: Why scalability, nature of system and time frame are important for creating Algos
Now, Let's look at three more parameters for creating algos:
Consistency of returns:
Is the algo return coming concentrated in a one or two periods, or it is spread evenly across the years? Say a backtest from 2012 to 2018 shows a total return of 250 percent, and the year-wise return are: -60 percent, -10 percent, 280 percent, 100 percent, -50 percent and -10 percent.
This shows two years of positive returns out of six. And, say another backtest shows returns of 30 percent, 45 percent, 20 percent, 80 percent, -10 percent and 85 percent, giving us five positive years out of six.
We should choose the second one over the first any day since our chance of surviving through and sticking to the system is higher in the second case. Also, if one leverages 2X, in the first back-test, in the first year itself, we would run out of capital, i.e., blow-up.
Directional contribution to returns:
Here we deep-dive into how much returns of algo are coming from long side trades and how many from short side trades. This is a key metric and an experienced hedge fund manager would look at when evaluating an algo strategy.
Say if 80 percent of the returns are coming from long side and 20 percent from shorting – reasons may be that either the data had more long periods than short or the parameters have been designed in a way to give a long bias.
What if, in future, the market texture changes and it spends more time in downtrends than seen in the past. Therefore, I would prefer to have a system with 50 percent contribution coming from long side and an equal contribution from short side. Or, as close to 50 as possible, say 60 – 40 is also good.
Optimisation:
This is also called as fine-tuning. First thing is to decide what to optimise on. Say we want to optimise the reward-to-risk ratio, i.e., CAR/ MDD ratio (Compounded Annual Return/Maximum Drawdowns).
In a moving average crossover algo, we start by running through varying indicator values, say, instead of 20 fast moving average, we will check for 10, 15, 25 and 30 as well. This gives us five combinations.
In a slow moving average, we will check for 40, 45, 50, 55, and 60. Again five combinations. Totally, we get 5X5, i.e., 25 combinations.
For each of these combinations, the software will give us the performance with highest CAR/MDD ratio on top and lowest on the bottom. We can then see how the various averages are affecting the reward-risk ratio.
Here, there is a dilemma. Should we choose the best value or, should we choose the best region of values? Say, 10, 60 combination gives a reward-risk ratio of 3, whereas 15, 45 20,40 and 25, 40 give reward/risk of 2.
It may be that the outcome of 10, 60 can be a stroke of luck. Whereas, choosing a 20, 40 may get us closer to 2 reward-risk in future, as we have seen in the past. So we may get a similar return profile to what our backtest has shown.
That is what we are interested in, that our algo survives and thrives in the future and it’s not merely a paper exercise where we intellectually stimulate ourselves.
This is part 3 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 expert 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.
Discover the latest Business News, Sensex, and Nifty updates. Obtain Personal Finance insights, tax queries, and expert opinions on Moneycontrol or download the Moneycontrol App to stay updated!
