You are on page 1of 3

GuruSpeak | Tarun Nayak uses algos to automate trading, freeing up time for his full-time day job

Shishir Asthana

Algorithmic trading has shortened the learning curve for those who know how to code. For others, it remains a mystery or is dismissed
as being complex, costly and not giving any significant edge over conventional trading techniques.

Nothing could be further from the truth. Ask Tarun Nayak, who has developed algorithms (algos)to execute trades daily even as he holds
down a full-time job. Algo trading has also transformed how he trades, by paying minimal attention to his trades during the day but
making more money than during his discretionary trading days.

Nayak belongs to a farming family residing in a small city in Chhattisgarh. He acquired a degree from IIT degree and also did an MBA
from a prestigious institute. He utilises weekends to improve his trading performance by backtesting strategies, looking for ways to
improve on execution and seeks out new asset classes/strategies to diversify.

In this interview with Moneycontrol, Tarun talks of his trading journey, the strategies he follows and the steps to be followed if you want
to become an algo trader.

Q: A brief background and your tryst with markets

I was born in a small city in Chhattisgarh and belong to a lower-middle-class agrarian family. I have completed my Civil Engineering
from IIT Bombay, after which I joined ISB for a post-graduation MBA and have worked at Flipkart and Paytm.

Nobody in my family knew about the share market during my formative years. The only financial instruments we knew were fixed
deposits and LIC policies.

The first time I heard of the market was when I was 20 years old and it was not for the right reasons. This was in 2008 and the
meltdown had affected IIT placements. I learned more about the markets from a good friend who had got placed in the trading firm
Futures First. I slowly got interested in how he was trying to predict the future price of any stock.

I dipped my feet in the market in 2018, trading in equities but somehow wasn’t convinced because I couldn’t prove this was an edge that
can be scaled up. I was also wary because of the horror stories my friends told me about losing huge amounts of money in stocks such as
PC Jewellers and Shilpi Cables.

I also saw tweets by a few popular Twitter handles and had heard about options, but those were initial days and I didn’t take it very
seriously. Then I saw trader Manu Bhatia’s profits that he had posted on Twitter. Being an alumnus of IIT Kanpur and an ex-Flipkart
employee like him, I was intrigued and felt the need of exploring trading further.

I read up on options, looked up videos posted by Tasty Trade and many other options-based videos to understand how options work.

I even spent a lot of time learning about charts, indicators, etc, but since they weren’t data-driven, I wasn’t fully convinced if I should
pursue this.

Q: How did you find your bearings in the market?

I started as a discretionary trader by trading based on charts. After a tentative start, I increased my capital and did reasonably well
during the initial period. But then family life required my attention and with a full-time job, I could not pursue trading the way I was
doing earlier. Quitting a job wasn’t an option, given my educational background and the opportunity cost. The only option then was to
automate trading and spend as little time in front of the trading screen as possible.

Q: Why go in for algo trading?

The main reason was that I could trade and keep my job at the same time. Algo trading also came with other advantages such as built-in
risk management and taking care of execution.

Algo trading helps address psychological aspects of trading to an extent. I faced anxiety issues when I was trading weekly expiries at 2
pm and had to square off positions. Further, as algo trading is data-driven, it becomes easier to scale.

Q: How did you trade in your initial years?

The conviction of going ahead with algo trading was firmed up after I was introduced to the back-testing website StockMock. I saw that a
short straddle trade (selling both at-the-money calls and puts) at 09:20 a.m. was working well. For some reason, this trade triggered in
me the need to automate my strategies.
Coming from an engineering background, I was always sold that anything proven with data should more or less work well. I started
learning the programming language python in July 2020 and by end of the month, I deployed a very simple StockMock tested strategy.

I slowly learned to code better and started testing multiple systems. Today I have multiple systems running that help me diversify.
Trading helped to generate additional money, and I didn’t need to quit my job either.

Q: What is the most difficult aspect of trading you encountered?

For me, it was the psychology of trading. When I started trading as a discretionary trader, looking at charts and how much profit I was
making became a habit. In the initial days, I was uncomfortable leaving things to an algo to execute and not check on what’s happening
in my trading account.

To solve this, I wrote another program that would change my Zerodha trading password and send it to a friend’s telegram account so
that I am not tempted to check and interfere with the trade. Once an error is encountered on the algo, it sends a new password along
with an error to my telegram number. This allowed me to see the screen only when I face some errors otherwise I get to see the results
only at the end of the day.

Q: What was your Eureka moment?

Python coding, period.

Learning to code, I think, is the biggest barrier to anybody entering algo trading. I never coded a single line in any of my jobs, but I
wanted to learn. There are many sources to learn, like YouTube free videos, but I would highly recommend MayankRasu’s course on
Udemy on Zerodhaalgo trading. This not only provides you with some initial code but also explains how to write the code.

That most people into trading do not learn python despite willingness, is because of inertia. Once you are determined and put in 2-3
hours every day, I can confidently say that within 30 days you will be able to code a very simple algo yourself.

After learning python, I played around with the data and came up with various back-tested strategies that improved my risk-adjusted
return.

Q: How do you presently trade?

Today, all my systems (mostly intraday index options selling) are fully automated using broker APIs. I trade a mix of time-based
strategies, i.e. selling straddles at a fixed time with a pre-determined percentage stop loss on each leg. I take 3 trades during the day.

I also take market movement-based strategies, which are not correlated with time-based strategies. For example, I run a system that
sells intraday index options of Nifty and Banknifty at 9:20 a.m. with a 20-30% stop loss on option price at each leg. This has historically
given CAGR returns of over 50%+ with a maximum drawdown of under 10%.

It’s a highly debatable strategy discussed on social media, but it has worked well and will continue to work in my view. People can use
the Stock Mock platform to backtest these time-based strategies.

The catch in this strategy is execution (automated entries/exits, minimizing slippages, stop loss cancellation, etc.) and a long phase of 2-
3 months when the strategy would not work. There are times when stop loss on both the legs is hit. To prevent this phase what we need
is a un/low correlated strategy.

A word here on algo and how to automate trades. One can use the broker’s APIs (application programming interface) to build their algos
or use platforms like Tradetron or Quantiply to execute. A customized algo gives much better flexibility and reliability to execute
flawlessly.

For example, one can build a logic to minimize slippages through stop loss - limit orders. What I do is, I place a stop loss - limit order at
the stop-loss price, and then if the algo detects that the order is not yet filled and the price jumps above the stop loss price, my algo waits
for 5 seconds or a 3% price increase before it chases the price. Mostly, 99%+ of the time, your stop loss order will get filled at the limit
price. This helped me minimize slippages to a great extent.

As for the diversification part, the maximum loss day is the one when on both legs the stop loss gets hit. To counter these days and de-
risk, I built another system.

When the stop loss of any leg is hit in the original 9:20 a.m. straddle trade, I sell another ATM straddle. In case of a complete reversal,
this system compensates for some part of the maximum loss on the original straddle.

I do a maximum of three entries this way. A day when both systems lose money would be a very choppy day when there are complete
reversals on both sides more than 4 times in a day, which history shows are very rare.

Let’s take 24th May 2021.


On this day, the 9:20 a.m. straddle stop loss was hit, while the second and third straddle of the new system compensated for the loss.
The idea of a second system is to think about how to come up with an uncorrelated or low correlated system.

A good way to understand this is to build the correlation matrix as below, which shows that the new straddle has a low correlation to the
original one.

On a combined basis, I am winning 65 percent of the time and the average win to average loss is 1.3:1.

Q: What would you like to advise a retail trader who is interested in algo trading?

I would say that a retail trader should spend the first 2-3 months to learn python coding–learning concepts such as data structures,
Pandas, loops, and how to write some basic functions. Get all the relevant data (options, spot, futures, etc.) from sources that are free as
well as paid.

The next step is to form a hypothesis on what can be an edge. For example, a trend may be formed after the index spot crosses a certain
value on the upside, so a put option can be sold or a call option can be bought to take advantage of this.

Next, thoroughly back-test the idea by writing a back-testing code. This helps get the relevant metrics, such as win rate, risk-reward,
max drawdown, max time drawdown, percentage returns month by month, etc.

You might also like