Module 10 Trading Systems

Chapter 15

Calendar Spreads


15.1 – The classic approach

I had briefly introduced the concept of calendar spreads in Chapter 10 of the Futures Trading module. Traditionally calendar spreads are dealt with a price based approach. Here is a quick recap on how this is done –

  1. Calculate the fair value of current month contract
  2. Calculate the fair value of the mid-month contract
  3. Look for relative mispricing between the two contracts

Based on the mispricing, you either buy the current month contract and sell the mid-month contract or sell the current month contract and buy the mid-month contract. Here is an example of a Calendar Spread –

  1. Buy TCS Futures expiring 28th June 2018 @ 1846
  2. Sell TCS Futures expiring 28th July 2018 @ 1851

Here you buy and sell the futures of the same stock, but of contracts belonging to different expiries like showcased above.  The difference between prices of the two contracts is what is expected to made here. The risk is extremely low in calendar spreads so therefore the money you make on calendar spreads is also small. If you are trader like me, who is averse to risk, then this is something you may like.

This approach to performing a calendar spread is a decent one.

By the way, if you are not familiar with what I’m discussing, then I’d suggest you read Chapter 10 in the Futures Trading module to get a quick perspective on the classic calendar spreads approach.  I think it forms a crucial foundation on top of which you can build other variant/styles of calendar spreads.

So let’s get started straight away.

15.2 – Calendar spread logic

If you have read the chapters on pair trading, then understanding the calendar spread logic is quite straightforward. This simplified approach assumes that the current price of futures is a reflection of everything known in the market. The known set of information can extend from news on the stock, corporate action, discount/premium, fair value, and literally everything out there which is relevant to the stock.

Now, if the above assumption is valid, then probably we can use the price itself as a trigger to identify opportunities to set up a calendar spread trade. This kind of simplifies the whole approach. Calendar spreads are a low-risk strategy so therefore do not expect big bucks from this strategy. However, since you simultaneously buy-sell the same asset, you take out the directional risk involved in the trade, hence it does make sense to top up the leverage. Also, unlike pair trade, the calendar spread trades can be ultra-short term in nature, with most of the trades closing within the same day. Before I take up an example to explain this, I’ll quickly give you an overview of this is done.

Start with downloading the continuous futures closing prices of the stock for both near month and next month contracts.

Calculate the daily historic difference between the two contracts and generate a time series. Calculate the mean and standard deviation of the time series. Using the mean and standard deviation data we can estimate the range for the difference. A trading signal is triggered when the difference between the two contracts move to mean plus or minus 1 standard deviation and the trade is closed when the difference collapses to mean.

You get the point, don’t you ☺

15.3 – Calendar spread example

I’ve taken the example of SBIN to illustrate calendar spreads. I have download the continuous futures data from Zerodha Pi (Zerodha’s desktop trading application) for last 200 trading days. I have got the closing prices on excel sheet, and this is how it looks –

The next step is to calculate the difference between the two contracts. It is advisable to subtract the price of near month contract from the current month contract. This is because, all else equal, the futures price of Near month contract is always higher than the previous month contract owing to the ‘cost of carry’. Chapter 10 of futures module explains this in more detail.

The difference is calculated and the time series data is generated, as shown below –

I will now calculate the mean and standard deviation on this time series. The mean will give me an estimate on how much of the difference is acceptable on a ‘day to day’ basis and at the same time, the standard deviation will give me a sense of variation in this difference. Here is the snapshot.

You can calculate the mean and standard deviation on excel using the ‘=Average ()’ and ‘=stdev()’ functions respectively.

The mean of 1.227 tells me that, all else equal, the difference between the two contracts should be 1.227 or in that vicinity. This essentially means, there is no trade opportunity if the spread (or the difference) between the two contracts hovers around this value.

We now use the standard deviation value and the mean value to calculate the range of the spread –

  • Upper range = 1.227 + 0.4935 = 1.7205
  • Lower Range = 1.227 – 0.4935 = 0.7335

I had mentioned that the spread can hover around 1.227, but I had not quantified ‘vicinity’, which is quite important. The range calculation does just that, it helps us quantify the range within which (vicinity) the spread can vary on a daily basis.. Any value of the spread outside this range gives us an opportunity to set up a calendar spread.

If the spread has increased beyond the upper range of 1.7205, it means either the near month contract has increased in value or the current month contract has reduced in value.

The rule of thumb in any arbitrage is to always buy the asset in the cheaper market and sell the same asset in the expensive market, hence the trade here would be to buy the current month contract and sell the near month contract.

Likewise, if the spread has fallen below the lower range value i.e 0.7335, this means the current month has become expensive and near month has become cheaper. Hence, the trade here is to sell the current month and buy the near month contract.

With this logic in perspective, let’s evaluate the if SBIN has given us any opportunities over the last 200 trading days.

15.4 – Spotting opportunities

Keeping the above pointers in perspective, we can conclude the following –

  1. Sell the spread when the spread increases beyond 1.7205. Sell spread means, sell the near month contract and buy the current month contract
  2. Buy the spread when the spread shrinks below 0.7335. Buy spread means, buy the near month contract and sell the current month contract.

If you find it hard to figure out which contract to buy and which one to sell when a signal originates, then simply think in terms of the near month contract. Sell spread means sell the near month (therefore buy current month) and buy spread means buy the near-month (therefore sell the current month contract).

In the excel sheet, I now look for the historical opportunities. I will identify the sell spread opportunities first. To do this, I simply have to apply a filter, to filter out all values above 1.7205. I’ve done the same, here are the results –

As you can see, on 6 occasions, the spread increases beyond 1.7205 or the first standard deviation levels. On all these occasions, there was a trigger to sell, implying the spread would fall back to mean.

In fact, here is how the spread behaved –

Signal Date Sell spread value Trade closing date Buy spread value P&L
31-08-2017 2.45 1-09-2017 1.35 1.1
28-092017 2.6 29-09-2017 1.15 1.45
30-11-2017 2.35 01-12-2017 1.55 0.8
28-12-2012 3.8 29-12-2017 1.45 2.35
22-02-2018 2.5 23-03-2018 1.3 1.2
26-04-2018 1.85 27-04-2018 0.6 1.25

As you can notice, signals originate around month ends, probably due to expiry dynamics. Also, every trade has resulted in a profit (although small) and closed the very next day.

Let us see how the buy spread trades have performed. I have filtered for all values below 0.7335, and here are the results –

There are close to 28 trade here and not all of them are successful. Of course, the losses are as small as the profits, if not smaller. I’ll let you do the exact calculation, like the way I’ve shown for the short trades.

I hope this example gives you a general sense of how to carry out calendar spread. I’m sure you’d agree that this is far simpler and intuitive compared to the classic approach to calendar spreads.

I have summarized my thoughts on Calendar spreads here and this will also double up as the key takeaways for this chapter –

  1. The expected profits and losses are small in calendar spreads
  2. Directional risk is eliminated, hence you go can go full throttle on leverage
  3. All the short trades in SBIN were successful but longs were not – this implies that I would only look for short opportunities in SBI. In other words, you need to backtest the P&L profile of each futures contract and figure out which contract you can go long on and which contract you can go short on
  4. Since the P&L is small, ensure your trading costs are minimum, a discount broker like Zerodha is most suited for such trades J
  5. Trades usually close within a day or two
  6. Trades usually originate around expiry due to expiry dynamics

Think about this, if you can backtest this across the entire universe of equity and commodities futures contract, you will essentially have at least a signal or 2 every day!

I’d love to hear your thoughts, so please do post your queries.

Download the Excel Sheet

PS: I won’t be posting any new chapters for a while, but that does not mean I’m not working on new content, it is just that the delivery format will be different and way more exciting!

Stay tuned ☺


  1. Balu Ashok Kumar says:

    Based on the mispricing, you either buy the current month contract and sell the mid-month contract or sell the current month contract and buy the mid-month contract. Here is an example of a Calendar Spread –

    Buy TCS Futures expiring 28th June 2018 @ 1846
    Sell TCS Futures expiring 28th June 2018 @ 1851 ( Pls correct this)

  2. Thirumal Sharma says:

    First comment! You are a savior Karthik sir. Thanks a ton.

  3. Nidhi says:

    Thank you sir for a such simple and effective way.. this is where your style of teaching is so different..please look into teaching momentum investing in near future..this one topic i really want you to cover..hope you look into this soon
    thanks and you are doing very good to many in markets..God Bless…

    • Karthik Rangappa says:

      Momentum investing is a part of the plan, Nidhi. However, I will have to prioritise one something else for now 🙂

  4. manoj says: would you execute this trade. As in how would you buy/sell sbin current month contract on last day of expiry and then carry to next day. like in eg of sbin we are buying current month contract on 31st August which will close that same day..but technically above we are closing on 1st sept..

    • Karthik Rangappa says:

      The data source is the continuous data, Manoj which means the action is always in the Current and Near month contracts. If the contract has expired, then the trade naturally moves to the next month contract (which is now considered current).

      • Manoj says:

        Thanks Karthik

        So how many days are good for calculating mean. Also once you spot the difference between near month and current month which is above the mean and standard based on closing, should we initiate trade next morning. What if opening price of next day falls below or in range of our mean and std deviation

        • Karthik Rangappa says:

          Manoj, no point waiting here. You initiate the trade as and when you spot the opportunity. I’d suggest you take the last 200 days avg as look back period.

      • Aagam says:

        Sir so we need to rollover both the future contracts which will lead to additional charges??


    Sir please inform me details about REFERRAL benefits. My REFERRAL CANDIDATE trade hassle free but I can’t get any benefit. So please inform me details. On thing is your ZERODHA SUPPORT TEAM NOT SUPPORT PROPERLY to open new account. My business EXECUTIVES ROOPA, can’t co operate with my REFERRAL friends. She don’t pic up my FONE or not CALL ME BACK

  6. ramesh says:

    Thank you once again. Can you please send me pdf of this chapter so I can keep reading it when I m traveling.

    • Karthik Rangappa says:

      PDF will be available when the module is complete. This will take some time.
      Thank you.

      • Prashant says:

        can you also explain calendar spread with options?

        • Karthik Rangappa says:

          Its kind of complicated to trigger calendar spreads with options, Prashant. There are multiple factors that need to be considered and not just the direction (or the price) of the market.

  7. Deepu says:

    Thanks a ton Karthik for this chapter.

    Can we do calendar in options?
    What are the parameters to take care for calendar spread in options?


    • Karthik Rangappa says:

      Calendar spread in options is tricky, Deepu. Option premiums have other dynamics associated with it.

      • Deepu says:

        Thanks for the reply.

        There are more than 200 F&o stocks. How to analyze them and track them constantly?

        Is there any way to do better than manually one by one?


  8. Samved says:

    Hey Karthik,

    I am trying to check this on the and all short trade were generated on expiry date. It seems that there is some issue with the way the data is pulled. For ex on 26 April, you are showing spread between April expiry and June expiry while it should be in May and June expiry as April will not be available next day.
    On 26 April, this is from
    SBIN 26 APRIL 233.3
    SBIN 31 May 234.4
    SBIN 28 June 235.15
    The spread should be 235.15-234.4=.75 and not 235.15-233.3=1.85
    Am i missing something.

    • Karthik Rangappa says:

      Samved, since this is continuous data, you actually trade May as current month and June as near month.

      • Samved Sinho says:

        No then there would be no trade as spread is just 0.75.

        • Karthik Rangappa says:

          Samved, I need to check this. Btw, I’d suggest you check other futures contract as well. Not all contracts exhibit this behavior around expiry. Also, you can even try and reduce 1 SD to 0.75 or 0.5SD.

  9. Keshav says:

    Where else can we get the data other than pi?

  10. Nitesh says:

    What is the range value which should be given in the standard deviation formula
    ( in the bracket of the formula) (?)

  11. Arun Kamath says:

    What about dividend data being factored in the price. Should we ignore such stocks?

  12. Nikil says:

    Hey Karthik,
    Please explain this part it is eating me.
    All the sell trades presented above are on expiry. On that day the contract will expire.
    Lets take 1 example from above 22-2-18
    according to what is presented above.
    current month- 272.45 [ Feb contract which got expired the same day] Closing price in feb contract.
    near month -274.95 [April contract] How is April near month if current month value is taken from Feb contract.
    Since the feb contract has expired one cannot take a long position there. So we need to initiate long in march contract but the closing price of march contract on 22-2-18 is 273.65 in which case there is no trade. All the trades above show the same problems.
    long spreads are not so clear. Only reliable trades are short spread ones. I have tried on some other stocks as well. Most of them trigger the trades near expiry So same problem.
    Please Explain.

    • Karthik Rangappa says:

      Nikil, since this is on continuous data, the assumption here is that you always trade the current and near month. So yeah, the deal is to trade April and March contract assuming Fe has expired. Perhaps SBIN was a bad example to use here, maybe you can try extending this to other stocks and commodities.

      • Deepu says:

        Hi Karthik,

        So in this case of SBI the trade was not there as we were comparing Feb price with April price. Further we have to compare March and April price and if deviation is there then only trade will happen-correct ?

        Request you to please post some examples of the calendar trades to help us understand it.


        • Karthik Rangappa says:

          Deepu, I must have mentioned this in the chapter itself. It makes sense to track the difference on an intraday basis. I’ll try and post few examples.

  13. Akash Patel says:

    Nice chapter..
    When will zerodha provide spread charts? ☺️

    • Nikil says:

      Hey arun,
      Thank you for sharing the program here. Could you tell us how to use this program for getting the data out to excel.
      Have no knowledge about programming and stuff.
      Thank you.

  14. Swapnil says:

    Dear Karthik,
    Any stop loss in such type of trade?

    • Karthik Rangappa says:

      Hmm, hard to identify one, guess trades like these are relatively safe. YOu’ll have to your use judgement once the trade is initiated.

  15. Sumit says:

    Hi karthik,

    First, thanks for the above tutorial. I was analyzing the data for SBI till today & saw a signal to open a calendar spread trade on lower side but within few hrs the spread moves towards average & opportunity closed.
    I backtested it on closing prices & found that whenever there is a signal on closing price, it moves towards mean very next day. My q is
    1) Do we have to use only closing prices to track the spread or other prices within a day can also be used
    2) If you are doing such trades, how do you keep a track of trigger/signal for such trades within a day. Signal generates any time of the day & closes in next few hrs.


  16. siva says:

    how to place spread order

  17. Vinay says:

    Sir can we expect Volatility based Delta hedging in the month of july

    • Karthik Rangappa says:

      Vinay, I will have to halt this because something else has come up. Will resume work in a month or two.

  18. Pritam says:

    Sir, I have been tracking many stocks for their spreads as explained by you. The only problem is that of the ask and bid spread which is making my trade impossible. The difference between the contract which is shown by the last traded price is diminished by the current ask and bid prices of both the contracts and it becomes difficult to execute the trade then. Suppose, I get a signal of +1 SD on the basis of LTP then when i look into the quote the best ask and bid prices are nowhere near +1 SD.
    Please suggest how to go about it. Thanks, in advance. 🙂

  19. Pratik says:

    Hi Karthik,

    As other users, I have also implemented the system in excel. In fact, I have also managed to get live data every 15 min by scrapping from NSE for all symbols for which FUT contracts are available. I see that there are various calls generated throughout the day as well with good returns and they close on the same day.

    As mentioned by other users, liquidity is a problem in executing such trades. Out of all 209 symbols (Index and Stocks) on which FUT are available, how to filter out the once having high liquidity on both Current and Near contract. As per my observations, Near month contract has very less activity. E.g. Observing JUL FUT contracts data in present month of JUL shows liquidity. The same started showing liquidity after 19th or 20th of JUN. Does that mean the near month contract starts getting attention in last 2 weeks of Current contract? Can you suggest a filter which can be applied to filter out the entries which has least probability of Calendar spread trade execution?



    • Karthik Rangappa says:

      Pratik, yes liquidity is an issue, but if the agenda is to trade a couple of lots, then I think it should be ok. But yes, generally speaking, the near month contract starts gaining liquidity from around the 2nd week (as we move closer to expiry). But then, if its for a couple of lots, I’m guessing it should not really be a problem.

  20. Nitesh says:

    Sir i have a trouble in calculating standard deviation can you help me in doing the calculation.

  21. Amer says:

    Sir how to get more than 200 data points in zerodha pi

  22. babu says:

    hi sir
    can we trade near month and far month contracts ?
    suppose in july, can we trade August and september contracts if we notice spread?

  23. Mahesh Bhatta says:

    Can I have PDF copy of this model?like other modules.
    For future reference.

  24. Pramod says:

    Karthik ji thank you for the wonderful material…

    Which is the upcoming module..

    • Karthik Rangappa says:

      Pramod, we have kind of stalled putting up new content on Varsity. Working on another related project 🙂

Post a comment