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 –
- Calculate the fair value of current month contract
- Calculate the fair value of the mid-month contract
- 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 –
- Buy TCS Futures expiring 28th June 2018 @ 1846
- 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 –
- Sell the spread when the spread increases beyond 1.7205. Sell spread means, sell the near month contract and buy the current month contract
- 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 –
- The expected profits and losses are small in calendar spreads
- Directional risk is eliminated, hence you go can go full throttle on leverage
- 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
- Since the P&L is small, ensure your trading costs are minimum, a discount broker like Zerodha is most suited for such trades J
- Trades usually close within a day or two
- 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.
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 ☺
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)
Ah, silly typo, will fix it 🙂
Zerodha varsity is very helpful for people like me who are new to stock market, there are 10 module 9 have the option to download it as a pdf but the 10th module doesn’t have this option please provide this option for module then also it will be very helpful and people like me can read it offline also.
Hope you will do this thanks in advance
Sagar, that is because this module is not yet complete. PDF will be available when the module is completed.
Hi, when will the pdf be available for download? will there be more modules?
Will try and complete this by next month. Yes, we will have more modules.
First comment! You are a savior Karthik sir. Thanks a ton.
You saved yourself by learning something new 🙂
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…
Momentum investing is a part of the plan, Nidhi. However, I will have to prioritise one something else for now 🙂
Hey Karthik i really learnt a lot from varsity and it has helped me trade better, can you please do chapters related to market profile and order flow analysis?
A chapter on the Market profile is long overdue. Will try and do that when possible. Thanks.
Team..how 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..
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).
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
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.
So does this mean we need to rollover our position and take up p/l by square off current trade.
The ideal situation is when you can square off the position before the expiry. However, if you are not in a situation to do so, then you can rollover.
Sir so we need to rollover both the future contracts which will lead to additional charges??
Well, not much if you are with a discount broker 🙂
Respected
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
Can you please drop your query to [email protected]?
Thank you once again. Can you please send me pdf of this chapter so I can keep reading it when I m traveling.
PDF will be available when the module is complete. This will take some time.
Thank you.
can you also explain calendar spread with options?
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.
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?
Thanks
Deepu
Calendar spread in options is tricky, Deepu. Option premiums have other dynamics associated with it.
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?
Thanks
Deepu
You will have to develop a program of sorts here, Deepu.
Hey Karthik,
I am trying to check this on the nseindia.com 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 nseindia.com
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.
Samved, since this is continuous data, you actually trade May as current month and June as near month.
No then there would be no trade as spread is just 0.75.
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.
Where else can we get the data other than pi?
Thanks.
You can check with authorized data vendors.
What is the range value which should be given in the standard deviation formula
( in the bracket of the formula) (?)
You need to include the entire data array of the “difference between the two contracts”. This is roughly 200 data points.
As you mentioned data point (roughly 200) what did you mention as data point can you give me some example sir.
Sorry, didn’t quite get that query Nitesh. Can you please elaborate? Thanks.
Sir can you tell me in detail how to calculate standard deviation (calculation process)
You can use excel function ‘=STDEV()’ to calculate the SD.
What about dividend data being factored in the price. Should we ignore such stocks?
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.
Thanks.
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.
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.
Thanks
Deepu
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.
Nice chapter..
When will zerodha provide spread charts? ☺️
Among the many things that needs to be done 🙂
I ha written a Python program to download continuous data .
https://www.linkedin.com/pulse/download-continuous-index-stocks-futures-data-nse-using-arun-kamath/
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.
Hmm, I’m not too well versed with programming as well, Nikhil.
Dear Karthik,
Any stop loss in such type of trade?
Hmm, hard to identify one, guess trades like these are relatively safe. YOu’ll have to your use judgement once the trade is initiated.
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.
Regards
Sumit
1) You can use LTP (or even bid-ask) to track the difference
2) Check Sentinal – https://sentinel.zerodha.com/
Sir, so if i use closing price of 1 hr candle to compute time series, the period is again 200 ?
Sorry, didn’t quite get that query. Can you kindly elaborate? Thanks.
“1) You can use LTP (or even bid-ask) to track the difference” — LTP of past 200 period window ?
Yes, this will be the 1-hour frequency for last 200 candles.
how to place spread order
You have to execute the two legs independently.
Any multi leg strategy should be executed simultaneously with a single click.Uufortunately you do not have that.Plz introduce that software to place the order with single click.Not only that software will pick the dependent parameter after feeding the strategy and main key input.
We do have something like this for options via our partner company, check this – https://sensibull.com/
Sir can we expect Volatility based Delta hedging in the month of july
Vinay, I will have to halt this because something else has come up. Will resume work in a month or two.
Hello,
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. 🙂
Pritam, you can actually track the spread on a live basis using Sentinal, very soon, bid-ask will also be available on Sentinal I guess – https://sentinel.zerodha.com/.
Hopefully, this will help you take the trades quicker.
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?
Regards,
Pratik
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.
Dear Pratik,
“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.”
Can you please help by sharing the excel with code?
Sir i have a trouble in calculating standard deviation can you help me in doing the calculation.
Run the function “=Stdev()” on excel, you will get it.
Sir how to get more than 200 data points in zerodha pi
Right-click on the chart and click on save to excel.
sir any way to download the data from kite???
No Vinay, you cant. Check out Pi if you want to download the data.
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?
Yes, you certainly can.
Can I have PDF copy of this model?like other modules.
For future reference.
This module is still work in progress, Mahesh. Will upload the PDF when the entire module is complete.
Karthik ji thank you for the wonderful material…
Which is the upcoming module..
Pramod, we have kind of stalled putting up new content on Varsity. Working on another related project 🙂
Hope the related project is it app based. Or Some sort of paid content if yes tha plzz plzz dont do that.
Don’t worry, Hari, Varsity will always be free 🙂
Actually my above message got mistyped completely.
Is the related project u mentioned app based if yes than plzz keep it desktop view based.
And if Some sort of paid content u are planning than plzz plzz dont do that let all this knowledge based content be free. Already lots of paid content are available which serve no purpose they make things actually more complicated.
You can shift to a Blog & put Ad on it this way you will earn too.
Like i said, Hari. We won’t educate for a fee 🙂
Hi Karthik Sir
I have a Doubt Regarding the Margin Amount that will be blocked while executing the calendar spread strategy in Same Stock Future for Different Expiries (Carrying the Position Overnight) :
Example:-In My case Stock Future is PTC
1)Sold PTC AUG 2018 Month Contract
2)Bought PTC SEP 2018 Month Contract
I have checked the Margin Requirements in Zerodha Margin Calculator and found out that Margin comes to around:
1)Sold PTC AUG 2018 Month Contract -Rs.89,340
2)Bought PTC SEP 2018 Month Contract-Rs.89,220
Total Margin Required Comes to Rs.1,78,560
In Margin Calculator ,it shows Margin Benefit as Rs.1,59,913 in Green color
And Under Combined margin requirements ,Total Margin is Rs.18,647
So,My Doubt is Whether Margin Benefit will be Provided by Zerodha ,even if we hold Position Overnight or till expiry of the Contract i.e Will Rs.18,647 is Blocked as Margin for Holding Position Overnight or Will Rs..1,78,560 is Blocked as Margin for Holding Position Overnight.
Hope you clarify in this Regard
Harish
Yes, Harish. The margin benefit is extended for overnight positions as well.
Hi Sir
Thank You for your Reply.
So if have Balance in My Account to the Extent of Margin Blocked (i.e Actual Margin-Margin Benefit).Will i be able to do calendar Spread.If Answer is Yes,At the time of placing Order,Whether two orders have to be placed simultaneously or even if we place 2 orders separately (Buy One Month contract of PTC with one Expiry and Sell Another Month contract of PTC with Different Expiry ).Will we get the Margin Benefit.
Hope you clarify
Harish Naidu
The margin benefit is extended only after you initiate both the positions. This means you will need full margins at the time of taking the first leg of the trade.
Hi,
I have two issues.
First is when I try to close an open short position of an option and try to move to another strike, I am not allowed to do so. Orders don’t get executed. I have explained with an example below.
At the start of the last week (20th Jul 2018), I had sold BANKNIFTY 26th Jul 26300 PE. On Tuesday, 24th I exited that position. Order got executed. Immediately I tried to sell 26400 PE of same series but order didn’t get executed. I tried repeatedly. I didn’t work. Then I tried selling 26500 PE of same series but to no avail. Then I tried 26600 PE of same series. It got executed.
Why I am unable to close an open position and take up another one immediately. The reason I got for order rejection could not be comprehended by me.
Second issue happened yesterday, 27-07-2018. As sson as market opened, I tried elling BANKNIFTY 2nd Aug 26800PE. I didn’t get this in the search filed available on KITE. I was getting CE options only, whereas I wanted to sell a PE option. I got BANKNIFTY AUG 26 PE option that has expiry in Aug 2018, without date mentioned. May be it was a PE option that expires on the last trading day of Aug. I tried executing the trade fro my laptop. Even on laptop I didn’t get BANKNIFTY 2nd Aug 26800 PE for selling.
Because I could not execute the trade I wanted yesterday, I lost a profit of around Rs. 800. What would have been the loss if I trade in high volumes?
Please don’t suggest making telephone calls on such occasions. I won’t be in a position to make calls.
For your 1st issue – On 24th due to the limited range for Bank Nifty you couldn’t enter a fresh position. I’d suggest you read this – https://support.zerodha.com/category/trading-and-markets/kite-web-and-mobile/articles/why-did-my-bank-nifty-option-order-get-rejected?ref_query=Bank%20nifty
For 2nd issue – I’d suggest you search for the specific contract, like ‘Bank Nifty 27000 PE’. This will give you all the associated expiries.
Hi Sir
Can there be a case where Same Stock Futures of Different Expiries Converge or atleast maintain Difference of 0.23%?
Harish
Are you talking about a constant difference? If yes, I quite doubt the difference can sustain.
HI Sir
I mean to say, Can there be a scenario where in everytime there exists minimum negligible Difference Between two same Stock Futures of Different Expiries.
Harish
Yes, and this is attributable to the cost of carry. The point is to initiate the position when the spread goes either below or above this spread, hoping for it to converge back to the minimum spread.
Dear Sir, when can we expect the next chapter?
Keshav, like I mentioned, we have stopped adding new content for a bit. Will resume in a months time. Thanks.
Greetings Zerodha team,
Is it ok to provide excerpts of the varsity content (with full credits and links) on a personal blog for non-commercial purposes ?
Please find the blog link below, I shall modify the post if you find it violating the norms of the Zerodha team efforts.
http://tradeslearn.blogspot.com/2018/08/a-summary-of-notes-and-learnings-from.html
Sure, please do share the credits to Zerodha Varsity. Thanks.
Hey Karthik,
have been a regular varsity reader. Still in my early days of learning.
Now, my question pertains with the Sentinel thing that you suggest someone up there.
I can’t really make out how to build alert for a calendar spread the think over sentinel. I must admit though, I am a no-computer guy.
Is sentinel has some other assistance desk than Trading Q & A.
Please help me with this
Alok
Not really, Alok. I’ve been thinking of putting up few triggers on Trading QnA. Will try and do that sometime soon. Thanks.
*calendar spread thing over sentinel
Please condone my typo.
Alok
hey Karthik,
Don’t you think “bid rate and ask rate” are the things to consider while getting in or out of a calendar spread.
from what i can understand, it changes the entire outlook and things look really bleak for treading this.
please pardon my ignorance, if i have botched up my own understanding, and do take a little pain in explaining me this.
Thanks
Alok
Alok, yes, you are right. But for a retail trader, calculating this may be a problem, hence I hesitated a bit. But once you deep dive into this, you will realize.
Please pardon me, I read your reply to question later.
So you mean if we fathom further, we may stand a chance mastering it?
Or did you mean, a retail trader can’t really succeed with calendar spread??
Please excuse if this sounds puerile. But, I have few options to get answers to my silly questions.
The only thing that matters with Calendar Spreads is the speed at which you can spot it and act on it. If you think you can spot this quick, then there is scope 🙂
Dear Karthik, I have looked around for the last one hour to find out how to download continous futures data as you have mentioned and havent yet figured out yet either through any youtube video or in qna. Please point me to where i can find steps to do the same. Also I have tried thrice to download Nifty 50 stocks data in link excel and it came out blank all 3 times. What am I doing wrong. !!
Priya, you should be able to download the data from Pi without any issues. Can you create a ticket on our Support Portal? Our Tech Support team will help you with account specific queries
ya. I will do that. I followed the same steps and got it yesterday evening, But today I found the sheet blank again and attempt to update was unsuccessful. I will try one more time and then create a ticket. thx
To download continuous chart follow these steps.
(1) save the stock you want on pi market watch.
(2) right click the stock
you will see all available options to click
the last option must be continuous chart
(3) click open the chart, and allow it some time to load
(4) once you have the chart , again right click anywhere on the chart .
(5) scroll down to “save chart” option.
(6) once you bring the cursor on “save chart” you will see the option of “save chart data to excel”.
(7) once you click the option allow some time to let the data get loaded on excel sheet. Here you have your continuous flow data on excel sheet.
Sorry to be meddlesome. I thought my diligence may come to use for someone, while Karthik enjoys his sabbatical.
Thanks Alok. Much appreciated 🙂
Thanks for pitching in, Alok 🙂
Oh, I wrote what I learned from my Guru (No award for guessing). I am sure you must have heard about ‘Eklavya’ from the epic of Mahabharata.
Keep learning, Alok 🙂
hey karthik
don’t forget to come to my rescue.
You rescued me 🙂
Sir ji,
My Question still lingers on. Please help me with that.
Sorry, Alok, but what is the question?
Hi Karthik, Backtested the data for a few sets with interesting results. Some of them seem to have a SD much higher than Mean. Does that make it risky or throw more opportunities. Also in the near month, the bid ask spread seems to be on the higher side, which means there are no guarantees that our trade will get executed at LTP. so how exactly do we execute the trade, at limit or Mkt price ? First Near month that has less volume and then current month ? How has your exp with Calender spread been. Please enlighten us 🙂
I’m not sure if I’m missing something here, Priya. Mean is usually very small and SD higher than mean is a common occurrence. By default, the higher the SD higher is the risk element. This does not mean more opportunities.
Agreed with you on the bid ask bit on the near month, hence for this, its important to look at the trade with bid-ask in perspective and not really LTP.
I used to use an algo to identify calender spreads, but that went bad, since then I;ve not really revived this.
The bid ask part makes sense. I meant more opportunities b’cos the spread has a higher number of variations. The very thing that causes high SD also means more opportunities in my understanding. Curious about what went bad with your algo. Thanks a ton for all the education. I started with no knowledge of any technical analysis, thx to your great content my learning has come pretty far.
Glad to know that Priya 🙂
One thing lead to another and the algo went rogue. Never really bothered to revive it. But after writing this chapter, the interest has rekindled, maybe one of these days 🙂
Sir we’ve been waiting since weeks for next update and content from varsity. Could you please tell us what is it going to be? We’re curious.
Sundeep, suggest you wait for another 15 – 20 days, please 🙂
Thanks.
Hi Karthik ,
Instead of Stock Future , can we apply this strategy on Index Future Nifty or BankNifty.
You certainly can.
Hi,
Loved the content as well as the presentation.
The 16th श्लोक of first chapter in मालविकाग्निमित्रं created by कालिदास says,
श्लिष्टाम् क्रिया: कस्य चिदाम्यसंस्थाम्
सक्रन्तिरन्यस्य विशेष्युक्ता
घुरि प्रतिष्ठाः पायितव्य एव्
तस्मैअयम् साधुः स् शिक्षकाणाम्
अर्थात् : एक शिक्षक का ज्ञान गहन होता है, दूसरे में ज्ञान प्रदान करने कि अर्थात प्रशिक्षित करने कि क्षमता होती है. परन्तु जिसमें ये दोनो ही गुण् पाये जाते हैं वो शिक्षक सभी का सिरमौर होता है…
One teacher has immense knowledge, another one has the ability to teach and train. But the one who has both these virtues is the king of all teachers…
Keep doing the good work sir..
One request Can you put this module as well in pdf downloadable fornat. Thanks in advance.
Thanks for the very kind words, Hariom 😉
This module will be made available in PDF when it’s completed. Planning to add some more content to this module, will do that sometime this year. Thanks.
In the article you have mentioned and I quote “I have downloaded the continuous futures data from Zerodha Pi (Zerodha’s desktop trading application) for last 200 trading days”
As Stock Future contracts are traded for only three months, hand 200 Trading days means approx. 40 weeks, meaning 9 months & 1 week how do you get Near [current] & Next [Near] month contract rates for the calculations?
Pls if possible respond.
Thanks
There is an option to switch to continuous data, Vipul. I’d suggest you give a call to our support to figure this out. Thanks.
Recently i am seeing an influx of traders talking about market profile, order flow, etc. I wanted your expert opinion on the matter. Does Market Profile analysis give exact point of entry and exits? and supposedly they are always accurate? If that is the case then we need the stuff in zerodha kite and fast..
We also know about TPO, VAL, VAH, POC etc..
I’m really not sure about the accuracy. Also, as far as I know, MP needs to be licensed from CME.
Sir,
Please write notes on order flow analysis. Does it helps us to identify the movement of market???
Thank u
Will look into this. Btw, have you looked at candlestick techniques?
Hi Karthik,
Thanks for such a nice content. I’ve been waiting for this since long. I have couple of questions:
1- As you said, speed is the main factor to spot this opportunity, however being a retail trader, I have no expertise in writing a program for the same and nor do I know how that program is used with Pie or Kite.
Appreciate if you could suggest some ways or some good company which can help me with that.
Sudeep, thanks for the kind words. I know few people use Sentinel to identify live triggers – https://sentinel.zerodha.com/ for this.
2- Are we going to spot more opportunities if we use this in commodity’s future or some other underlying instead of just equity?
I’m not sure, Sudeep. But I’m somehow inclined to believe so 🙂
Sorry there is one more question, if I carry the spread till expiry, is the difference between the two months future contracts would be close to zero bcoz once I checked on money control the difference was quite big in Nifty futures.
The idea is to carry the spread till the spread reveres to mean or a level you have in mind as the target. No point keeping this to expiry.
Thanks Karthick for the excellent module, request for a P&L demo / screenshot on trades with calendar spread.
I’ve not taken a trade on this Vinod, the idea was to explain the technique.
Hai…zerodha varsity is awesome…am working in a Pvt bank wr I am insisting my colleagues to read this…as it gives good insight on capital market investment…
My request is also tap bond markers, currency and IRF as these are the monther of all capital markets
Thanks for the kind words and also in helping with spreading the word. Yes, content on bonds is long due. Will try and do that soon 🙂
Sir I know you’ve a lot of experience in stock markets. Do you have a notebook to record all your experiences and lessons in a consise manner or how does it work? Just curious.
Varsity is my record, Sundeep. I record and share everything I know here 🙂
Most famous traders I know, only use only one or two methods that they master. What was your need to master a lot of complex strategies sir? Could you explain?
These are not complex. In fact, it is a bunch of principles applied to different setups.
Hi sir,
Your modules are a complete knowledge resource for stock market enthusiasts,no doubt.Recently i came across this LEARNAPP which provides video lectures on the same thing you teach for free.Is it worthy to enroll in that?(I came across this learn app through zerodha connect :p)
Learnapp, is a great place to get started. The team is working really hard to put up high-quality video content. I’d suggest you enroll for a couple of free webinars to get a sense and then decide to enroll (or not).
Sir, You have taken day wise data in the example. My query here is do we have to take tick by tick data (every sec) for 200 data points or end of the day data to calculate mean/SD and place trade next morning when we have trade opportunity. Please explain as if its tick by tick then we need to have live feed in excel to spot the right opportunity. Thanks in advance
Well, tick data in this particular case would be nice, but I’m afraid excel kind of platform won’t be able to handle the load.
Thanks Sir, you explain in really nice way. Can you please recommend the right platform for this kind of trades. Also, what other systems/techniques are there for arbitrage.
I’d suggest you look at Kite to execute these trades. The systems can get really complex, really depends on what you are looking for.
I am already using Kite. My question is by looking a live feed it’s difficult to calculate mean and SD for every second or manually. Is there a different way using Kite that I am missing ?
I am looking for a trading setup which is less risky like arbitrage. Thanks
Just by looking at the numbers, estimating mean and SD would be tough. However, there is a work around – you can always get an estimate by plugging in a range of possible range of outcomes. I’d suggest you run through earlier chapters to get a sense of how this can be done.
Hi sir,first of all thank you for giving such type of easy modules to us, i am new comer sir,i am interested in trading in futures market, i read basics of stock market,technical analysis,fundamental analysis and futures trading modules in varsity, my question is what should i learn next ,i don’t know any one in the market field to take suggitions ,please replying me sir, thanks in advance.
Durga, if you’ve read all these things, then I guess you should try and place few small trades in the market to put all the theory in practice 🙂
Hi Karthik sir,
I would like to thank you & Zerodha team for creating Varsity and sharing these valuable knowledge with all of us. In old chapter of Options you mentioned about Delta Hedging as a trading system. Can we hope to see that in this module?
Thanks, Pradyut. Yes, I plan to write about here in this module – https://zerodha.com/varsity/module/trading-systems/
Dear Zerodha Team,
You have been doing great work and it has been great sticking around with you (not financially). It would be highly appreciated if you can create your youtube channel and make some videos regrading all the important topics. For the calendar spreads you could make a live trade and show the results and also for most of the other varsity topics.
You could even elaborately explain regarding your various products and how to use them (like brokerage calculator, margin calculator etc) and I think it would be highly beneficial for rookie traders and also provide tons of info nonetheless for everyone.
Action in this regard would be highly appreciated.
Glad to hear that, Gautam. We do have a Youtube channel where we put up very interesting videos, do check this – https://www.youtube.com/user/zerodhaonline
Sir there was a screener option in Stock Report of Thomson Reuters where you can chronologically view the list of stocks that have the highest ratings. Now I could not find the screener option. Please help me. Thanks.
We are looking into that, Sundeep 🙂
Sir please don’t it the wrong way but I’ve already subscribed for the service and it’ll be of no use it me if you don’t resolve the issue quickly. And secondly, when can we expect the next chapter on varsity? Thanks in advance.
Sundeep, as I have mentioned in this chapter, have taken a break as we are focusing on another project. Will resume as soon as possible. Also, which service are you talking about?
1. The other project is what I’m talking about sir. You said it’d be much more exciting, which piqued our interests.. :-). Could you give us a tentative date sir?
2. I have subscribed for Thomson Reuters service and they used to provide screener service. But now its not available. Please guide me on this. Thank you.
1) Hopefully another month 🙂
2) I guess we will make this feature available soon.
good,what r timings of mkts from oct 1 is it 9-12pm,and how to buy sell BONDS(10Y)IN ZERODHA
Market timing has not changed yet.
Sir, if we carry the spread till expiry how will it be adjusted. Will it be profitable.
The idea with this technique is not to carry this forward to expiry, you exit when there is a convergence or divergence.
Thanks sir. Regard
Hello sir. I’ve been using calendar spreads for few days now. Everythings good but i find it difficult to execute at right price where either of the condition meet(converge or diverge). I know it should be quick and sometimes liquidity makes it difficult to execute, anyways you’re the only one who can suggest me a way if there is any. Thank you Karthik sir.
Kiran, I understand. Maybe you should check the alert platform – https://sentinel.zerodha.com/ , there are mathematical operators which you can use to get real-time alerts on prices.
Yes sir i’ve been using advance triggers. Hoping for better liquidity. Thank you 🙂
Good luck, Kiran!
Sir I have been a big fan of your work since I find varsity and I should say that I have immensely made use of your material. I have been able to use your technical analysis and options trading strategies to a reasonable profit. I thank you for that. However one thing I noticed is that a lot of those simple technical indicators have stopped working I think mainly because it has become commonplace. I had long back suggested that you come up with a list of suggested reading after each module. Sir could you kindly please quickly tell me a list of 10 books that would go beyond varsity? Mainly about 1. Technical analysis 2. Quantitative Trading 3. Books to better understand options. Ps: I have printed out a few of varsity modules in their entirety and gave away to few of my colleagues. They have found it helpful too. Thanks for the good work.
Sundeep, thank you so much for the kind words and a massive thank you for sharing varsity with your colleagues. This is very big of you. For TA, I’d suggest you read through level 1 and 2 books of CMT – https://cmtassociation.org/chartered-market-technician/ and for Quants, I’d suggest you read through various discussions in Willmot forums. Here are few good books as well – https://tradingqna.com/t/which-are-the-top-5-books-one-should-read-to-become-a-better-trader/200/8
Sir I have to tell you that a few of my friends have started analyzing companies by themselves and getting started in investing, after I gave them the printed varsity material. I strongly think varsity should be available in print format- Just a humble suggestion. Now I have a question. Thanks to TA Module and FA Module, I have been able to make trades based on indicators as well as based on company and economic results. Like I said I am no longer comfortable with using the standard TA indicators. Now I am thinking about building a Trading System. I know that you strongly recommend Pairs Trading. But I don’t want to delve into that without learning it fully so I’ll stay away from it for now. What do you think I should build my Trading System around? The strategy- What would you suggest? Your input would be very much appreciated.
Sundeep, thanks again. I don’t really recommend pair trading, remember, pair trading is just one of the many available trading systems. Then there is the momentum strategy, there is the magic formula (combination of both fundamental and TA), and a host of other strategies. I’d suggest you give the momentum strategy, to begin with, plenty of content available on that.
Sir I have often read in various book that momentum strategies that are already available will be of no use in the market because too many people will be using it and so one has to improve upon it. Do you agree with that? If so, how do I improve upon a strategy sir? And which book would you recommend for momentum strategy?
Yes, I do agree. However, this also depends on how you define momentum.
Sir let me ask these questions again.
1. You say momentum strategies are based on how we define them. I don’t know how to define them and just getting started. What resources or books would you recommend?
2. If common momentum strategies don’t work then how do you improve upon them ? Your thoughts on these things will be appreciated.
Thanks in advance.
1) I intend to write a chapter on this, Sundeep which will include one basic way of defining momentum
2) This is where your market intel comes into play, you can improvise on concepts and try and identify your edge. This is easier said than done, takes time and experience in the market.
Sir let me ask these questions again.
1. You say momentum strategies are based on how we define them. I don’t know how to define them and just getting started. What resources or books would you recommend?
2. If common momentum strategies don’t work then how do you improve upon them ? Your thoughts on these things will be appreciated.
Thanks in advance..
Sir I will surely look forward to varsity chapters on momentum strategies. But in the mean time can you recommend me two books / resources on the same? It’d be much appreciated. As I said I’m developing a trading system and your inputs would make a lot of difference.
I’m unable to think of any at this point, will get back shortly.
I will surely look forward to varsity chapters on momentum strategies. But in the mean time can you recommend me two books / resources on the same? It’d be much appreciated. As I said I’m developing a trading system and your inputs would make a lot of difference.
Hello sir(again)😊. After a while of homework I found liquidity in few next futures contracts. Traded them, made less profits but was planned one. I would like to know, in what condition would the spread increase? Having a fear inside after taking trades that it might increase if I’m short and decrease if I’m long on positions. That eventually come back to mean in sometime. But what are the odds? Do I’ve to wait or should close with loss, as always guide sir.
Spread increases when there are stock specific events, Kiran. The calendar spread is relatively safe, you should hold if you can 🙂
Thank you sir. That would be all 🙂
Good luck, Kiran 🙂
Apart from amazing module information, discussion under the chapter does help us. I had few doubts and were cleared while going through comments.
1. I wanna know out of all the strategies calendar spreads look pretty better and logical than simply using lagging indicators, is that true or i only feel it? and are they good for long term trading?
2. I would like to know which were your most practiced strategies? I would love to try them.
Thank you so much(words cannot describe the value for this free knowledge). Varsity is one stop.
1) It is true, but the biggest challenge is spotting the opportunity and execution
2) There are plenty of strategies like these – Pair trading, calendar spreads, delta hedging, MA based, TA based etc.
Happy learning!
Sir,
When can we expect the remaining two strategy here?
By the end of this year, hopefully 🙂
Can I get the historical data for BOTH near month and next month futures from kite or Pi ? Like for example data for AXISBANK18JANFUT and AXISBANK18FEBFUT for January, 2018.
If it is possible, then how?
I’m talking about hourly or minutely candles and not day data.
Yes, you can.
You can download that from Pi, Sourab. Open the chart, right-click and select the ‘Save to excel’, option.
Is there is way to do it with kite connect api? Because I don’t have windows and I’m having difficulties running it using Virtual Box or wine. If there is any other way than Pi, then please let me know.
Of course, you can. In fact, its better with the APIs. Have you seen the API documentation – https://kite.trade/docs/connect/v3/
Hi Karthik,
Yes, I checked that out, but as you can see that we’re allowed to fetch only “day” candles in case of continuous = 1 parameter for futures data.
What I want is near month and mid month futures historical hourly or minutely candles, which doesn’t seem possible with kite connect api.
Ah, Sourab, I’d suggest this query here – https://kite.trade/forum/
Hello Sir,
I have studied all the chapters from technical to options and future. I work in office. And try to trade in office hours. But somehow I always loss. I know the theory part but in practical part I loss.
Please advise me.
Tinishu, trading requires a lot of attention, maybe you are unable to concentrate on both work and trading. I’d sincerely suggest you invest in stocks for the longterm, get comfortable with holding stocks and then eventually move to trading.
Sir,
I try to do intra day trading but incurred losses as I am not able to get the time for intra-day trading.
Please can you suggest some strategy or way to trade for working professionals so that I can trade with the stop loss and target. Option strategy or something…
Thanks
Tinshu, you can explore positional trades (swing trades) or even option writing.
Sir,
Suppose I sell future of Tata motors for swing trade. Now should I also purchase call option for Tata motors for overnight position just to hedge it ? Any other suggestions.
Thanks a lot.
Yes, or you can buy the futures of TM, expiring next month as a hedge.
Sir
1)You suggested to buy next month future as hedge…I mean it will be just for overnight position, suppose I sell TM futures for positional trade and every day at 3.20 pm I should buy counter position next month future and in the morning I should square off that counter position so that I can mitigate myself for any bad news which comes after market closing. And every day I should also place stop loss for my swing trade ?
2)But in general I think sir swing trade is little bit expensive one in case I losses 2 3 trades I have to increase my trading account balance to continue place swing trade…
Thanks
1) Well, if your idea is to mitigate overnight risk, you can do this. Else you can even carry forward an option position.
2) Yes, but swing trades also tend to get very profitable if done right.
Sir,
What does it mean carry forward option position ?
Thanks
That means you carry forward the position overnight.
Hi Sir,
Is swing trading is also applicable for commodity or for commodity intraday trading is better ? If yes, then according to your experience which commodity is better suited for it ?
Thanks
Look at any commodity which has liquidity, like Gold and Crude.
Hi, Karthik!
Please make a pdf for the module 10 as well.
Regards,
A
This is work in progress, Avijeet. The PDF will be done once the module finishes.
I would like to understand how to down load from the Zerodha pi the historical values of the scrip .. i could not get it right … thks
You can open the chart for any scrip. Once you’ve chosen the required timeframe, right click and you should find an option to Save Chart. You can choose Excel and the historical data will open in an Excel sheet.
If I want to trade on Spread how can i initiate?
Like I want to buy 10 Lot of Nifty Nov at 10400 and sell 10 Lot of Nifty Dec at 10450.
As per zerodha margin calculator it needs 1.6L as margin since position is hedged.
But to initiate first any of the trade I need to have 7 Lac. so then How can i initiate the trade?
Kundan Bagchi
Yes, to initiate you need the full amount, Kundan. Once you initiate the other leg, the margins are released.
Hi Karthik,
Thank you for the wonderful writing..
Can we expect further modules
Thats the idea Pramod. Will do that.
Thank you Karthik
Waiting for further modules….
Can you please consider writing more about options and analysis of open interest…
I will try and do that, Pramod. Thanks.
Loved the modules! Just wanted to congratulate and thank you for the efforts!!
Thanks so much, Vyshak.
Kind Attn Mr. Karthik Rangappa.
Respected Sir, Is it possible to apply the same strategy with commodity “Futures Spread (Commodity Trading)” Like Gold, Copper, Silver etc, I think these are high liquidity compare to equity future, Want to apply the thumb rule in arbitrage Buy Chep & Sell expensive. Base on the availability of the best opportunity.
If I am making sense for the above-stated Trading method is the risk factor will be the same like as lower as Equidity calendar spreads? Kindly suggest it’s ideal to do “Futures Spread (Commodity Trading)”.
Waiting for your valuable suggestion and early response.
Best Regards,
Soumen Sen
Yes, you certainly can apply this to commodities and currencies as well.
Many Thanks for your quick response.
Good luck, Soumen!
Sir,
Sometimes I see arbitrage opportunity Current Month and Far month in Gold, as of Today around 12:05 PM I see around 150 Point different current month & Far month i.e. “GOLDM NOV FUT & GOLDM JAN FUT”, relatively high gap compare to “GOLDM NOV FUT & GOLDM DEC FUT” ( The gap was very narrow current month and mid-month around 55 Point ). ( but the gap was an ideal arbitrage between the current month and far month around 150 Point) Is it ideal to apply rule buy cheap i.e Buy Current month contract and sell more expensive Far month contract compare to mid-month contract. ? Please guide can we do an arbitrage/calendar spared between current month and fat month as well, or need to stick with the current month and mid-month only.
You certainly can initiate the trade on current and far month contracts, no problem with it as such. It works the same way, buy the cheaper one and sell the expensive one. Make sure to close the spread when it converges to a meaningful level.
Good morning sir. I hate to pester you like this but you said you would get back to me on a couple of questions and you haven’t. I am just reproducing the same here.
1. Book recommendation on Momentum strategies.
2. Investment hacks- Profiting from special situations in the market.
3. (Not a question, just curious) When is new stuff coming up on varsity sir? I am waiting for it since long time.
1) Sundeep, unfortunately, I’m unable to source any reliable books on the Momentum strategy
2) I’d suggest you look at Ganapathy Vidya Murthy’s book on par trading, the first half of the book deals with the special situation
3) Working on another project related to Varsity, once that takes some shape, will get back to this 🙂
First of all I would like to express my gratitude for all your valuable articles, that too, be made available on free of cost. Such a wonderful work and such a wonderful mind. I am new to the share market. Only on earning Rs.39,000/= and losing the same with additional cost of Rs.4000/- for my adviser, i turned to know the share market myself. All your articles in general and the modules in particular are very helpful to understand this subject. I have just gone through module 1 and yet to cover all other modules. Before continuing just I want to thank you for your wonderful help on this subject rendered to all who care for it. After reading the remaining modules, I will revert back to you sir for any clarification. Meanwhile remaining thankful in my heart, yours sincerely, R. Gurunathan.
Gurunathan, thank you so much for your kind words 🙂
Hope Varsity helps your understand markets better. Please feel free to ask your query, will be more than happy to help 🙂
Hello, sir suggest few good arbitrage books or articles you known. 🙂
I’m not too sure, Kiran. As far as I know, there is no book on this. Will keep you posted if I come across any. Thanks.
Okay sir.
Welcome!
Hi Sir,
I have downloaded historical data for nifty futures from NSE. Now how to download the near month data? i am unable to see any options in NSE.Can you pls help me
Shyam, I suggest you check this – https://www.nseindia.com/products/content/derivatives/equities/historical_fo.htm
Sir I downloaded the price for last 365 days .This will be the closing price .Now for near month what option should I select?
Near month is November expiry, Shyam.
thank you sir
Welcome, Shyam!
Why this module is not available for pdf download?
Kumar, thats because there are few more chapters pending. Once that is done, we will make the PDF available.
Hi,
Karthik Sir
I want to know if I want to consider the Bid/Ask Quote of the two contracts than what shall I consider to calculate the spread. Can I do like this that I take the average of the Best Bid and Ask of the contract and find the spread?
Also, I will build an Algo on this and make sure that it only place the trade when the mid-month contract Bid/Ask spread is less than 2. This ensures that I reduce the slippage (if not eliminate). And take the trade at 2SD instead of 1SD, so that I get a good window length for the order execution. If all the above requirements are met then it shall place the order. Though I will a get a fewer trades, it will of the better probability considering the Live Tick Data.
Please Enlighten Me
I am really a Newbie in Trading.
Thank’s Alot
Absolutely, Harkishan. Considering the bid/ask on a live basis can lead to good outcomes in measuring the spread. Place mid-month trades, but as long as the trade qualifies at 2SD. Fewer but reliable trades is far better than way too many trades with not so good results.
Thank You, Sir.
I backtest the system over a month of live Ticks. And the result was quite tasty ;), considering the risk (which is almost nothing).
Hope to see more such market neutral strategy on Varsity.
Yes sir, that the agenda!
Hi Karthik!
I want to know when is it feasible to enter these trades considering the costs, or are the costs to execute these trades lower than normal? Does it work only on stock futures or for index futures as well?
Thanks.
You get margin benefits. About feasibility, check this – https://zerodha.com/varsity/chapter/calendar-spreads/
Hi Karthik!
Thanks for the reply.
I was thinking whether there have been any instances in the past where the difference in spreads has gone significantly adverse?
What would be the consequences if reversion to mean does not happen? What would happen if 2 std dev spread becomes 4 std dev or 5 std dev?
How to put a stop loss in this strategy? How to allocate capital
Thanks.
Oh, yes..this is certainly possible and it does happen. For this reason, it is best to initiate the trade at 2.5SD with 3SD stop loss.
Thanks for the reply!
Now for 3SD as Stop Loss, I’ve to get the bid-ask spreads, which are mostly far from ideal, but ideally should converge on expiry.
So basically, I have to reverse the transactions that I initiated earlier. But the bid-ask spread for say DEC–>JAN is often different from JAN–>DEC (when I reverse). And I can’t put a SL on the reversal of transaction because it should ideally converge around the expiry. So I have to put the SL on the first leg but exit is based on the second leg. Further, the 3SD would be calculated on the first leg.
Example: Closing prices of TCS Futures on 12/12/2018
DEC Future: Bid: 2024.8, Ask: 2027.25
JAN Future: Bid: 2030.2, Ask: 2034.95
First Leg: Buy Jan, Sell Dec – Buy at 2034.95, Sell at 2024.8 —-> Difference: 10.15
Second Leg (reversal of first leg): Buy Dec, Sell Jan – Buy at 2027.25, Sell at 2030.2 —-> Difference: 2.95
Now the first leg difference might go from 10.15 to -20.15 (above 3 SD) but my exit would be based on Second Leg, the difference of which can be anything. So I can’t unwind the trade if second leg difference isn’t appropriately priced.
Any alternative?
“but ideally should converge on expiry.”–> convergence can happy anytime before expiry. Remember, this is convergence to mean and not fair value.
At initiation, if you are looking at the bid and ask, then at square off you need to look at the ask and bid respectively for the same 2 contracts.
By the way, why are you taking the pricing here, is’nt the play entirely on the divergence from mean?
Yes the play is with mean and SD. Actually I made a program which gives me a signal considering bid-ask and ask-bid like you mentioned. But when I want to unwind and look at ask-bid, it’s far from mean mostly, so even though the reversion to mean has happened on the basis of LTP, on the basis of unwinding of the trade at then ask-bid, it has not.
Consider this data for TCS (only as an example, not factual numbers):
For Dec-Jan contracts
Mean: 8
SD: 2.5
So when the spread b/w Jan and Dec goes below 5.5, I will buy Jan, sell Dec (considering 1SD for ease).
Now at the time of unwinding, I have to Sell Jan and Buy Dec, and based on LTP, the difference between Jan and Dec has now moved to mean and is at 8. But the spread of Bid for Jan and Ask for Dec is only 4.5, which means that if I unwind at market based on bid-ask, I’ll make a loss of 5.5-4.5=1 per lot instead of profit of 8-5.5=2.5 per lot.
This has been the problem with all the stocks including liquid stocks. I’m unable to get around this because of this execution problem. Now to unwind, I have no choice but to go for Limit orders, but that carries at risk when prices move fast. Only one of the contract might get executed and other may not. Even a small change in spread can make the profitable trade into a loss making one.
So I wanted to know how you go about it? Does this ask-big (unwinding) spread also normalize and revert to mean near expiry? DO you go with limit orders or market orders?
Appreciate your reply.
Got it. Amey, I’ve not really had this concern so far. A couple of things –
1) I initiate the trade closer to 3rd SD and close at anywhere between 1 to 1.5
2) I give the trade enough time
I do have a minor hit in terms of impact cost, but not to the extent of eroding the profits. I’m guessing you are looking at this from a very short-term perspective?
I’m ready to hold till expiry provided the ROIC is good considering this strategy (absolute return expectations are low). No qualms. In fact, I would prefer to hold for long. And for being doubly sure, I calculate the theoretical value as well, along with a small scenario analysis if my assumptions relating to interest rates were different. But I’ve seen that there is always a difference between the ideal theoretical value and actual value; rather the prices are farther from ‘fair value’ most of the time and I’m okay with that.
But 3SD is a high benchmark. This problem won’t crop up at 3SD but even 2SD is rare and opportunities come and go quickly. One has to be almost glued to the screen to execute this. Have you completely automated the strategy?
Thanks btw.
Amey, you need to automate this completely. The manual process may not really work.
How can I do that? I have it in excel and it gives me BUY/SELL signals based on the prices. Now I just have to take those signals from Excel to Zerodha to place orders.
Is there any way I can link up the two so that I can place orders on Zerodha on basis of signals generated in Excel and automate it to that extent?
Thanks.
You can check this, Amey – https://kite.trade/
That’s interesting!
Can I get something where I can link my Excel sheet with Kite or Pi and fire orders directly? Kind of sad but I’m an excel guy, not much of a coder. Can write programs in excel.
You can try linking excel with Pi, there is an option to do so.
Also, a follow-up.
How do you practically go about it? How do you open and close the position?
Unwinding the trade is a problem because of adverse bid-ask spread. Do you unwind with limit orders at LTP? What do you do if only one of the orders gets filled?
What happens is that even though I’m in good profit based on LTP of the two contracts, unwinding the trade at market prices would convert it into a loss.
Would appreciate if you could give kind of a walkthrough into your method.
Thanks.
All these are practical issues, but gets taken care when you deal with highly liquid stocks/indices. However, you always have to account for some slippage here. Limit orders are best, but best if you can place market orders and get out quick, therefore the need for highly liquid contracts.
Sir, u finished trading system module is it??? Or is der other trading modules coming up???
Not really, like I have mentioned in this chapter, I’ve taken a break to work on another project. Will get back to this by next year 🙂
Sir, u finished trading system module is it??? Or is der other trading systems coming up???
when can we expect financial modeling
Next year sometime, Shiva.
Hi Karthik,
First of all thanks for your effort to breaking down the things to make lay man understand.
My query is in your first chapter of trading systems it is mentioned 4 trading system but I did not see Delta hedging strategy explained anywhere.
In case it is already covered in some other place of other modules, can you please let me know the reference ?
Thanks in advance
Chandru, I have kind of stopped uploading new chapters for some time, I’m working on another project related to Varsity. Will resume shortly.
Sir is Trend following and momentum the same thing? If not how would you describe momentum in few sentences?
Yes, Sundeep they both are the same.
Hi Karthik! I have read and loved the whole series. Thumbs up there. I just wanted to ask if there are other trading systems or techniques which might be of use for me coming from stats background. If you could name some other strategies or system, i would love to give a read on my own (I know you will cover more of these in your later writeups). It would be very helpful to me.
Thanks in advance 🙂
Glad you liked it, Arpit. There are quite a few strategies – Momentum, Delta Hedging, Multi-variate regression etc. I hope I can write about these sometime soon.
I personally feel just moving average cross over can give good returns. May be more number of small loss making trades but the winning trades give much higher returns. I even back tested many MA cross overs on some stocks and many of them gave me more than 3% returns per month when traded every signals with stop loss. So on leverage (14 times in some stocks), I can make up to 30-40% per month. Of course money mangement is important. MAs make sense. I am just trading the trends. Why complicate with complicated theories? Your views please..
Absolutely true, Santhosh. MA system is the most elegant and simple. Works as long as there is a trend in place.
Sir if you can remember my name i know how many queries I’ve posted and how big a fan of varsity i am. But for the past few months, checking out the platform everyday and not finding a new chapter for me to read has been the most disheartening. Could you please just give us a hint about what it is that you’re coming up with and a tentative date when it’ll be available?
Sundeep, thank you so much for the concern. I will get back to this. By the way, do you follow us on Social Media? If yes, please wait for another 2-3 days 🙂
After going through all the modules, thirst for trading knowledge is over. Now it’s time to trade. The way these modules are structured is mind blowing . But why did you stop here?
I am eagerly waiting for the next module. It’s really easy to go through these modules and grasp the useful bits.
Please don’t stop at this. I strongly encourage you to keep this moving
Glad you liked the content, do you follow us on Social media? If yes, look for some exciting news today 🙂
Sir I’m slightly confused here.
1. What would be new in the app apart from the ease of consumption? Could you tell me a little more about how the app would work?
2. When is the app coming out?
3. More importantly now that its almost over, would you continue writing modules on varsity again? Me and few of my colleagues are dying for new content from varsity.
Cheers.
App is going to be quite exciting, Sundeep. Hopefully, it should be out mid-Jan. I’ll surely get back to Varsity, sometime next year for sure!
Hi again!
A few more questions after 2 months full of observations and experiences 🙂
1. “You can max out on leverage” – how much leverage is good in this strategy? What are your limits? If someone has a capital of say Rs. 1 lakh, what should be the limit of traded value?
2. What are the factors that can increase the spread further and further?
3. Do dividends affect price of one contract and not the other? Because sometimes the spreads are unbelievable.
4. Is it prudent to trade on the day of expiry?
5. Is it prudent to enter trades for next pair of contracts immediately following the expiry of current contract? For eg. Now that Dec-18 month has expired, should we initiate Jan and Feb-19 contracts from Friday itself? Why or why not?
Thanks.
1) There are no straightforward answers to these questions, Amey. Ideally one should avoid F&O with capital under 3 lakhs.
2) Demand and supply situation in the short term
3) Yes, they do. Also depends on the extent of dividend expected
4) Again, depends on the situation on the expiry day. You need to consider the volatility as well
5) Yes, as long as the situation warrants it.
Thanks!
So dividend or expected dividend can distort the spread? Basically, are spreads affected by dividends?
Yes, if the dividend is expected then the futures prices reflect that and therefore the spread.
Hi Karthik!
Does dividend affect prices for both the months of futures contracts or only one? And how?
Thanks.
It has an implication on the contract which has expiry around the time of the dividend declaration.
Sir what exactly do you mean by continous data. In the table having the data you downloaded(shown in the figure above) ,does all the prices under current month have the same expiry and the prices under near month have the same expiry date that is the expiry succeeding the expiry under current month.Can you please elaborate on the data that has to be downloaded?
Continuous data means that all current month data is clubbed under one time series (Current month) and the 2nd month in another time series. They don’t have the same expiries but rather the data is clubbed to ensure continuity.
Hi Karthik,
I have a doubt on what would be the effect of the recent decision by SEBI to move towards physical settlement of stock derivatives on the pair trading and calendar spreads trading, could you please share your thoughts ?
1. For pair trading, would it be better off to take trade the near or far month futures considering the number of days the trade would be open is not know ?
2. Also, seems like for calendar spreads, trades which gives signal to buy the current month future on the expiry day will not be possible, is it ?
Thanks..
~Ravi
Both won’t be impacted, Ravi. These trades tend to close fast and hence there is no need to hold till expiry. Of course, the margins may increase as you move closer to expiry, but the other characteristics remains unchanged.
Hello sir,
Your way of explaining the concept is very interesting and nice. Thanks for these useful information.
I request you to mention the list of reference/important books for further study.
Thanks
Ashok
Thanks for the kind words, Ashok. I have shared the list as and when appropriate in the module.
Can i take Calender Spread on crudeoilm.
ex-
buy crudeoilm19feb at 3860
sell crudeoilm19mar at 3893
Expect it the price difference between the contract will decrease.
Yup, certainly. Please be doubly sure that the spread has a good divergence.
For Crudeoil Contracts-
Should i use continuous chart or normal chart to download excel sheet from PI?
i have downloaded both (Continuous and normal) showing different mean and variance. Dont know which data to use.
Should i use 200 days data or something different days to calculate mean and std deviation.
Any Book for Calender Spreads as reference?
Thank you for your valuable time and your content is superb.
Abhilash, you should use the continuous charts for this. Use the 200 EOD data points.
i want to download 10th page
Hi Kartik, on test run I found that its very tough or say impossible to execute Calendar spreads. LTPs at which spreads appears in the futures are never executable since they just disappear in a very short time. Any suggestion on how to handle this situation?
Himanshu, I get your point. Perhaps, going the full algo way is the only solution 🙂
Thanks Kartik. What do you mean by full algo?
Like a colocation server at the exchange.
Sir,how about kite connect API?Would it be fast enough? Or would you still suggest colocation server ?
This depends on the look back frequency of your data. If you are checking for the spread every minute or two, then Kite Connect will help. If you are talking sub-milliseconds latency, then maybe colo.
Does the bid ask prices change in milliseconds for stock futures? I have observed bid ask prices staying same for 4-5 seconds i thought it is because of less liquidity especially the near month contracts.
It dies, especially in highly liquid contracts.
I did not get what you referred -‘it dies’…can you elaborate sir?
I’m sorry, what I meant was that it depends on the contract and its liquidity 🙂
If the liquidity is low, then it stays the same till a trade occurs. It can be for 4-5 seconds or even a few hours!
Sir you said the Varsity app would be out in mid January. Do you have a tentative date sir?
Another 10-15 days 🙂
Hi Karthik Sir,
Read the above article about Calendar Spreads, just wanted to know if more indepth personal training is provided by you, if yes please let me know where and how and charges . Regards
We conduct workshops once in a way, Gaurav. But apart from that, everything else is made available here only. Thanks.
Dear sir
It’s been a long time since the last strategy was published. I am eagerly waiting for momentum strategy. When can we expect that. The wait is getting unbearable 😆
Sometime soon, I hope 🙂
I can’t find PDF file of this Module 10 Trading systems
It is not available yet, Reddy.
sir can i ask when is the varsity app coming out? I am just so excited about it. Could you give us an approximate time frame? Thanks.
Hopefully next week 🙂
Karthik i know you don’t usually say what’s next when it comes to varsity. However, can you make an exception and tell us what’s the next topic in varsity and when we can expect it? Thanks for the excellent work.
Sumit, I’m writing a chapter on how to build a momentum portfolio. Hopefully by next week.
Hi Karthik Sir,
I would like to thank you for all the efforts you had put in to explain all the Market stuff in such a simple manner. I must say you have got the ability to teach quantum physics to a toddler. Your materials are truly amazing. Tumba channagidare 🙂
Thanks
Thanks, Dheeraj! Glad you liked the content here, happy reading 🙂
Hi, Can you analyse why this trade is showing a loss on sensibull
Buy Nifty Apr futures at 11683.05
Sell Nifty May futures at 11747.60
It shows a Rs 396 loss constantly over all prices?
I thought it would show a profit of Rs 64 per lot . Something i have not understood and am goofing in
The P&L depends on how each of the future contracts moves. You should calculate the P&L on a individual contract basis.
Dear zerodha,
all of your study material is available in hindi?
if yes kindly send the link on my mail id
if not then request you to kindly try to provide all modules in hindi language because your all demat account holder who willing to learn from your module are not fluent in english…
Not yet Vijay, but your feedback is noted and we will work on it. Thanks.
PDF of module 10 is not available
Working on it, Rakshit. Should be available soon.
Hi Karthik. I really like the knowledge shared on varsity.
Can we do calendar spreads on currency futures?(just making sure).
currency market seems to be safe for this strategy and fits well with my risk averse behaviour.
Yes, you can. Please make sure the 2nd-month contract has enough liquidity.
Hi Karthik
I recently discovered that we can trade spread contracts directly on ZT (by the way ZT is such an amazing platform with so many features i would certainly everyone to try it). And I observed that the contracts for currencies futures are liquid enough for small trades. Now my question is what are the costs of the trade, in zerodha brokerage calculator there is no mention of the STT costs for currencies but Nithin Kamath mentioned “Spread trading is not very popular in India, especially because of higher trading costs (the STT/CTT which is 0.1% makes it nonviable)”. so now i am bit confused. And lastly dose trading spread contracts directly with SD concept is good idea? or am I missing something. U have seen it all in the markets so I guess u can help me with your experience.
I guess Nithin must have said that long back. Liquidity has improved a bit now on the contracts but not on the spread contracts. You may want to double check that. Yes, SD is decent if you can manage to track it and execute it on time.
Thanks for your patient replies.
Can u comment a bit on STT, specifically is it .01% or .1% as mentioned by Nithin Kamath?. And i dont see STT costs in brokerage calculator for CFOs. So dose this mean i CFOs dont have STT?
Can you please share the link so that I get the context? Yes, no STT for currencies.
thanks Karthik got the answers i am looking for. No STT only stamduty . Did a trade just to see the charges :).
Here is the link https://zerodha.com/z-connect/tradezerodha/zerodha-trader-software-version/zt-spread-orders. U can see the conversation between MK and Nithin Kamath in the comments. I guess it was a typo, instead of .01% he typed .1% for STT/CTT.
Cant believe such quick responses for zerodha team. You guys are the best.
Good luck and happy trading, Indrasena 🙂
What are the futures trading strategy other than calendar spreads?
Plenty…Arbitrage, pair trading, speculative statergies etc…
Hi Karthik,
I tested the Calendar spreads strategy that you discussed in this chapter.
Found out a small oversight in the above Calendar Spread assumptions:
For example:
If we go short on a Spread on the expiry day if the Spread is above it’s Standard Deviation and we close out the trade the very next day when the Spread reverts to mean.
Seeing the calculations in the table provided above, we went short on a Current Month and Near Month Future Spread and then the Current Month Future expired on the expiry day.
Don’t you think that there is no opportunity to close out the trade for the trader the next day as the Current Month contract had already expired ?
Kulbir
Yes, for this reason, one has to be doubly careful while executing calender spreads near to expiry. It’s best if we can close all the position simultaneously. Keeping one position open defeats the purpose of a spread.
If possible,
please keep a sticky color-coded section at top/bottom of chapters with date of update
so that it becomes easier to follow any updated section
if it was some section added/updated (Other than typo fix)?
I think I saw this done in Market taxation module by Nitin but not sure if this is followed across all modules
Hmm, most of the fixes are typo. We have not changed the content much.
Hi Karthick,
Very informative knowledge share on varsity. Really appreciate the efforts.
Can we apply the same calendar spread to Nifty futures ? will it work the same way or any hidden risk in this ?
For example current month Jul Nifty future is at 11,843.50, and near month Aug future is trading at 11,901.85 and the CMP of nifty is 11788.85, around 54 points away from current month july future and around 113 points away from august month future
In additon to calender spread , I am thinking of adding covered call sell and put sell to take advantage of taking the premiums.
Can you please suggest if my approach is correct or if I am missing any hidden risk in this.
Here is my trade strategy.
Buy JULY month fut and sell 11800 JULY CE for premium of 200 rs , sell AUGUST month future, sell 11750 PE of JULY month for premium of 144 rs and close all trades just before JULY expiry — Here my approach is to take advantage of the premiums in either directions with no risk. And my rough assumption is I would be able to collect at least 100 to 150 points profit on the overall trade.
Please suggest if I am right in my way of approach.
Thanks,
Devi.
Devi, yes you certainly can apply the same to Nifty futures. However, I think the opportunities will be very few and hard to capitalize. This is ok, but I would suggest you load all the data onto an excel and visualize the payoff. The thing is it becomes quite challenging to figure out the overall effect of the directional move when you have multiple positions. When you visualize, you get a deeper perspective on the risks associated.
Thanks for your response Karthik. Will look in and analyse further.
Good luck!
Dear Karthik,
I have a few questions:
1) Is there need exact 200 data points need for calculating mean and stdev? Cannot have more than 200 data points?
2) After calculating the mean and stdev, if there is no opportunity to trade based on upper range or lower range on calcuating day. Is there need to calculate the mean and stdev daily to get the opportunity?
Reply will be eagerly waited.
1) You can take more than 200 data points
2) Yes as the price changes, so would the mean and SD. However, the change may not be drastic.
I have checked in the nifty and banknifty 200 days back data points. None of them negative difference are got. Then how to get the current month expensive and next month cheaper whenever I get lower range. As you mentioned in the chapter that whenever lower range is got then current month should be expensive and next month be cheaper. The case of Upper range is not problem. Please clarify me. Reply would be eagerly waited.
Rohit, I’m a bit lost with your query. Can you please elaborate this with an example if possible?
As you mentioned an example in spotting opportunities in section 15.4 that upper range is 1.7205 and lower range is 0.7335. Sell the spread beyond 1.7205 i.e. sell near month and buy current month and buy the spread below 0.7335 i.e. buy near month and sell current month. My question is if value of diff is between 0.7335 and above 0 even then near month value would be expensive and current month would be cheaper because difference is positive. Then how can be possible to buy the spread unless difference is negative. Please look into the deep matter and clarify me.
If the value of the difference is beyond 0.7335, it simply means that the spread has increased beyond -3SD. You can initiate a buy trade her, just like the way you would at 0.7335.
you have not got my point. Lower range means near month future woube be cheaper and current month be expensive as mentioned by you in thia chapter. For example diff is 0.5 which is below 0.7335 gets opportunity to trade buy spread i.e. buy near month and sell current month but pl look into this matter near month is still more expensive than current month future then how will we trade buy spread
Rohit, how are you ascertaining that the near month is more expensive? We just have to look at the spread and make this judgment right?
Dear karthikji
Ok. I ask only simple question. If value goes below lower range and even then current month is cheaper and next month is ezpensive, should we trade buy or sell spread according to above parameters.
2. Can we trade calendar spreads on currency futures?
1) In such a case, you should be a buyer of the spread, Rohit
2) Yes, you can trade currency futures.
Very thanks for your kind reply.
Wow!!! Calendar Spread works amazingly. I did virtual trade this spread in commodities, got a excellent result. Thanks!. There a lot more to learn in the market. Looking forward for all your future article. You are doing a amazing job. Keep doing and best wishes. 🙂
Which scripts u have tried ?
Nifty/Bank Nifty.
Sir, How can I download the closing price for the FUT contract in zerodha PI?
Dear Karthik, Please suggest few books for FnO arbitrage strategies.
Himanshu, suggest you look through this module – https://zerodha.com/varsity/module/trading-systems/
Karthik, have gone through the Zerodha content – theoretically it is worth a read, but was looking for a more practical approach to the strategies. Please do share if you have a book in mind, anyways my search is ongoing.
Himanshu, this is actually a very practical approach 🙂
Can you please elaborate a bit more on why think otherwise?
Karthik, Calendar spread is a trade-able idea, no doubt about it. We need to consider the Bid n Ask price, instead of LTP, which can be deceiving. Entering trades closer to the expiry is also not a good idea, as far as I have observed, since it doesnt give much space for the spread to move in favour of trade. Im reading “Trading Spreads and Seasonals – by Joe Ross”, not much quantitative but a bit more practical, what I felt. If you have to recommend any other indicator, other than the SD, to identify opportunity then what will you recommend?
I agree with you, these trades should be on bid-ask spreads. The key trigger can still originate from the SD though. But frankly, I’ve not experimented with anything else besides SD. Will update this thread if I hit upon something interesting. Thanks.
what are consequences of trading a calendar spread where the far month future is trading lower than near-month future . is it always profitable or there are cases where it can go wrong (i tried searching on the internet but didn’t find a viable answer.
and Thank you for these amazing books you have written like hats-off to you sir.
Its not always profitable, it really depends on the pricing and liquidity.
i would also like add the scenario where both near and far month futures are trading lower than the underlying’s price
Thats fine as we always see the relation between the two and not really the individual prices.
Sir,
If i am checking the trading signals on every tick during the day, will my lookback period to calculate mean and stdev be last 200 day closing prices or last 200 tick data points?
It will be the last 200 tick data points.
I have saved 20000 rs and want to do this trade but i know i don’t have capital for it but can i do it on currency futures as margin required is way low there.
Technically you can on CDS, but I’d suggest you rather invest this amount rather than trade with it.
Please explain strategies on Calender Spread for Option also where one can get benefit from theta decay.
Thanks
All options strategies are discussed here – https://zerodha.com/varsity/module/option-strategies/
Crudeoil April Future is trading at 1417 whereas Crudeoil May Future is trading at 2000. I brought 1 lot of April future and sold 1 lot of may future. Could you please tell the way forward ? Is this correct strategy?
Seems like, wait for convergence and close the position 🙂
Thanks for replying without delay. Sir i have held this position for about a week now but they are not converging infact they are diverging. Coming monday is expiry. Please enlighten me whether they will converge or not ?
Hi Karthik,
Superb article..Thank you for sharing knowledge.
Just one question..If any company declared dividend and say ex date announced for Near month then how this strategy works?
Because future of next month will consider dividend impact and spread will increase?
Yes, this depends on the quantum of dividend. If it is not much, you can carry on with the spread, else its best to avoid it.
Good Morning Sir,
I just want to ask how to download the data of previous 200 days?
I have chosen BankNifty as the liquidity is quite high for BankNifty, I use Zerodha Pi, and the data available is of only May, June and July. Can I download the data of the previous months through the software ?
Also, I have created a code for identifying opportunities, I have used 1 mins candle and took a look back period of 30 days. I found quite a decent number of trades however, is this practical? As the reference is just 1 mins candle, will I miss the opportunity to actually make a trade, as most of the trades get squared off within a min. To counter this I plan to use an automated bot, which will automatically make a trade when the conditions are met. And as the time frame is really low I have also altered the signal. For now I plan to use only the +Ve Standard deviation, hence the conditions which I have used are the difference of Ask Price of the the current month, and the bid price of the next month, as when the STD is more, the near month is trading at a higher price than it should.
I have been working hard on this, though on theory everything looks perfectly fine, can you tell me how practical this is? I have made the bot which helps me identify trades, however I am yet to make the transactions automatic. Please guide me for the same.
Incase you read the names before you answer, sorry for asking questions on every module. I am just really into this and have lots of questions.
Please feel free to ask as many queries as you wish, there is no problem with it 🙂
Opportunities here depends on how fast you can spot and execute the trade. Everyone knows this is a good strategy, hence many are many bots chasing this. As far as the data is concerned, download the same from NSE’s bhav copy.
Hi Karthik, calendar spread strategy looks to be very risk free lucrative one on theory (for that matter pair trading strategies as well) , but what i am skeptical about is – with the presence of the institutional investors with a lot of resources and algorithm based trading system, will retail investors stand any chance to get profit out of this approach. Even if we develop code based algorithms, will all that effort will be worth it, or it is better to channelize our efforts in other strategies like trend following, momentum strategies, etc. whats your view and personal experience on this. Thanks.
True that this strategy over the years has reduced to the speed of execution, something that institutional algos ace at.
Hello karthik
Where i can find historical price of future contracts and option also, can you tell me what’s the best backtesting software, let me know any alternative to tradingview as this site provide as seconds data and analysis and a lot more…
Thanks
ARUN
Checkout https://www.streak.tech/ for back testing.
hello sir,
nice strategy sir but can we do backtest with ltp based from nse website data with keeping few fixed points(depends on script) as slipagges and transaction cost deducting from overall profit???
Yes, you should do that if possible to understand the behaviour before placing the order.
Thanks sir
What about SL when we should exit from loosing trade would you plz elaborate it
When the trade wither converges or diverges away from your entry point (as measured by SD).
Hi Karthick,
Thanks for the post.
I was looking at the HDFC bank futures prices today (9 Jun 2020) at round 2:26 PM and i noticed the following
HDFCBANK spot price – 992.55
HDFCBANK JUN FUT – 990.85
HDFCBANK JUL FUT – 989.10
HDFCBANK AUG FUT – 988.00
The futures prices are lower than the spot price, which is something we don’t usually expect to happen.
1. How should we go ahead initiating the trade here? Should we follow the same procedure of calculating the mean and std?
2. What can be the reason for this anomaly? Are people fearing an upcoming recession?
Thanks in Advance
1) Yes, this is usual, except if there is a corporate event expected. If there is nothing, then you can look at the mean and STDEV
2) No, as I said, this can be either attributed to some corporate event or could be just another day in markets 🙂
Hi Karthik,
Thanks for the reply.
I am trying to build an algorithm to detect these mis-pricing opportunities in real time. I observed that some of these opportunities only last about 4-5 sec.
4-5 sec is really a small time as what i found it takes around the same time (2-5 sec) for my order to reach exchange and get executed. By that time the opportunity has already gone.
1. How should I go about executing such trades?
2. Is it even possible to catch such mis-pricing efficiently?
3. Will having more finer data help in better performance (like minute candle data or even bid/ask price quotes for every sec)?
4. What do you think is the right amount of historic days i should consider for mean and std calculations, given that i have minute
candle data for each day (or even data for every second).
Thanks in advance for answering so many questions 🙂
Saood, this strategy eventually boils down to the speed at which you can execute. In the algo world, 4-5 seconds is a lot of time, machines do this in microseconds. For this the NSE allows colocation of serves, this is quite prohibitive for a retail trader – https://www.nseindia.com/trade/platform-services-co-location-facility
Hey, I just finished implementing the calendar spreads in python. One peculiar thing that I observed was that a lot of stocks had a negative difference, i.e the futures price of near month was smaller than the current month. Is this an expected behaviour or this has to do with the strange times the market is going through?
Not really this is normal behaviour, if its -ve you have to do the reverse trade.
Hey Karthik, my code is giving me a lot of both buy spreads and sell spreads signals. I just wanted to ask what’s the normal number of signals that you get for a particular stock for the span of 200 days. For the past 200 days (for AxisBank), I am getting around 83 signals for a range of (mean – std, mean + std) and around 25 signals for a range of (mean – 2*std, mean + 2*std).
Given the fact that I am getting many signals, is there a way I can eliminate the risky ones, and if so then what would be the measure of the risk?
Nikhil, are you using LTPs for this? If yes, then I’d suggest you use the Bid – Ask rates and test your code.
HELLO KARTIK SIR ,
I AM USING YOUR PAIR STRATEGY AND MAKING DECENT RETURNS …BUT I HAVE DOUBT IN CALENDAR SPREAD,
EXAMPLE:
ESCORTS JUNE EXPIRY @960 SELL
ESCORTS JULY EXPIRY @950 BUY
CAN THIS BE DONE???
AND ON THE DAY OF EXPIRY JUNE CONTRACT WILL GET SQUARED OFF THEN WHAT WILL HAPPEN TO JULY CONTRACTSHOULD I SQUARE IT OFF ON SAME DAY OR NEXT TRADING DAY??
That’s the reason why one should trade the basis and look for divergence and convergence. Invariably, you don’t need to wait till expiry.
I wanted to backtest the strategy but I couldn’t find a way to get historic bid-ask rates data. Are we supposed to use LTP to test for historical dates and use bid-ask spread to spot the opportunities in real-time?
If you use bid-ask to test, then you should use bid-ask to spot as well. You can check with an authorized data vendor to figure if they can provide you with historical data bid-ask.
a bit confusion about term:
kindly sort out please
Bull Spreads
These calendar spreads are long the near term futures contract and short the longer term futures contract.
Bear Spreads
These calendar spreads are short the near term futures contract and long the longer term futures contract.
Yes, thats correct.
Hello Karthik sir,
Thanks for the knowledge sharing, all the Modules are wonderfully written.
I have a query, if we track bid and ask quotes and place orders on the basis of divergence, which type of orders to be placed and how to trade on exact price we want.
I have created a code which tracks the Ask and Bid quotes and place order on basis of divergence, many times orders get failed as Ask/Bid price is lower or higher than LTP, hence the order placing also depends on the LTP (which changes regularly).
So my query is How to place order on the exact price which we need, and same should not get failed.
I will be very helpful if my query get a solution.
Thanks
Have you tried placing market orders?
Hello Karthik Sir,
Market orders are getting executed, but same is not solving my concern as the orders are getting executed on best available price and Not on the exact price at which I want.
You need to stick to highly liquid stocks to ensure the market price and bid ask price are close enough. However, the problem will exist, but then at least you will manage to get into the trade.
Thanks Karthik Sir for your help on the concern.
Happy trading, Manish!
Dear Karthik sir,
One more help needed, pls help in sharing some study material / resources for Market orders, so that I can deep dive into it.
thanks
The market order is just that, you place an order and it gets executed instantly. It’s just that you don’t have any control over the price at which it will get executed. Of course, you can use 20 depth of level 3 data to get a sense of the price at which it will get executed. Check this – https://zerodha.com/varsity/chapter/supplementary-note-the-20-market-depth/
Hey Karthik,
Shouldn’t we allow room for mean spread to change as well? What I mean is, shouldn’t we take mean of last N entries only such that N < M, where M is the total entries. For ex, we will only consider the last 60 days only to calculate the mean and STD.
Which Approach would be better and why?
Thanks,
Nikhil
Ah, Nikhil I’m not sure. I’ve not explored this approach, hence I cannot comment on this.
Hey Karthik, I came across a lot of articles explaining how activities by large hedge fund and algorithmic trading firms drive the spreads to the point where it is extremely difficult for retail traders to profit from these opportunities. I have 2 questions to that respect.
1. How much truth is there in this fact? Can retail traders benefit from these opportunities or is it too futile to try?
2. What can be done to mitigate the impact? Is there a way a retail algorithmic trader can still benefit from such arbitrages strategy?
1) This is true to a certain extent. Hedge funds and similar players target short term arbitrage opportunities. End of the the day, abr strategies is all about speed of identification and execution, which further boils down to hardware and software infra, which again boils down to deep pockets and funds. These guys have endless access to capital and hence can afford to set up state of art infra to identify and execute trades at the the blink of an eye. Contrast this to a regular retail guy 🙂
That said, outside the high frequency and low latency world, the market is a level playing field for all participants.
2) If you can set up the infra, then you can do the same things. Or you need to be extremely sharp to identify new strategies which no one else is chasing. If you do, its all yours until someone else figures 🙂
sir, I want to ask you there are a lot of stocks how can we find the right opportunity so that it can be applied when any stock or index gives us the exact signal I mean how can we track such stocks
For that, you need to keep a close track of the opportunity universe. Ensure you have an opportunity universe which is easy for you to track.
I didn’t get you, sir. opportunity universe?
Opportunity universe is the number of stocks that you track on a daily basis to identify trading opportunities. For example, my opportunity universe could be Nifty 50 and nothing beyond that.
hello karthik
as u have mentioned to take historical data of future closing price from zerodha pi,can u plz guide from which section on zerodha pi can we download the future price.
Ah, I think you can right click on the timeseries and say write to excel. Can you please try doing this?
hello karthik
yeah i m able to copy the future closing price data thru zerodha pi but look back period is only upto 26 th jun 2020.not able to track before 26th jun 2020.it gives only 47 days data in time series.u have mentioned the look back period should be around 200 days.but i m not able to find out for more than 47 days.why is it so.
Did you try and increase the chart frequency and loading more data points?
yeah i m trying changing frequency but data is available only from 31st july 2020.
Hello Karthik
I have been through the strategies you have shared across this course and really like them. The thing I liked is that you not have tried to spoon feed but instead provided enough details to know the core strategy, but there is food for thought, for people who are genuinely interested to Analyze, Backtest and Trade the strategy.
May I request you to have a dedicated chapter only for Trading Strategies? Perhaps for categories like Intraday, Swing, Positional etc etc, and also for different Asset Classes, ie Equity, Futures, Options, Commodity, Currency…
Thanks, Nikhil. Will try and do this over time 🙂
Thank you… will look forward to it 🙂
Please go through the statement in the above article.
“It is advisable to subtract the price of near month contract from the current month contract. ” Did you mean other way ?
thanks
No, why do you think so?
Hello
You can recommend a method to download historical data from the US market?
Thanks
I’m not too sure about US markets, but I guess you can try Yahoo Finance.
Unfortunately it is not possible to retrieve a sequence of data but only a single data.
Thanks
Ah ok. I’m sorry, I’m not aware of any other resources for the US market.
Lets say we find an opportunity below or above the range, how do we know when to square off the trade? Is it when the value falls/rises back into the range?
Thats right, when you buy (below range), you expect it to increase and go back to mean, likewise with above the range.
Hello I have a question about the basis of the method. I took GOOG for example and checked the share price on each trading day in 2020. I subtracted the price of a certain date from the corresponding date in the following month, for example the price on 20/2/20 minus the price on 20/01/20 and so on. In total I received about 140 data. In calculating the differences there were both negative and positive results (you show only positive results in your example). The average I got was 25 and a standard deviation of 154. I asked with such a large standard deviation how to proceed with the concept test?
1) Firstly, I hope you are considering the difference between the future month and current month. This is because the future month is always considered more expensive than the current month. Despite this, the values can be -ve as well. This happens when the current month is more expensive than a future month, which is attributable to supply-demand situations or maybe dividends in the current month.
2) I cannot comment on the mean and avg. If these are the numbers, then I guess that’s what it is. The only point you need to ensure is that you are using clean data for your calculations.
Thanks for the reply, I understand the mistake in the calculation I made, you are referring to the option price of the current month and the next month both set on the relevant day in the current month, I took the stock price history in the last year and matched the dates of current month and next month. I understand that I can use your method which seems to me very interesting and original, the only way I have is every day throughout the coming year (2021) to collect the option price data of the current month each day and the option prices of that day in the month of next month ( Which are of course more expensive) and only after a year when I have about 150 values can I start doing the calculations you describe in your article, unless you have a more practical way of collecting historical data of historical option prices so I can calculate average and standard deviation. or maybe collect less data for mean and s.d. I would love to hear from you.
Amir, this best works with Futures, not sure if you can apply this on options. Of course, depends on how options are structured in the market you trade. Yes, you need to have relevant historical data. Assuming you trade on NSE, then you can approach any authorized data vendor and get the current month and mid-month historical data.
How to trade weekly Calender Spreads ( Nifty / Bank Nifty)
Which spread prices to be used ? Please explian with examples.
Thats the chapter about 🙂
Hello Karthik,
First of all, thanks a lot for your tremendous effort in building up this entire repository on stock market. It’s really detailed, interesting as well as very crisp. Be it a layman or an expert, this can definitely cater to both. Thanks again !!
Now to my question – I was trying to work this out on HDFC Bank and one thing that I observed is my mean turned out to be negative (-0.5048).
Due to this, when I calculate the upper range (SD + mean) it gives me a value 3.1706. On the other hand, the lower range comes out to 4.1802.
If you observe here, the upper range is less than the lower range.
Can I just swap the ranges and plan the trade or am I doing something wrong entirely due to which I get a negative mean. Note that I pulled the data from HDFC for 2020 (till Nov 2020).
Thanks !!
Thanks, Vinayak. This is one of the limitations of the method, i.e when you have -ve values.
Hello Kartik sir,
I am thinking of developing an excel model for the large cap stock futures which are having enough liquidity with the help of formulas and functions and link with real time data so if there is any opportunity arise it will be seen.
So I want to ask you can a retail trader convert this model into algos so that whenever any opportunity arise it will automatically executes.
Is it possible ?? Please share your thoughts.
Algo is not permitted by regulators, Sagar. But do check out Streak.tech
Hi Kartik sir,
As per query raised earlier of building excel model and link it with real time data whether streak will serve the purpose of execution in place of algos.
Hmm, guess you will have to get in touch with their support desk for this.
How do i get difference value of current month and near month.
By applying the futures pricing formula.
Hi Karthik sir
I see this strategy as a great opportunity but the next month futures contracts of stocks doesn’t have enough Volume and spreads are huge….how are you tackling this problem??
Cant rely always on bnf or nf futures because of less opportunities
Yeah, liquidity is an important issue. Hence the need to stick to the ones which are liquid, guess besides Nifty/BNF, the top 3-5 stock futures are liquid.
Nice work Karthik , thanks
Good luck, Jay!
Can you please tell me the returns you got after utilizing this strategy?
Returns were good back in the days(1.5% – 1.75% per month), with more algos coming in, this diminished. I don’t know the currents status.
Hi Karthik,
Say I think TCS in the above example will go long. So I do the following
Buy TCS Futures expiring 28th June 2018 @ 1846
Sell TCS Futures expiring 28th July 2018 @ 1851
Now say I am right and TCS for June shoots up 1890. I now square off the July Futures (the short contract). Now I only have the long contract (June). I plan to hold this long contract till it reaches some predetermined profit target.
My question is because I was given lower margins for this strategy, I could buy more of these contracts.
What happens when I square off the July contracts and remain only with the June (long) contracts? Do I have to pay extra margin?
Thats right, Jay. You will have to pay full margins for the naked futures position. YOu will no longer have margin benefit.
Thanks for the reply.
Good luck!
When I buy TCS June and sell TCS July, do I have to pay brokerage and taxes twice ( once for the long position, other for the short)?
Yes sir.
How to download the continuous futures data from Zerodha Pi? or from where else I can get this data?
I think you can right-click and download the data on excel.
can we do the same in options ? if so can you pls illustrate an example i f already given pls guide where can i find it,thanks
Sorry, can you please share the context?
Sir,
In case the calendar Spread moves otherwise what will be the stoploss to keep in mind .
You can keep 0.5% as SL.
Sir, how to get the data of current month wrt next month of past 200 days? I am confused please help!
At any given point you have the data for the next 2 months right?
Where to get Current Month and Near month Contract Data
I’m confused how to download futures data from nse website
Please Guide me Sir
Sir how to download current month and near month historical data in zerodha kite
Is there a way
Hmm, you will need kite connect for this along with some programing skills.
One I need to learn programming or I need to give up both Calendar Spread and Relative pair trading strategy
But I like both strategy
But zero knowledge on programming
Sorry to ask,is there a module on programming 😂
I need Varsity for programming myself 🙂
Sir I will make an attempt to learn programming
Free Resources are available
Stay Safe Sir
Good luck and stay safe 🙂
in zerodha baskets, it’s say required margin for NIFTY Apr futures contract(buy) and NIFTY may futures(sell) contracts is 18+ lackhs and it’s say final margin is 273k . can I execute trade with this 273k margin or I should have 18+ lackhs to execute the trade(NRML orders)
YOu need to have the full margin, which will be lower once both the orders are placed.
Hi Karthick Sir,
Kudos to your efforts 😊 really doing a great job.
But I personally checked the above calculation you mentioned, I can’t agree more.
As you can see, for example 31.08.2017 is a current month expiry day. After closing, you have taken the closing price . Then how can you initiate the trade here. And how can close the trade next day. I think it’s only possible on paper.
Sorry if am wrong, kindly clarify
Thats right, this is on a historical basis, just to illustrate how to spot and set up a trade.
Sir I read that new clients can’t get access to zerodha pi terminal is that true,I thought I can install this in my machine for getting current month and next month contract data
We are no longer supporting Pi.
Sir then where can I get this data?
NSE website is confusing over futures data
NSE is the best bet, Chandu.
I will go through it once again Sir,if any doubt head back to you🙏
Sure, please do.
You have calculated the mean and standard deviation for the given period but when you are taking a trade on any given day (let’s say 31-8-2017), the mean and standard deviation that you calculated also has data points from days after 31-8-2017. So how can one assume that the difference has deviated from the mean because you have not taken data up until the trade-day but gone beyond?
The general practice is to take the values and stick to these when you initiate the trade. Backtest it with this logic before initiating trades.
sir
At the expiry time can we rollover only current month contract or both current and mid month contract?
You can rollover the current month since the current month is the one expiring. The mid-month will have validity.
sir
sell spread value is 2.5
sbi may fut 250
sbi jun fut 252.5
my expiry date is 30.6.2021.
In the next day 1.7.2021 i will execute buy spread trade
but my contract is expired before 1.7.2021
then how i will execute the trade?
can i square off my both may and june future contracts and
buy june and sell july future contract
Yes, you can. Provided July offers an attractive spread.
Sir I applied Future pricing formula and calculated fairvalue for July and August month contracts both,using reference rate as spot
but both are trading at discount
I read Calender spread chapter in future trading there it says only one contract should be trading at fairvalue and other at premium on back of this we take decision,but here both are trading at discount?
Sir finally found data for doing calender spread its available in zerodha kite ,continous future chart ,but only problem his we cant download or copy that data to excel ..I manually copied closing prices and backtested it results were good
Sir its time consuming can we copy to excel directly through kite.
I think this is possible via the Kite connect API, Chandu.
In NSE website historical data is available like
Current
Next Month
Far month
Current
Next month
Far month
In this format,
How can I rearrange first full current,next,and far
Which funcion should one use?
Sort function in excel?
Hello sir,
How are you ?
1) Is zerodha pi active or not available anymore.
2) For future calender spreads, do we do the first method where we calculate the fair value of each future and buy the cheaper and sell the expensive one Or do we do the second method?
3) For the second method do we have to hold till expiry or exit in 1-2 days?
Doing good, hope the same with you.
1) We have stopped supporting Pi. Please switch over to Kite, its is a far more advanced platform
2) I’d suggest the 2nd
3) 1-2 days if fine as long as you hit the target.
Good luck!
Thank you Karthik for your valuable teachings.
Is that historical difference data should form normal distribution in order to consider spread that is out of the standard deviation is an opportunity?
I’ve got this doubt as I was applying above methodology on TCS futures for last 100 days. Graph drawn with differences is not looking like a normal distribution. But the differences for above SBIN example exactly fits the normal distribution.
I doubt the spread is normally distributed, maybe not. I’ve not tested it before.
Hello Karthik, Thanks for lovely article on calendar spreads.
Where do I find the continues futures data now that Pi is not supported by Zerodha, please?
Thanks, Dnyanesh. YOu can get this on Kite Connect, else I’d suggest you speak to an authorized data vendor for this.
how to download data as pi is not available
I’d suggest you speak to an authorized data vendor for this or if you are comfortable, maybe use Kite connect API.
Hello, please tell if any software is available regarding this, which automatically indicates where any opportunity is available
Don’t think so 🙂
when to place the trade? end of the day basis or what?
You don’t have to wait for EOD to place arbitrage trades, you can place it as and when you identify it.
In calander spread when we should exit from the bought option.e.g.
Suppose we sell one lot pe/ ce weekly option and buy one lot monthly option ( same strike price).
Now say after a week sold weekly option is closed in profit but monthly option ( showing loss) is live. So what should be done. Do we have to sell a fresh weekly option of the same strike price or different strike price?
How long we can keep on doing this. Secondly when should we exit from the monthly option. Pl guide.
The decision to exit is based on the convergence of the trade. Don’t look at it from an individual options leg perspective.
Hello karthik sir, can you please guide me from where i can download this data? i m just entering the markets now and i find your modules to be very helpful, thank you so much.
Yash, I’d suggest you get in touch with any authorised data vendor, and you’ll get the continuous data required for this.
I just want to know how to download this data ? Currently does zerdoha has this PI ? Or we need to use nse site for data
Hello Karthik,
Let us assume we have an opportunity,
NALCO
Near Month: 98.0
Far Month: 97.3
But there’s a problem,
We execute the transaction on market, maybe we do not get the price that we expected. So, there are high chances of trade going into losses.
We put limit orders, one of the above gets fulfilled and other stays pending, bigger risk. OR Neither of them gets filled and the price just moves away.
How can we overcome this?
Lakshay, this is the reason why traders use Immediate or Cancel (IOC) orders for such trades.
Hmm, but even then there will be two orders of IOC, what if one executes and other cancels? Any other solution?
Agreed. Execution risk exists in this strategy, IOC is means to minimize it.
Karthik sir,
First of all thanks for this module, which is very informative; however I have two doubts. Can you please address those?
1) Which Arbitrage strategies are available to retail investors; other than
spot-future, calendar spread, pair trading, merger arbitrage & liquidation arbitrage
2) How much a risk averse investor should invest, or precisely how many Nifty futures lots( costing around 1 lac currently ) should he buy/sell if having 10 lacs to invest in futures?
Regards,
Sachhidanand Rankhambe
1) Other that I can think of are based on Volatility, but these are not easy to set up without computing skills
2) Me being super conservative, I’d say just 1 🙂
Does this also work on nifty and Banknifty Futs, or only limited to stock futures?
Amit, you can apply this on n all option contracts.
Hi Karthik
How can I download these current and near month futures data from NSE website?
I quite doubt the futures data is available for downloading.
Hy sir
very happy good evening to you
sir i want to ask that if we want to trade with calendar spread strategy, then its is important to get the data of 200 trading days closing price and calculate theirs mean and std deviation. If yes then where we can get this whole data.
Yash, please check with any authorized data vendor and you will get the OHLC and volume data.
sir
please confirm if spread is beyond upper range i.e 1.7205 what i will buy CE or PE
You are dealing with futures right?
no sir can we apply in option
You probably can, but it’s better with futures.
Hi Karthik,
What is the logic in using continuous futures data as opposed to just regular futures data?
Hi Karthik,
Pls let me know where we can get continuous Futures data for current and Next Month Expiry for Calender Spreads other than zerodha pi.
I check on internet but only 90 days data is present. I am not getting how continuous chart is for two different expiries can be different for data greather tha 90 days.
I’d suggest you speak to an NSE-authorised data vendor for this, Abhilash.
Article doesn’t talk about the effect of implied volatility in a calendar spread position which is the most important factor that affects the profitability of this trade.
The technique discussed here employs futures. But I’d like to learn more about this. Can you share some insights?
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’.
Please clarify current month, near month and previous month.
Value of near month is greater than current month so to subtract the price of near month contract from the current month contract will give a negative figure.
We are in Jan 2023. So Jan futures is the current month, Feb futures is mid-month, and March futures is the far month.
Sir how can I download continuous futures data in Zerodha Kite?
Check this, Anant – https://support.zerodha.com/category/trading-and-markets/kite-web-and-mobile/charts/articles/continuous-data-kite
Should take trade in LTTS?
LTTS? Can you share more context?
LTTS
future price-3450
and spot price – 3609
How to execute?
If you feel futures is under valued wrt to spot, then you should consider going long.
Sir, when we are backtesting the data we have taken the mean and sd for lets say a said perios of 1 jan 2015 to 31 jan 2015 , and backtested that in june the sd varied from the yearly sd and we took the trade, but sir in real we will not have the data from june to dec at that time, so the mean and sd will be different i guess. IF this is so sir, what should be the ideal time period of the previous data for creating the mean and the sd. like june 2014 to june 2015 , like that.
Karan, not sure if I understand this fully. Are you saying you want to backtest for 1 month, but the time of back testing in in June?
No no sir , i mean like we have given here a backtesting report for said period, lets asssume its Jan to Dec and we taken the mean and Sd on that data , and now we have found the opportunity in june , but in actualy data , july to dec data will not be present in june time , so the SD and the mean values will be different .
Ah got it. So its always better to keep your backtesting data up until the latest period. So in this case, my data period can either be Jan to June or June to June.
What if i have only 25 days data to do the math. is it sufficient data for calendar spread? can i initiate a different trade considering only 25 day data?
Not really, you need more data points 🙂
Hi Karthik,
Need some clarification and guidance.
Did the following calendar spread in Tata Motors, it is a virtual trade.
Entry date:26-July-2023
1. Sold 27-July expiry TATAMOTORS 660 CE at 8.10 rupees
2. Bought 31-Aug-2023 expiry TATAMOTORS 660 CE at 20.90 rupees
Exit date: 27-Jul-2023
1. Squared-off July exp 660 CE at 0.5 rupees
2. Squared-off Aug exp 660 CE at 17.65 rupees
Booked around 6,000.00 rupees profit.
The question?
If I were to replicate the same trade in real, what are the nuances of physical settlements and margin requirements etc for this trade? Want to know the risks associated with entering into calendar spreads of individual stocks just a day or two prior to near month expiry date. Please help.
Zerodha has stopped zerodha pi. So now how can i download current month and near month future data continuously??
You can use Kite for this. Please call the support desk, they will help you with this.
Sir really nice article.
Can we use it for nifty options too??
Yes, you can. But you do need to back test this before using.
Sir,
In calendar spread, You have mentioned to download the continuous futures data for the last 200 days. Again, you have shown the data for current and near month separately. My query below-
(i) If I download the continuous futures data for the last 200 days, then there should be only one column showing the futures historic data and not two columns since all past months are same (No current or near month)…..Am I correct or missing somewhere?
(ii) Have you meant to download the historic 200 datapoints for each of the current and near month. If that is the case, please suggest way to download. I am perplexed on how this can be done.
I think it will be easier to explain this over call. I’d suggest you call the support desk for this and take their assitance 🙂
Sir,
Regarding fetching continuous data, please reply if I am correct on the below understanding:
(i) To fetch continuous data of current month (Say, Nov,23): Open the future chart of Nov,23 in ChartIQ—>Under settings, we need to select the “Continuous”option.
(ii) To fetch continuous data of near month (Say Dec,23): Open the future chart of Dec,23 in ChartIQ—>Under settings, we need to select the “Continuous”option.
Thats right, but do check once with the support team if that works.
Sir,
(i) We sell / buy as the spread goes above mean plus 1SD/ falls below mean minus 1SD. Is there any stop-loss for the spread strategy?
(ii) Can we track this strategy on end of day basis or it rather requires more frequent watch. I have a full time job and can only watch at end of day. Pls suggest.
(iii) How many opportunities can we get in a month tentatively to trade for each of stock futures ( considering we backrest results whether to buy/ sell)?
1) Stoploss is basically on the spread itself, you need to see how the spread is behaving and set a SL as a whole.
2) Yes, maybe you can, since they are hedged. But none the less, these are futures instrument, I’d suggest you keep an eye 🙂
3) If you are lucky, maybe 1 or 2.
How can i track all future every day??? I don’t know programming.. Is there any other way to find trade every day without knowing programming???
You can track the prices over via trading terminal right? Not sure if thats what you are looking for.
Hi Karthik Rangappa,
Greetings from the heart of Bengaluru! I am Sarthak Sahu, representing the Innovation and Entrepreneurship Development Center (IEDC) at Dayananda Sagar College of Engineering, Bengaluru.
We are thrilled to announce our annual celebration of innovation and entrepreneurial spirit, Esummit 2023. We strongly believe that your participation as a keynote speaker, panelist, or sponsor facilitator would be immensely beneficial and enriching for the Esummit. We witnessed a footfall of 11K+ students around Bengaluru last year and this to me seems like a very good opportunity to teach young people the basics of Money etc.
We have some ideas on which we can collaborate and make learning fun and easier for college students.
Best Regards,
Sarthak Sahu
Curations at IEDC
(Proof of Work) https://www.instagram.com/p/Ckadx4dpcAo/
Sarthak, you will have to send this message to the Varsity team (Sales), please create a ticket for this 🙂
Great article. I am in the process of programming this type of calendar spread. I have already made money by programming pair trading and classic calendar spread.
What is the recommended stoploss for this divergence-convergence calendar spread?
You can keep a % of capital as a stop loss or maybe something like 0.5 SD.
Hey Karthik,
Any idea like from where we can download such continuous data(around 5 years or so). I would prefer to download it in python, though downloading just the complete csv is also good enough. Are you aware of any such source. In yfinance api mcx commodities are not there
thanks
You can check here and also post your query here Bill – https://kite.trade/
Hi Karthik,
The spread is working fine for me. My only challenge is the charges. For example for asianpaints calender spread, to entry and exit cost is 380 rps with margin of around 40k. Which makes it 1% of the total margin. So I need to make more than that to cover my charges.
I have come up with ways as below
1. Trade with spreads having 1SD atleast 5 times the charges ( adjusted for lot size)
2. Trade only daily data and hold maximum time
Any other way to cover up the charges?
No, the only way to reduce charges is by reducing overtrading 🙂
Thanks a lot Sir for this wonderful and highly valuable module for us for free of cost….
Reading this module I fall in love with stats based strategies. need to explore more Sir, Need more interesting strategies like this Sir for all aspects of Stock market.
Kindly let us all know, how do you know all of this Sir :->
I mean the books or videos or any other available sources.. I want to explore more strategies Sir… I loved this risk free or less risky quant strategies..
Love You Sir :->
Thanks Suman. I’ll keep sharing any interesting resources here if I find one.
in the table the current month data from 22-08-17 to 31-08-2017 is for sbi august future and near month data is September future. and 01-09-20017 to 19-09-2017 the current month future is September and near month future is October?
Yup, thats right.
Hi Karthik,
So while calculating difference, If stock has moved significantly high for example From 440 to 880 it’s double, now whatever difference occuring at 440 also increases at 880 ( costs of futures also increased) then average of difference and standard deviations will be skewed. how do we handle this?
Futures too would reflect this change, right?
Yes, I mean let’s assume
If stock is 440 futures OF current month is at 445 and near month at 448. Here spread is 3
Suddenly within few weeks/months it moved up to 880, now current month futures is at 888 and near month at 896
Here spread is 8
But actually it’s normal spread or diverged spread, How to determine that?
As average of spread is changed, Standard deviation will be changed. I think this sudden move causes a skew in average and SD
One way to measure is to look at the spread as a percent rather than an absolute number. That way you will know if the spread has diverged or converged.
Hey Karthik, how can I get the continuous future data for the Banknifty contract(current and near month)as mentioned in the example….kindly help
If you are comfortable using APIs, then you can check here – https://kite.trade/
Got It Thank you, Karthik
Amazing and very helpful content.
Happy learning, Amit!
Hi Karthik, hope you’re doing well.
If the front month contract is cheaper than the current month then what does that imply? Right now for IGL the July contract is cheaper than the June contract, so does this present a reverse calender oppurtunity?
Also does this imply something about the stock price as well or is it just a result of expiry dynamics?
I tried putting a basket trade with -1 IGL JUN FUT and +1 IGL JUL FUT in the strategy builder on sensibull but the payoff graph suggested that this would lock in a loss of -5.5K per lot and buying the more expensive contract and selling the cheaper contract would lock in a gain? I don’t understand how this is possible.
Hope I haven’t bombarded you with too many questions! Good day 🙂
Under normal circumstance, the current month contract will always be cheaper than the mid/far month. Mid/Far month means more time to expiry, and therefore the cost of carry is higher, which means the mid/far month will be more expensive compared to near month contract.
Hello Karthik,
Thanks for sharing the details, do we need to do the back test as above to find the opportunities available in the market?
do you think simply selling the current month NIFTY contract and buying the next month NIFTY would yield decent profit? I’am happy with 1% a month so wondering will that work pls?
Harsha
Back testing always helps, Harsh. Please do that if possible before you take the trade. Good luck.
Hello Karthik, Thank you for the reply.
Different question, I was searching for the approach to deploy the BOX spread strategy, however identifying a opportunity seems to be a challenge. If you don’t mind will you pls share your thoughts on the same and advise? thank you
I think these opportunities usually arise when there is a big shift in premium and discounts with respect to futures and spot prices. Do watch out for this shift and you may spot something interesting. Good luck!
Hai Karthik,
is there any other way to find calendar spread opportunities other than (mean and standard deviation). if any please advice.
Hmm, I’m not sure. But here is the thing, whichever way you look at it, its always linked to future pricing 🙂
Hi,
You mention that profit and loss is small in trading spreads. However, since the capital required to enter a spread trade is very less, the return on capital (or loss) is quite high.
Isn’t it?
Kindly clarify.
Yes, from RoI perspective, it is not that bad 🙂
Hi,
For next month and far month spread, we will download continuous data for current and next month or compare the next month and far month only?
For example, in Natural Gas, August and Sept. 2024 spread is Rs. 11 but Sept. and Oct. 2024 spread is Rs. 30.
Now if I want to sell the Sept. and Oct. 2024 spread, do I compare the average spread of August (which is current month) and September or compare the average spread of Sept. and Oct. only?
Since september month will become current month once August contract expires.
Please clarify.
Thank you.
Sept and Oct only. No point taking Aug futures into consideration, unless you do Aug-Oct.
is there a way to automate this process (I don’t know how to write code) or any website or tool which provides this data
Hi Karthik,
Q1- Is there a way to fully or partially automate this process? I found that it can’t be done with Strike
Q2- How do you do it, do you manually track this in Excel and execute changes as they occur, or do you use another method?
I’m sure there are ways. Pretty much everything in this day and age can be automated :). Yeah, I’d do it manually back then. But if I were to do it again, I’d try anf figure ways to automate.
Thanks for sharing this strategy. I like low risk strategies. The Calendar Spread Strategy seems to be a low risk & low returns strategy. It took me about 2-3 hours to get the data for ICICIBank for last 200 trading day and construct the current and near month prices for those 200 trading days. I downloaded the futures prices from NSE website and based on the expiry, I had to paste the prices in the current month or near month. I wanted to know if there are any other ways in Zerodha Kite to get the data quickly.
If you are comfortable using APIs, then maybe you can check this – https://kite.trade/
Appreciate for the quick reply. I do have subscription for the kite APIs. I did some digging and was able to find the API to get the historical data for futures. Some development is required to get the data in the right format but it’s definitely possible. Thanks for point me in the right direction.
Sure, wishing you the best Saravana. Good luck!
Hi Karthik – I have a question regarding this approach. I’ve been using LTP to monitor spreads between two futures contracts, but I’m running into few issues. Since LTP reflects completed trades, I’m noticing that the spread I calculate doesn’t always match the current order book spread. This delay seems to be causing missed opportunities when the actual bid-ask spread widens briefly but doesn’t yet reflect in the LTP. Also, while placing market order based on the LTP, the executed trade does not always turn out in the price range needed leading to slippage.
Hmm, so one thing you can do is check for bids and asks and match it with your buys and sells. If they match, trigger and place order.
Understood. I’ve been also thinking about it. In addition to difference in LTP, I will also check for bid & ask prices and then try to place the order accordingly. Are limit orders worth trying in this scenario? I’m a little hesitant since there is a possibility that one of the legs might not get executed.
Yes, limit orders are good for these things :)….but there is nothing much you can do about execution risk.
In the example above, you use continuous data for both futures contracts. However, most opportunities tend to arise near the month’s end. Since this is continuous data, trades might close within a few days. In real-time trading, however, how should one handle these contracts when they are about to expire? For example, if we consider the current scenario, futures of November and December for a stock, say ABC, and an opportunity arises a day before expiry or on the expiry day or even a week before expiry, should we take the trade or not? If the spread does not return to its range by expiry, it could result in a loss.
Yes, if the spread does not converge, then it will return a loss, but that is the trade here. You expect the spreads to move. You can use continuous data to get a sense of historical spread movement, and then use that as a peg to estimate the current spread and figure if the current spread is worthy of taking a trade or not.
I was looking at GOLD dec futures and feb2025 futures, the upper range for the spread is around 530 but as of now the spread between the two is around 750. But as we are just a week away from the expiry of dec contract. Is it worth to take the risk as prices mostly diverge near expiry.
I dont know if its worth the risk. But since this more than usual, I’d be tempted to place a trade (but this is just me being curious and adventurous). You can choose to track the trade closely as well.