Module 10 Trading Systems

Chapter 1

What to expect?

152

What is a trading system?

Such a glorious day to start this module! Here is the headline that rocked the stock markets today –

Yesterday i.e 24th Oct 2017, the Finance Minister announced that the Government would infuse Rs.210,000 Crore into the Public Sector banking system, which is basically an effort to save the PSU banks from the deteriorating NPAs (Non-performing assets).

How did PSU Banks react to this announcement? After all, this is a lease of life to the PSUs. Well, they were jubilant, as expected –

As you can see, the PSU Bank index shot up 27.75% at opening.

Some of the PUS stock options were on steroids, here is the hero of the day –

Punjab National Bank’s 160 Call option expiring on 26th Oct 2017, shot up 20,600% overnight! If you had bought 1Lac worth of option on 24th Oct, it would have translated to 2.02 Cr on 25th Oct morning.  So clearly, there is a lot of action in the market today.

Earlier in the day, my colleague and I were looking at the way markets were behaving and trying spot an opportunity, and here is something that looked interesting –

Bank Nifty Index too joined the party, with the index going up nearly 3% (look at the image of the sectoral indices above). However, a 3% move on Bank Nifty was quite questionable considering the fact that PSU banks contribute just around 10% to the Bank Nifty index, look at the index constituents and its weights below –

Considering this, my colleague and I decided to write a short strangle on Bank Nifty and collect a premium of close 253 points per lot, obviously hoping that the volatility would die and premiums would reduce.

I don’t want to debate about the reasoning of this trade – whether it’s going to make money or not is not really the concern, although I hope it does ☺

However, I want you to think about the thought process behind this trade.  The trade idea originated through what I consider as ‘systematic deduction’.  To make such systematic deduction and find opportunities, you need to question what is happening in the market and sometimes be willing to take contrarian positions, which is exactly what we did.

‘Systematic deduction’ is one of the most popular methods market participants adapt to trade the market. However, not all systematic deductions are right, you could, of course, succumb to biases and make systematic errors while making these deductions. Nevertheless, systematic deduction is one of the other popular techniques to trade. Other popular trading techniques being –

  • Trade because your gut says so
  • Trade because my friend says so
  • Trade because the guy on TV says so
  • Trade because my broker says so

None of the above mentioned ‘approach’ to trade the market, including the ‘systematic deduction’ can really be defined as a process. These are ad-hoc methods, which cannot really be quantified or backtested.

Any approach to trade where you cannot really define ‘the approach’ as a process is not considered as a trading system.

On the contrary, if you can define the approach and can quantify the process to trade the market, then you are essentially talking about a ‘Trading System’, which is exactly the focus of this module.

1.2 – Trading system – the Holy Grail?

The moment you talk about a trading system, people generally tend to think of these systems as a sure shot technique to make money, or in other words, they approach these systems as a money-making machine. They expect profits to roll from the first trade itself. Unfortunately, it does not really work that way.

Remember, a trading system receives a bunch of inputs from your end, performs a set of task, and gives you an output. Based on the output, you then decide (or the system itself decides) if this is a trade worth taking or not.

Here is how you can visualize this –

If you realize, for the trading system –

  1. You give the system the inputs
  2. You design the system
  3. You decide to trade or not to

So the onus of making money really depends on you. The advantage of a trading system, however, is that – you only have to decide the logic once and then just follow the system that you’ve designed.

Of course, as you may have sensed, I’ve dumbed down the journey of a trading system to a large extent, and this is just to give you a perspective at this stage.

1.3 – What to expect from this module?

The trading systems that we will discuss in this module will be complete, in the sense, it will have –

  1. The logic, which is the core of the trading system
  2. Input parameters
  3. Interpreting the output
  4. The decision to trade or not

At this point, I’ve planned to write about the following 4 trading systems –

  1. Pair trading
  2. Volatility based Delta hedging
  3. Calendar spreads
  4. Momentum strategy (Portfolio approach)

There two techniques to pair trade – a simple approach based on correlations and a slightly complex approach using statistical concepts – both of which we will explore.  Of course, as we proceed, I may try and add other trading systems as well.

However, this module will not include the ‘backtest’ bit. The onus is on you to backtest the system and figure out if the system works for you or not. You will have to take the rules of the system and figure out how many times in the past it has worked and if it has worked, what kind of profitability pattern the system is showcased.

Remember, no trading system is complete without having the backtesting results. The only reason why I’m not including the backtesting part is that I lack programming skills. Some of these systems can be efficiently backtested if you can manage to write a piece of code. When these systems were developed, I was fortunate enough to have a fellow trader with programming skills, hence I was in a position to get greater insights into these systems. I must also tell you that these were fairly competent systems to trade – and I presume they still are.

Of course, the market conditions have changed, hence a fresh set of backtesting is justified.

However, the broader objective of this module is to showcase different systems and give you insights into how systems are developed. Hopefully, this will inspire you to develop your own system and perhaps works out to be your own money making machine!

With this hope let us proceed – onwards to Pair trading!

PS: The short strangle on Bank Nifty worked out quite well

152 comments

  1. Sashidhar. L says:

    Very much excited to see the much awaited module live.I just have one question. I know you have already said that you do not trade naked options, but why not take a bull call spread or some other aggressive bullish trade on some top PSU bank’s options, as it would give you maximum benefit or am I missing something here? I am just an option beginner and trying to know the way pros like yourself think. Thank you.

  2. Ravi Kumar BA says:

    Congrats on your bank nifty short strangle turning out right 🙂

    I was taken by surprise about the rally in Banknifty.. unfortunately got on to the wrong side of the trend..Some hard lessons learnt ..1. Never do naked options.. 2. Don’t put all eggs in single basket

    Sir, where do u think the banknifty ends by Nov expiry (ball park number atleast)? Your answer will give boost to my thought process and to my existing open trade 🙂

    • Karthik Rangappa says:

      Thats is a hard call, Ravi. Maybe you should apply the volatility concept and get a sense of where the expiry could be. Or something like max pain.

  3. Umer Azam says:

    Sir, I was expecting a module on personal finance? As you had said earlier.

  4. Maha says:

    Yeah, I want to build my own trading system. It should needs rules and regulations. I eagerly awaiting to learn your lessons. hurrah!!!!

  5. Ravi Kumar BA says:

    Karthik, If you don’t mind, can you give details of the trade setup you did for the mentioned banknifty ?

  6. Man Deep says:

    why can’t we download PDF of chapter 9 and 10

  7. Keval says:

    Its really weird that only 10% of the PSU banks contribute to the Bank Nifty Index and Bank Nifty surged 3 % !

  8. Jay says:

    Desperately waiting for pair trading module!

  9. Ahtasham says:

    Hi Karthik.
    This is my first post and I want to thank you first as I have learned most of the trading concepts and strategies from your modules at varsity.
    I am eagerly looking forward to this module as I have plans to build a trading system and put my programming skills to some use.

    Keep up the good work 🙂

    (Just some random question)
    I know it is really hard to predict the stock market moves but just asking what you think should be the ideal success rate of trading system.

  10. Narayanan says:

    Hi Karthik, is pi quant be available on app?. Found only desktop version

  11. Prashant says:

    Sir when you gonna post pair trading module?

  12. Saurabh Tomar says:

    Kartik
    It is great to figure out someone who thinks like me.I am too excited by the way you write the module in easy to understand way.I some times trade on the basis of contrarian view .Well you have just given me an Idea for my P.hD thesis,which will in Behaviorial Finance and will try to figure what guts are, and to investigate the noise which affect trading decision in India.
    Thanks

  13. Vinit says:

    Hey Karthik
    This is my first post here. But I must admit I am a huge fan and follower of ur work.
    Infact I have learned a lot from varsity, the very foundation of my understanding of markets is varsity. All due credits to you and team zerodha. I have an active account with zerodha and have referred a few friends to varsity and zerodha as well.

    Many congratulations for the new module. Really looking forward to it..!
    The appetite for knowledge of your followers has surpassed your capacity to produce quality work here. Congratulations!
    Cheers

  14. Isaac Maria says:

    Hello Sir, an out of the context question. I am thinking to invest in Index Funds but I don’t know how to choose one. I am aware of two factors
    1) Expense ratio (Which has to be less than 0.5)
    2) Tracking Error
    My Questions are :
    1) How do I find out tracking error for an Index Fund
    2) Am I missing any of the important factors before choosing one?

  15. Sujeet Raj says:

    Some options had better results than the PNB one.

    SBI OCT 280 CE had some 27,000% and 300 CE some 40,000% gain.

    There could be others too

  16. Sushil says:

    Hi Kartik,
    On the same fateful day I entered a short strangle after the market opened and price of SBI stock looked to stabilize of SBI 280 PE & 320 CE and burnt my fingers badly as I had to buy back my call option at a very high price.

    • Sujeet Raj says:

      I think he did it towards the end of the day when prices had stabilized. Not at opening. But he did it for the index which had unusually high volatility even tough PSU’s had less say on Bank NIFTY.

    • Karthik Rangappa says:

      Hmmmm, touching stocks which have fundamental news around it is a tough call. Its better to stay away if – especially in situations where its hard to assimilate the news flow.

  17. Gunjan sharma says:

    Why not chapter 9 & 10 in pdf format

  18. Satyaki Mallick says:

    Hi Karthik,
    Is there a module here which explains about investing in mutual funds? I was curious about Coin of Zerodha. If yes, please do comment the link for the module.

  19. nikhil says:

    hi Karthik,
    In some previous comment you said that you would look for atleast 60% win rate. But i have a question, for how many trades should we decide that the system is given 60% win rate or more?

  20. Sashidhar. L says:

    I read few books on trading systems and they all say that all trading systems have some edge over others. How true is this and if yes, what kind of edge are they talking about?

  21. Panky says:

    Team Varsity, you have done some really great work by designing such a great platform for retail trader for free. thank you very much for such great efforts.. can you launch google playstore app of Varsityzerodha. in which we read online and offline content on zerodha varsity instead of providing pdf copy.so we should read on zerodha platform instead of third party App (for pdfs). we also like to click on adds shown on this zerodha app as token of love from our side. i really want that u should design app for varsity and Q&A for greater mobility…….
    once again thank you very much….

  22. Ash says:

    Hi Karthik,

    I know you aren’t the right person for this, just thought you can cascade this to the right people like Nithin Kamath.

    Lots of issues in current version of Kite in the past few days. What is happening with Zerodha applications? I called the support team and they weren’t of much help except for saying some backed up-gradation work is going on. How can that be allowed to affect the front end. It affects people like me a lot.

    Issue :

    For example in Kite application, the positions tab is not reflecting “Average Price” and “P&L” at all and “Change” shows as NA. It shows as 0. You might want to look into the issue. I think the issue is common to many users, even my friend is facing the same problem. Also average prices are shown wrongly in the Holdings tab.

    Would be great if you could escalate this issue or let me know a proper forum to discuss these

    Thanks,
    Ash

  23. Ashish says:

    Hi,
    Sir can you please make a module on trading plans and trading strategies for beginners. Especially for regular stocks rather than the Derivatives. I am new to stock trading and I want to stay away from Derivatives untill I get a hang of trading.
    I would really appreciate if you such a module comes out on Varsity.

    Thank you

    P.S I have became a fan of Zerodha and I have started suggesting Varsity and Zerodha to everyone interested in trading stocks

  24. T A RAMA KRISHNA REDDY says:

    Hi karthik,I have a doubt many People say that everything in market is manipulated by big institutional traders,that is why almost 99% retail traders lose money success percentage is very low there is also a belief that the index like nifty and bank nifty are also manipulated in their favour.is this talk really true?please explain briefly about this manipulation which is eating the retail traders wealth and health?can the index be manipulated?

    • Karthik Rangappa says:

      There is no manipulation. People lose money because they do not have the kind of patience or discipline that the institutional investor has. Not for any other reason.

  25. deepak naha says:

    Hi Karthik,

    As always great educational topics been discussed by you.
    I have been trading for some time in options , using strategies.

    Can we have a session on bitcoin and how to trade on bitcoin-I have been hearing a lot but know nothing on bitcoin- would request you to throw your intelligence on the subject.

    Also can we form a wats app group –where you would discuss your profit making strategies ( I know I m sounding selfish).

  26. deepak naha says:

    One more thing karthik–can we have a trigger in our mail box, whenever a new topic been discussed by you.

  27. Mayur says:

    hi Kartik

    Momentum strategy (Portfolio approach)

    by this you mean you will be doing all the calcs like 3 mnth – 12 mnth / 6mth-12 mnth / 9mth 12mth returns on a sent of scock
    an then rank them as per the relative strength and select top 10 or 20 stock for your portfolio if yes can you please do that in excel and some ami broker code to go with as it will be much easier to backtest

  28. Mayur says:

    *** correction set of stocks 🙂

  29. Sashidhar says:

    Sir how does one decide on what strategy the trading system should be based on? As you said there are so many trading strategies- Pairs trading, momentum etc. How should one go about selecting a trading system? Thanks.

    • Karthik Rangappa says:

      A good trader usually has 2-3 strategies and masters them to perfection. So you always trade these strategies, based on the opportunities that come about in markets.

      • Karthik says:

        Thanks for the reply sir. Would you be comfortable telling what kind of trading systems you personally use? Thanks.

        • Karthik Rangappa says:

          I use a mix of strategies, including Pair Trading, option writing, naked futures position, long-term investments, TA based trades etc.

  30. Monil says:

    @Karthik Rangappa
    @nithin kamath

    Will zerodha ever be listed on any exchange ?

    Are you doing anything for making kite /PI (for options trading – currently we can’t view live Greeks /net position Greeks in kite /pi- at least make this thing available if not rest ) as sophisticated as think and swim ?

    Wait for your response >>

    • Karthik Rangappa says:

      Monil, no one knows what the future holds 🙂

      We are doing quite a bit with respect to options, hopefully, we should make some announcements soon 🙂

  31. Manish Goyal says:

    @Karthik

    Sir, First of all i wud like to thank u for all stuff, i have gone through most of the module & i found them really helpful

    I am the beginner in this field & hopefully going to complete my CA in Coming Jan & want to make my career in this field but don’t know how to start, Should i get training somewhere for this or should i start to analyze at my own ??

    Waiting for Reply

    • Karthik Rangappa says:

      Good luck for the upcoming exams in Jan, Manish.

      I’d suggest you start making your own analysis. This will always help.

      • Manish Goyal says:

        Thank u Sir

        Sir, i want to know how one can keep himself updated with all stuff related to companies & relevant industry apart from business news, so that i can track them

        Is there any app or something.??

  32. Saurav says:

    Hi karthik,
    Sorry for posting here, but mobile kite application is not working from 2 days in android platform. Please suggest what to do??? 😞😞

  33. Sashidhar. L says:

    Sir is there anything zerodha is doing about back testing, even for those who don’t have any coding knowledge?

  34. Shabnam says:

    Hi sir, I’m new into this field and um also reading your given modules. And let me tell u they R very easy to understand…
    Hopefully will soon start earning..
    Tx

  35. Manish Goyal says:

    Hii Sir,

    I want to know that in case i short sale nifty 50 index suppose on last day @2 ( 1 lot for 10700 nifty call) and before closing i wont able to buy or their are no buyer for the same then what will happen/ be consqunce. ??

    ( As we know nifty 10700 call will become “0” on expiry closing while nifty 50 is trading at 10470)

  36. Sashidhar. L says:

    Sir I have a very important question about stop losses . In the above trade, say I was the option seller of PNB Oct 160 CE and I had placed a stop loss at 5 rupees below the sell price. How do I manage against drastic market changes like this? The price wouldn’t hit my stop loss as it opened at a much higher price. How do traders protect themselves from incidents such as this?

    • Karthik Rangappa says:

      This is a practical problem and a risk inherent in placing not just SL but any limit order. There is no guarantee of execution. This is where market order scores over limit orders, but the prices you get in mkt order can be quite dissapointing.

      • Sashidhar. L says:

        Just what I thought too sir. So in such cases, what can a trader do to protect himself from such black Swan events?

        • Karthik Rangappa says:

          Nothing really 🙂

          • Sashidhar says:

            Sir I know this solution might not be feasible. But do you think holding the same number of underlying stocks bought at a much lower price say a few years back would act as a hedge for such black Swan events?

          • Karthik Rangappa says:

            That is as good as a buy and hold strategy. Not really a hedge. But yes, in a sense, the only hedge against market volatility is time.

  37. CreaTorr says:

    Hi Karthik,

    I have couple of questions regarding settlement of derivative market:

    1) If I have leveraged 10 times by shorting future contract on a particular day and then next day that particular stock has gap-up opening of 20% because of uncertain situation like the above mentioned news. So, in this type of trade how is trade cash settled assuming investor who has shorted doesn’t have money to pay. As it is zero sum game, who is gonna pay to opposite party? Is that SEBI or broker or government?

    2) If I’ve 1000 lot of PUT In the Money options and then war breaks out. In this situation, every PUT writer will try to close their position. But now, everyone has conviction that the worst situation will prevail and the worst of market is still to come. Finally because of liquidity crunch, situation is like only the OI for that particular series is 1000 lot.
    Then will I be forced to close the position by regulator as the put writer is facing problem with margin amount and he is not able sustain financially that trade by putting extra required margin amount? or Is it regulator gonna take hit of lost amount?

    • Karthik Rangappa says:

      1) The risk management team would cut your position in situations where it starts making losses over an above the margins parked.
      2) If you have 1000 Put short, then there will be someone who has bought these from you. As long as you have an open position, someone else will also. So regulator will ensure money is transferred (or settled) between both the parties. Remember, the seller has margins parked already with the broker.

  38. Aman Agrwal says:

    Hey Karthik,
    Please upload the complete pdf for module 10 so that we can learn from it .
    Please upload the complete pdf as soon as you can

  39. Aman Agrwal says:

    I want to clarify a doubt regarding brokerage .
    Suppose i had put an order for 10K shares but the order is executed in parts
    My Order : 10K Shares of X Stock.
    Order gets executed in parts : 5000/10000
    3000/10000
    2000/10000

    So in this case my brokerage cost at zerodha would be Rs 20 ( As i have given a single trade entry )
    or,
    It would be Rs 60 ( as the trade is executed in 3 trades instead of 1 trade )

    Looking forward for your answer.
    Thank You

  40. Mahaveer mehta says:

    Sir, exact tell which book is best of van k Tharp…..

  41. milind says:

    Dear Karthik,

    You have done a tremendous and excellent job. Thanks a billion for putting all aspects together in orderly manner. May I request you to convert Module 9 and Module 10 in PDF formats? Staring at computer screen for long time strains my eyes so it will be easier for me to read from the paper. Appreciate your help in this matter.

  42. Mani says:

    Hello Sir, I am new to trading but have good python programming skill, so for starters I am trying to create a simple EMA crossover system. I backtested my strategy on NIFTY500 shares and shortlisted the ones with high %profit average and total-traded-value rank greater than 50. But I found that my selection process is correct. So how to select shares for a my strategy? Can you point me in right direction?

    • Mani says:

      ***correction*** Hello Sir, I am new to trading but have good python programming skill, so for starters I am trying to create a simple EMA crossover system. I backtested my strategy on NIFTY500 shares and shortlisted the ones with high %profit average and total-traded-value rank greater than 50. But I found that my selection process is not correct. So how to select shares for a my strategy? Can you point me in right direction?

    • Karthik Rangappa says:

      Nifty 500 is perhaps the best universe as they have maximum liquidity. I’d suggest you stick to this, but maybe you should look at tweaking few variables while back testing.

      • Mani says:

        can U elaborate on ‘ tweaking few variables’ sir, I am testing for intraday 5 minute timeframes, 9 x 21 crossover, backtested for 21 days then filtered the shares like I told before, again backtested the filtered shares for next 7 days, 14 days like that, but mostly ended up with brokerage loss.

        • Karthik Rangappa says:

          Things like these –

          1) Instead on 9 x 21, maybe try 21 x 50 or 18 x 30 etc. You need to figure out the best possible combination. Also remember, what works for 1 stock may not work for another
          2) Try various time frames
          3) Try different risk reward ratios

          • Mani says:

            can you also suggest number of back test days sir?

          • Karthik Rangappa says:

            At least, 2-3 years.

          • Mani says:

            can you also suggest number of back test days sir? what I did was, I backtested for 35 days filtered shares based on test result,then I backtested with filtered shares for next 7,14 days, is this the right method Sir?

          • Karthik Rangappa says:

            Backtesting is best if done for at least 2-3 years.

          • Mani says:

            Oh, ok sir, thanks

          • Karthik Rangappa says:

            Welcome!

          • Mani says:

            Hello Sir, regarding the Risk Reward Ratio,
            Since the trading system I am trying to create is a EMA crossover system, entry and exit price are determined by the happenings of crossover, so how to find RRR if exit price is not known before hand

          • Karthik Rangappa says:

            Mani, in case of a trading system’, you will have to assess the risk-reward on the basis of the entire system and not really on a ‘per trade’ basis. You assess the risk reward on a trade to trade basis when you are trading based on say candlestick patterns.

          • Mani says:

            Hello Sir, thank you for all the guidance so far, regarding risk reward ratio for entire trading system, how to calculate that for ema crossover system? correct me if I am wrong, if my avg pnl is 1 and my stoploss based on volatility is 0.5 then ratio is 1/0.5, is this the way or is there any other way?

          • Karthik Rangappa says:

            Yes, you basically have to estimate the ratio which helps you understand how much risk you are taking for every 1 Rupee of reward you expect.

          • Mani says:

            Sir with your help back tested and selected the stocks to trade in my EMA crossover system, I do understand that it is a beginner level trading strategy, can you suggest a trading strategy or a system(maybe 2 or three).

            Also your suggestion of ‘Inside the black box’, by RIshi Narang was very helpful, gained more insights.

          • Karthik Rangappa says:

            Mani, I would be writing about the systems in this chapter itself. Request you to please stay tuned. Thanks.

      • Mani says:

        I know this is asking too much sir, but is there a way to send private message,so that I can send my detailed test results or discuss my strategy in detail.

        • Karthik Rangappa says:

          Mani, I’d love to look through it, but unfortunately, time does not permit me for this.

          • Mani says:

            tough luck for me Sir, anyway can you suggest some books to learn quantitative mathematics for trading.

          • Karthik Rangappa says:

            Hard to point to one book. Although not a ‘Quant’ book, I’d suggest you get started on ‘Inside the black box’, by RIshi Narang.

  43. Dhruvenkumar Narendrakumar Shah says:

    I can’t find a download PDF link like Chapter 1-9, can you provide one?

    • Karthik Rangappa says:

      The PDF will be ready once the module is complete. This module is still work in progress.

      • Dhruvenkumar Narendrakumar Shah says:

        How many chapters are going to be in this Module? Do you have an approximate date by which you will make the PDF available?

        • Karthik Rangappa says:

          Pair trade has couple of chapters more. After this, I plan to discuss Dynamic Delta Hedging with options. Can’t really comment on how many chapters more.

  44. RUMA says:

    hi sir,
    how much money do you think sufficient to make money in F & O trading? another one, is it mandatory to file returns even if my net P & L is in negative? if yes, then, is there any means of help from zerodha to get it filed?
    I m a new one in this field and hv become a great fan of zerodha…thanks for being what you are…

  45. tanmay says:

    Hi Karthik,

    I had some doubt about the buy back offer. Recently Balrampur Chini announed a buy back at Rs. 150 per share, not sure when but the share price dropped to 75 as of today.

    1. Why is it so, shouldn’t the price instead of decreasing should atleast come to the price of buy back offer, because I can always buy the share at this price and sell them for buyback.
    2. How complicated is the procedure and how much chances I have for the buyback.

    • Karthik Rangappa says:

      1) This is not the best case for buyback as the shareholders if at they way to participate in the buyback, are better off buying it at a lower price in the open market.
      2) Not really complicated, you can participate online…and the chances really depends on the scrip.

  46. Riya Srivastava says:

    When can we expect a module for Algorithmic trading/ HFT?
    Thanks.

  47. Mohammad tabrez says:

    Pdf sir ?

  48. Mani says:

    Hello Sir, is the historical data provided by NSE adjusted for corporate actions?

    • Karthik Rangappa says:

      Yes, I think so, Mani.

      • Mani says:

        Sir, I have a doubt in calendar spread strategy, I have created a trading system that is able to find all the available trades and also an execution based entry system, but I am unable to find a quantitative way to determine acceptable price difference range to enter and exit trade, which I am doing manually now.

        I do understand that there is doing to be a topic on calendar spread in the future but can you give me some pointers here.

        • Karthik Rangappa says:

          Mani, once I’m done with pair trading, I’d take up calendar spreads. That will give you some insights into how to go about trading the calender spreads.

Post a comment