Moneycontrol
Get App
Last Updated : May 02, 2019 02:12 PM IST | Source: Moneycontrol.com

From Gully Boy to quant boy: Here's a guide for designing algos

Sell when the 10-days average crosses below the 50-days average. After seeing the trade sheet, one needs to see statistics like win/loss ratio, average winning percentage, and profit factor, to name a few.

Moneycontrol Contributor @moneycontrolcom

Vivek Gadodia

In a recent interview, Big B said he has seen the movie “Gully Boy” 10 times.

What’s so special about the movie? Well, the key aspect is the expression of individuality through music to create rap songs, which the actor Muraad (Ranveer Singh) expresses in the movie.

Designing an Algo is again an expression of one’s creativity and personality. The market does not differentiate between people and offers the same/equal opportunity to everyone.

Once the data cleaning is done, begins the process of starting to work the back test.

1) Ideating:

“I spend time planning. Once planned, I execute with speed” – said a good friend who is a Human Performance Coach to MNC Organisations. Same with an Algo.

One needs to spend time thinking about the idea. It has to be a reflection of one’s style, personality, and belief. If a believer in technical systems tries to build a fundamental algo, it’s like asking MS Dhoni to play a T-20 inning being defensive.

One needs to find whether one’s nature is aligned to trend following or mean-reversion or arbitrage or market neutral, as an example.

2) Initial Rules:

Rome was not built in a day. Start with testing some basic rules like a moving average crossover. E.g. buy when 20-days average crosses above the 100-days average.

Sell when the 10-days average crosses below the 50-days average. After seeing the trade sheet, one needs to see statistics like win/loss ratio, average winning percentage, and profit factor, to name a few.

How many trades does the system generate, and what is the average holding period of trade. The shorter the time-frame the more the trade.

One needs to see if one is comfortable with these factors. Does the system trade too often or too little. Is it profitable? These are some basic things to look at.

3) Improve Rules:

Rarely will the algo be made in the first cut. If one finds the moving average vanilla system gives below the expected return/risk ratio, we may explore ways to improvise it.

Maybe add a Donchian Channel rule. So now we are saying, let the averages be in cross-over, but buy only when certain days High price is broken.

This is a combination of the best of both worlds suggested by Sir Richard Donchian, the most profitable system trader on earth as per records.

4) Causality:

Every Dog has 4 legs, this does not mean every 4-legged animal one sees is a dog. Same way, if Nifty goes up and Mumbai Indians is winning T-20, does not mean each time MI wins, Nifty would go up. (Firms like Renaissance have known to use things like weather, as signals, and this is debatable).

Knowing why one’s system works is important. If this is not known, one will not know when the system is not likely to work. Hypothesis or economic rationale is at the core of designing robust strategies.

A trend-following system on high-beta stocks is likely to work because companies borrow and expand capacity when the economic cycle is turning up, and cut down drastically when the cycle turns down e.g. Reliance Communications.

Long/Short models work well on such stocks because prices go significantly above and below the intrinsic value of the company.

(This is part 1 of 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.
First Published on May 2, 2019 02:12 pm
More From
Sections
Follow us on
Available On
PCI DSS Compliant