## 17.1 – Background

In the earlier chapter we had this discussion about the range within which Nifty is likely to trade given that we know its annualized volatility. We arrived at an upper and lower end range for Nifty and even concluded that Nifty is likely to trade within the calculated range.

Fair enough, but how sure are we about this? Is there a possibility that Nifty would trade outside this range? If yes, what is the probability that it will trade outside the range and what is the probability that Nifty will trade within the range? If there is an outside range, then what are its values?

Finding answers to these questions are very important for several reasons. If not for anything it will lay down a very basic foundation to a quantitative approach to markets, which is very different from the regular fundamental and technical analysis thought process.

So let us dig a bit deeper and get our answers.

## 17.2 – Random Walk

The discussion we are about to have is extremely important and highly relevant to the topic at hand, and of course very interesting as well.

Have a look at the image below –

What you see is called a ‘Galton Board’. A Galton Board has pins stuck to a board. Collecting bins are placed right below these pins.

The idea is to drop a small ball from above the pins. Moment you drop the ball, it encounters the first pin after which the ball can either turn left or turn right before it encounters another pin. The same procedure repeats until the ball trickles down and falls into one of the bins below.

Do note, once you drop the ball from top, you cannot do anything to artificially control the path that the ball takes before it finally rests in one of the bins. The path that the ball takes is completely natural and is not predefined or controlled. For this particular reason, the path that the ball takes is called the ‘**Random Walk**’.

Now, can you imagine what would happen if you were to drop several such balls one after the other? Obviously each ball will take a random walk before it falls into one of the bins. However what do you think about the distribution of these balls in the bins?.

- Will they all fall in the same bin? or
- Will they all get distributed equally across the bins? or
- Will they randomly fall across the various bins?

I’m sure people not familiar with this experiment would be tempted to think that the balls would fall randomly across various bins and does not really follow any particular pattern. But this does not happen, there seems to be an order here.

Have a look at the image below –

It appears that when you drop several balls on the Galton Board, with each ball taking a random walk, they all get distributed in a particular way –

- Most of the balls tend to fall in the central bin
- As you move further away from the central bin (either to the left or right), there are fewer balls
- The bins at extreme ends have very few balls

A distribution of this sort is called the “**Normal Distribution**”. You may have heard of the bell curve from your school days, bell curve is nothing but the normal distribution. Now here is the best part, irrespective of how many times you repeat this experiment, the balls always get distributed to form a normal distribution.

This is a very popular experiment called the Galton Board experiment; I would strongly recommend you to watch this beautiful video to understand this discussion better –

So why do you think we are discussing the Galton Board experiment and the Normal Distribution?

Well many things in real life follow this natural order. For example –

- Gather a bunch of adults and measure their weights – segregate the weights across bins (call them the weight bins) like 40kgs to 50kgs, 50kgs to 60kgs, 60kgs to 70kgs etc. Count the number of people across each bin and you end up getting a normal distribution
- Conduct the same experiment with people’s height and you will end up getting a normal distribution
- You will get a Normal Distribution with people’s shoe size
- Weight of fruits, vegetables
- Commute time on a given route
- Lifetime of batteries

This list can go on and on, however I would like to draw your attention to one more interesting variable that follows the normal distribution – the daily returns of a stock!

The daily returns of a stock or an index cannot be predicted – meaning if you were to ask me what will be return on TCS tomorrow I will not be able to tell you, this is more like the random walk that the ball takes. However if I collect the daily returns of the stock for a certain period and see the distribution of these returns – I get to see a normal distribution aka the bell curve!

To drive this point across I have plotted the distribution of the daily returns of the following stocks/indices –

- Nifty (index)
- Bank Nifty ( index)
- TCS (large cap)
- Cipla (large cap)
- Kitex Garments (small cap)
- Astral Poly (small cap)

As you can see the daily returns of the stocks and indices clearly follow a normal distribution.

Fair enough, but I guess by now you would be curious to know why is this important and how is it connected to Volatility? Bear with me for a little longer and you will know why I’m talking about this.

## 17.3 – Normal Distribution

I think the following discussion could be a bit overwhelming for a person exploring the concept of normal distribution for the first time. So here is what I will do – I will explain the concept of normal distribution, relate this concept to the Galton board experiment, and then extrapolate it to the stock markets. I hope this will help you grasp the gist better.

So besides the Normal Distribution there are other distributions across which data can be distributed. Different data sets are distributed in different statistical ways. Some of the other data distribution patterns are – binomial distribution, uniform distribution, poisson distribution, chi square distribution etc. However the normal distribution pattern is probably the most well understood and researched distribution amongst the other distributions.

The normal distribution has a set of characteristics that helps us develop insights into the data set. The normal distribution curve can be fully described by two numbers – the distribution’s mean (average) and standard deviation.

The mean is the central value where maximum values are concentrated. This is the average value of the distribution. For instance, in the Galton board experiment the mean is that bin which has the maximum numbers of balls in it.

So if I were to number the bins (starting from the left) as 1, 2, 3…all the way upto 9 (right most), then the 5^{th} bin (marked by a red arrow) is the ‘average’ bin. Keeping the average bin as a reference, the data is spread out on either sides of this average reference value. The way the data is spread out (dispersion as it is called) is quantified by the standard deviation (recollect this also happens to be the volatility in the stock market context).

Here is something you need to know – when someone says ‘Standard Deviation (SD)’ by default they are referring to the 1^{st} SD. Likewise there is 2^{nd} standard deviation (2SD), 3^{rd} standard deviation (SD) etc. So when I say SD, I’m referring to just the standard deviation value, 2SD would refer to 2 times the SD value, 3 SD would refer to 3 times the SD value so on and so forth.

For example assume in case of the Galton Board experiment the SD is 1 and average is 5. Then,

- 1 SD would encompass bins between 4
^{th}bin (5 – 1 ) and 6^{th}bin (5 + 1). This is 1 bin to the left and 1 bin to the right of the average bin - 2 SD would encompass bins between 3
^{rd}bin (5 – 2*1) and 7^{th}bin (5 + 2*1) - 3 SD would encompass bins between 2
^{nd}bin (5 – 3*1) and 8^{th}bin (5 + 3*1)

Now keeping the above in perspective, here is the general theory around the normal distribution which you should know –

- Within the 1
^{st}standard deviation one can observe 68% of the data - Within the 2
^{nd}standard deviation one can observe 95% of the data - Within the 3
^{rd}standard deviation one can observe 99.7% of the data

The following image should help you visualize the above –

Applying this to the Galton board experiment –

- Within the 1
^{st}standard deviation i.e between 4^{th}and 6^{th}bin we can observe that 68% of balls are collected - Within the 2
^{nd}standard deviation i.e between 3^{rd}and 7^{th}bin we can observe that 95% of balls are collected - Within the 3
^{rd}standard deviation i.e between 2^{nd}and 8^{th}bin we can observe that 99.7% of balls are collected

Keeping the above in perspective, let us assume you are about to drop a ball on the Galton board and before doing so we both engage in a conversation –

**You** – I’m about to drop a ball, can you guess which bin the ball will fall into?

**Me** – No, I cannot as each ball takes a random walk. However, I can predict the range of bins in which it may fall

**You** – Can you predict the range?

**Me** – Most probably the ball will fall between the 4^{th} and the 6^{th} bin

**You** – Well, how sure are you about this?

**Me** – I’m 68% confident that it would fall anywhere between the 4^{th} and the 6^{th} bin

**You** – Well, 68% is a bit low on accuracy, can you estimate the range with a greater accuracy?

**Me** – Sure, I can. The ball is likely to fall between the 3^{rd} and 7^{th} bin, and I’m 95% sure about this. If you want an even higher accuracy then I’d say that the ball is likely to fall between the 2^{nd} and 8^{th} bin and I’m 99.5% sure about this

**You** – Nice, does that mean there is no chance for the ball to fall in either the 1^{st} or 10^{th} bin?

**Me **– Well, there is certainly a chance for the ball to fall in one of the bins outside the 3^{rd} SD bins but the chance is very low

**You** – How low?

**Me **– The chance is as low as spotting a ‘**Black Swan**’ in a river. Probability wise, the chance is less than 0.5%

**You** – Tell me more about the Black Swan

**Me** – Black Swan ‘events’ as they are called, are events (like the ball falling in 1st or 10^{th} bin) that have a low probability of occurrence. But one should be aware that black swan events have a non-zero probability and it can certainly occur – when and how is hard to predict. In the picture below you can see the occurrence of a black swan event –

In the above picture there are so many balls that are dropped, but only a handful of them collect at the extreme ends.

**17.4 – Normal Distribution and stock returns**

Hopefully the above discussion should have given you a quick introduction to the normal distribution. The reason why we are talking about normal distribution is that the daily returns of the stock/indices also form a bell curve or a normal distribution. This implies that if we know the mean and standard deviation of the stock return, then we can develop a greater insight into the behavior of the stock’s returns or its dispersion. For sake of this discussion, let us take up the case of Nifty and do some analysis.

To begin with, here is the distribution of Nifty’s daily returns is –

As we can see the daily returns are clearly distributed normally. I’ve calculated the average and standard deviation for this distribution (in case you are wondering how to calculate the same, please do refer to the previous chapter). Remember to calculate these values we need to calculate the log daily returns.

- Daily Average / Mean = 0.04%
- Daily Standard Deviation / Volatility = 1.046%
- Current market price of Nifty = 8337

Do note, an average of 0.04% indicates that the daily returns of nifty are centered at 0.04%. Now keeping this information in perspective let us calculate the following things –

- The range within which Nifty is likely to trade in the next 1 year
- The range within which Nifty is likely to trade over the next 30 days.

For both the above calculations, we will use 1 and 2 standard deviation meaning with 68% and 95% confidence.

**Solution 1 – (Nifty’s range for next 1 year)**

Average = 0.04%

SD = 1.046%

Let us convert this to annualized numbers –

Average = 0.04*252 = 9.66%

SD = 1.046% * Sqrt (252) = 16.61%

So with 68% confidence I can say that the value of Nifty is likely to be in the range of –

= Average + 1 SD (Upper Range) and Average – 1 SD (Lower Range)

= 9.66% + 16.61% = **26.66%**

= 9.66% – 16.61% = **-6.95%**

Note these % are log percentages (as we have calculated this on log daily returns), so we need to convert these back to regular %, we can do that directly and get the range value (w.r.t to Nifty’s CMP of 8337) –

Upper Range

= 8337 *exponential (26.66%)

= **10841**

And for lower range –

= 8337 * exponential (-6.95%)

= **7777**

The above calculation suggests that Nifty is likely to trade somewhere between 7777 and 10841. How confident I am about this? – Well as you know I’m 68% confident about this.

Let us increase the confidence level to 95% or the 2^{nd} standard deviation and check what values we get –

Average + 2 SD (Upper Range) and Average – 2 SD (Lower Range)

= 9.66% + 2* 16.61% = **42.87%**

= 9.66% – 2* 16.61% = **-23.56%**

Hence the range works out to –

Upper Range

= 8337 *exponential (42.87%)

= **12800**

And for lower range –

= 8337 * exponential (-23.56%)

= **6587**

The above calculation suggests that with 95% confidence Nifty is likely to trade anywhere in the range of 6587 and 12800 over the next one year. Also as you can notice when we want higher accuracy, the range becomes much larger.

I would suggest you do the same exercise for 99.7% confidence or with 3SD and figure out what kind of range numbers you get.

Now, assume you do the range calculation of Nifty at 3SD level and get the lower range value of Nifty as 5000 (I’m just quoting this as a place holder number here), does this mean Nifty cannot go below 5000? Well it certainly can but the chance of going below 5000 is low, and if it really does go below 5000 then it can be termed as a black swan event. You can extend the same argument to the upper end range as well.

**Solution 2 – (Nifty’s range for next 30 days)**

We know the daily mean and SD –

Average = 0.04%

SD = 1.046%

Since we are interested in calculating the range for next 30 days, we need to convert the same for the desired time period –

Average = 0.04% * 30 = 1.15%

SD = 1.046% * sqrt (30) = 5.73%

So with 68% confidence I can say that, the value of Nifty over the next 30 days is likely to be in the range of –

= Average + 1 SD (Upper Range) and Average – 1 SD (Lower Range)

= 1.15% + 5.73% = **6.88%**

= 1.15% – 5.73% = **– 4.58%**

Note these % are log percentages, so we need to convert them back to regular %, we can do that directly and get the range value (w.r.t to Nifty’s CMP of 8337) –

= 8337 *exponential (6.88%)

= **8930**

And for lower range –

= 8337 * exponential (-4.58%)

= **7963**

The above calculation suggests that with 68% confidence level I can estimate Nifty to trade somewhere between 8930 and 7963 over the next 30 days.

Let us increase the confidence level to 95% or the 2^{nd} standard deviation and check what values we get –

Average + 2 SD (Upper Range) and Average – 2 SD (Lower Range)

= 1.15% + 2* 5.73% = 12.61%

= 1.15% – 2* 5.73% = -10.31%

Hence the range works out to –

= 8337 *exponential (12.61%)

= **9457 **(Upper Range)

And for lower range –

= 8337 * exponential (-10.31%)

= **7520**

I hope the above calculations are clear to you. You can also **download** the MS excel that I’ve used to make these calculations.

Of course you may have a very valid point at this stage – normal distribution is fine, but how do I get to use the information to trade? I guess as such this chapter is quite long enough to accommodate more concepts. Hence we will move the application part to the next chapter. In the next chapter we will explore the applications of standard deviation (volatility) and its relevance to trading. We will discuss two important topics in the next chapter (1) How to select strikes that can be sold/written using normal distribution and (2) How to set up stoploss using volatility.

Of course, do remember eventually the idea is to discuss Vega and its effect on options premium.

### Key takeaways from this chapter

- The daily returns of the stock is a random walk, highly difficult to predict
- The returns of the stock is normally distributed or rather close to normal distribution
- In a normal distribution the data is centered around the mean and the dispersion is measured by the standard deviation
- Within 1 SD we can observe 68% of the data
- Within 2 SD we can observe 95% of the data
- Within 3 SD we can observe 99.5% of the data
- Events occurring outside the 3
^{rd}standard deviation are referred to as Black Swan events - Using the SD values we can calculate the upper and lower value of stocks/indices

Sir,

What a surprise journey. Pleasant surprise because maths use to be my favourite subject and i did not expect that I will get chance to use my skill in share market also. Now after this I (we) are more curious for the next chapter. I am eagerly waiting for it as you have said that this approach is different from the technical and fundamental approach.

Congratulation for again simple explanation and

Thanks for enlightening us.

R P HANS

Thank you! I hope you will like the upcoming chapter as well 🙂

So much clarity in your writeup. Pls share your twitter id 🙂

@karthikrangappa 🙂

Hello sir

i really liked the way you explained the topics, i have a small doubt i, e in nifty example in excel sheet while calculating 1SD yearly you used =k9*SQRT(252) As formula but i don’t understand why it’s 252 and not 365 days

please help me understand the same.

Thank you

252 represents the number of trading session in a year, hence 🙂

Very well explained. And very nice transition from mathematics to stock market application. You have a natural teaching ability and that can only come from a deep level of understanding.

Just one observation though – I understand that the trading year can be considered to have 252 days, In that case would it not be appropriate to consider that the trading month has 22 days instead of 30, in Solution 2 ( Nifty in 30 days)? Unless of course, one is trying to forecast the price 30 trading sessions later (instead of 30 days later?

Thanks for the kind words, Kartik 🙂

Yes, it does make sense to take 252 days a year / 22 per month.

wonderful explanation ….was worth the wait :-).

small correction, I couldn’t find the red arrow in the digram above the statement “marked by a red arrow)”. same for picture on Black Swan, also you have taken example of 1 to 10 slots but there are 13….may be pic needs to be changed….. ofcourse not a big thing…..

Yeah, i’ve noticed the mismatch but cant too late to get the illustrations changed 🙂

Sir, In the Nifty eg you have taken data from 10th March’11 onwards for the calculation. Obviously using more data for calculation wil provide the best result. But for precise caluclation how much data to be collected? Whether last 1year/2 year or anything? Kindly suggest..

In fact you can try this for any time frame…1 year , 2 year etc…you will end up with a normal distribution!

Sir, one more question: You have shown predicting the price movement for the year and month. But it will also be needed to calculate the range of price for a day. i.e. present day or tomorrow to plan a trade. Will you explain that also?

Will be talking about this in the next chapter 🙂

The way you simplifying the things which are complex to most of us, is fabulous. Many such things i never paid any heed till now. Thank you very much and keep going. we all are ready to grasp the knowledge you are sharing with us.

Thanks Shreya 🙂

We will discuss two important topics in the next chapter (1) How to select strikes that can be sold/written using normal distribution and (2) How to set up stoploss using volatility. This is what you say at the end of the chapter. What about selecting strikes for an option buyer using normal distribution? wont you be covering that? after all most of us would be buying options than selling them. appreciate your content and form of presentation. thanks.

Will cover that as well, please stay tuned 🙂

Sir,

You r a doing a wonderful job teaching us the ABC of stock market trading.The brokerage rates of zerodha r also very low.

But many other brokerages have started giving low brokerages & also provide very good intraday F&O tips and also long term investment ideas based on technical & fundamental research

So,its my request that zerodha too start giving very good intraday F&O tips & long term ideas.It would make zerodha even more successful than it is now……

Pankit – Giving tips is like feeding a hungry man with 1 meal. But we have a slightly different philosophy – we believe in empowering people so that they don’t go hungry again!

Hence we have all these educational initiatives like –

http://tradingqna.com/

http://zerodha.com/z-connect/

Wonderful. I agree.

Cheers!

Hello Mr Karthik,

I have one query…in the calculation of bin width, why did you divide difference of min and max by 50?

When I divide it over 50, the intention is to create 50 bins, I can in fact divide it by 100 or even 200. No restriction on that.

Adding to the above query..if i am adding data for the month of Aug in the Excel and trying to modify the data range in the frequency columns its not allowing…what i am doing wrong please help me with that.

Not sure Sharad, can you share a snapshot please?

Hi Karthik,

I’m also facing the same problem while trying to change the FREQ formula in H14. The current formula is =FREQUENCY(E9:E1096,G14:G64). Now my data range has changed in col E, so I need to change that. When I’m trying the same, it is giving the error message – “You can not change the part of an array”. Can you please look into this?

Thanks in advance.

Are you sure you are selecting the right date range? Also do pay attention to the Çtrl+shift+enter thing when using the frequency function.

Hello,

Fantastic Article, what a way to explain the things, simply superb!

All the initiatives taken by Zerodha (varsity, Taxation) are exceptionally good.

Best of luck to entire zerodha Team.

regards

Thank you so much Ajit!

Hi, in the above e.g of nifty how have you calculated the daily average/mean as 0.04%. ? the earlier chapter talks of calculating the daily return using the log return. do you add the daily returns and divide by the number of observations?

do you add the daily returns and divide by the number of observations?

Raj – Yes, that’s how average is calculated. However you can use excel function ‘=Average()’ to calculate the same in 1 shot.

How to convert log returns into simple returns.How to do that in PC.

Exponential of log should minus one should give you the simple return. Use can use excel for this.

which means karthik, as per the wipro excel sheet you provided us as a download (chapter 16) , in which you have calculated its daily return. the formula application would be =average(c3,c245). that gives us 1.77% as daily average/mean. this figure has to be used along with the standard deviation to solve the e.g you have provided at the end of this chapter. would that be a correct assessment ? thanks.

Yup, you can. In fact in the coming chapter will give you more clarity on this aspect.

Waiting for the next chapter.

By next week for sure 🙂

Sir,

As usual eagerly waiting for next chapters :0 …kindly update

By next week for sure 🙂

Next week.! Oh it’s too late sir, pls update this week only..

Will try our best 🙂

Am a Statistics graduate, I wish I have seen this post when I was in my college, amazing explanation. please include variance, regression, correlation as well in your coming chapters.

Thanks for the encouragement Karan. Will talk about these topics as and when its appropriate. Please stay tuned.

The OI/Volume qty in Nifty 8350, 8450,8550…calls/put are less compare to 8300,8400,8500…calls/Puts qty. For eg If i short 8350 call/Put whether the full qty at limit price will get execute or any issue due to less liquidity? If yes whether can i able to buy back the qty once it reaches the target price as per the limit order?

Vasant, the OI information is on a daily basis. I’m certain the OI for the strikes you have mentioned is large enough to even accommodate institutional orders 🙂

Again kudos to you sir…. Your effort to explain complex concept in simple and effective ways are simply superb:) particularly the question and answer part…great job sir…

Thanks Raghu!

While reading the change in volatility concept in a book i have noticed in an options example that premium is trading 0.78 [email protected]% volatility. If the volatility increases from 14% to 18% the premium also increased from 0.78rupees to 3.05 rupees? I don’t know how they caluclated? Can you explain how the premiun is increasing if the volatility increase from 14 to 18%?

This is because of the effect of Vega. I will talk about it in detail very soon (maybe in chapter 20).

Hey, may I know the name of the book?

karthik,

when will we get the next chapters…..

This week Sarath.

Hi karthik, while converting daily volatility into annualized volatility of HINDPETRO there is a difference in the numbers published on NSE website and the one i calculated . also, the difference is significant if i take SQRT 252 ( difference 13 %) vis- a -vis SQRT 365 (difference 5%). does that mean the NSE is using 365 days to calculate the same?

Madhu – Yes NSE uses 365 days in their calculation.

Tumba tumba thnks Karthik for such simplified content 🙂

So what should we use, 365 or 252 for our calculation? And also for monthly calculation 30 or 20?

Namaskara 🙂

252 and 22 should do.

adds for every click !!??

As in? Sorry dint get that.

no need for you to sorry there was just a malware causing problems

Sure 🙂

sir, how to tackle with gap up / gap down opening of nifty while trading nifty intraday options..?

Dint get that Abhijit – you are talking about gap up/down opening at the open right? So it should not really bother intraday traders.

ok…actually I was thinking about short strangle or short straddle strategy and what would happen if I take position at 3:15 pm and carried over night to take advantage of gap up / gap down opening of index on next day…am I right?

Short straddle or strangle etc are all delta neutral strategies…so gaps don’t matter.

Dear Karthik,

Thanks very much for ur Varsity initiative. I have learned about Options from ur writings, which I was not able to understand from other people writings. I earnestly request u to provide separate day trading n position trading in options, where we can use Gann levels, Fibonacci, Open Interest in put and call to understand what boundaries (strike prices) will be maintained and when the strike levels will be crossed etc.

Prasad – the next module is all about Option Strategies!

hi karthik, the difference between the upper range and lower range using SD for 30 days for HINDPETRO is quite substantial. it obviously would increase further with 2SD and 3SD. within such wide range wont it be a tedious task to select the right strike price? i am assuming there is a way to break through the clutter and finding the appropriate strike price. cheers.

Madhu – I think the up coming chapter (Volatility Application) will clear your doubt. Request you to please stay tuned.

In solution 1) 0.04%*252 is 10.8% where as it is printed as 9.66%, am i missing something here?

Ah! Blame that Excel. Its rounded it off to 0.04%….its in fact 0.0383248%*252 = 9.6578548% !

Really awesome article Sir..

eagerly waiting for the option strategies chapters 🙂

Options strategies will start from next month…

Hai Karthik,

Excellent work on making trading concepts simpler…

In module 5, the daily returns of different stocks and indices which are given, can u please tell me what’s there on Y axis, as there are values

of daily returns on X axis…

Y-axis represents the number of days/value. For example (referring to the Nifty chart in section 17.4) – there are 90 days during which Nifty returned an average return of 0.26%.

Karthik sir!! many would have told you, but I would also like to tell u that you are great !! you are making tougher subjects easier and more easier. Thankyou so much!! :-),…

This is reassuring! Thank you so much:)

What’s wrong with calculations? Why it is showing Daily volatility 14% in excel sheet when it is 2.57% on NSE website? Please help me.

Is it because of Stock Split?If yes, What to do in such case? (I was talking about SBIN)

Ah, this could be because of stock split…besides I’m assuming you are doing the calculations right. You can probably check here for historical data – https://in.finance.yahoo.com/q/hp?s=SBIN.BO ….guess they may have adjusted the data for splits/bonus etc.

I would like to know how you calculated the Daily Mean. I noticed in the previous chapter you have mentioned the calculation from Standard Deviation but haven’t mentioned on how to calculate the mean. Even if I take the average like you did for stddev the figure that you show is no where near to what I get. Also in the previous chapter you mentioned the daily volatility is 1.47% and in this chapter you take the daily volatility as 1.046% , is that a mistake ?

Sorry , I understood my mistake. Please ignore my comment.

Sure 🙂

Dear Karthik,

Amazing chapter the narration was exceptionally lucid.

However, there is some doubt whether stock returns follow “normal distribution “. I believe stock returns are more accurately represented by Student’s -t distribution

Sunil – yeah, in a sense stock returns appear more ‘peaked’ hence Student’s – t may fit the bill….my guess is this is especially true for stocks that have been trending well – like Kitex. However the idea here is to introduce the concept of simple distribution in the first place!

Daily Average / Mean = 0.04%

Daily Standard Deviation / Volatility = 1.046%

Current market price of Nifty = 8337

you have multiplied .04*252=9.66%. Please let me know as how you arrived at 9.66%.Can’t it be 10.08%

Need to look into this, will get back shortly. Thanks.

Refer above and even you may lok at nifty range for next 30 days

Av.=0.04%*30=1.15. it should be 1.20% instead.

Thanks…will check this.

Sir, In the above example Nifty, How much period you have taken to calculate mean (o.o4%). i.e from which date to which date.

Regards

2011 to 2015…4 years I suppose. Please do check the excel.

How to convert log returns into simple returns.

How to do that in PC.

Karthik

While calculating nifty’s one year average & SD, you have taken 252 days(Solution 1), but while calculating for 1 month you took 30 days(Solution 2)… any specific reason?

This is the day count convention that NSE follows, hence sticking to the same.

Dear Karthik,

I have done a Nifty analysis according to the 1SD, 2 SD and 3 SD . But i need to check it with you whether all the calculations done by me are right. When i tried i found that its not attaching excel files. So can you give your email id so that i can send my attached working file to you.

Thanking You,

With Regards,

Sonjoe Joseph

Mob.No.94972-82865

Ah…can you please try and put up the numbers here itself?

Dear Karthik,

Please find the attached file were i have made my excel file in the png format. But i don’t think now you will be able to see my formulas since its a picture file. Issues i’m facing not able to apply the frequency formula and OED ie Option Expiry Date LL values are seen as NUM. Please also check all other values so that i can know whether i have applied the formula correctly. One suggestion in the Choose file also add other file formats then only we will be able to attach excel and word files.

Thanking You,

With Regards,

Sonjoe Joseph

Mob.No.94972-82865.

This link explains how to use the Frequency Fn – https://support.office.com/en-us/article/FREQUENCY-function-44e3be2b-eca0-42cd-a3f7-fd9ea898fdb9

Rest of the excel seems to be ok. Can you please apply the frequency fn and check once? Thanks.

Dear Karthik,

Attaching the file after applying the frequency but i think its wrong. Can you give yr email id so that you can check the formulas and can make any corrections if i have done anything wrong. This technique i will be applying in my trading so its better to correct any errors.

Regards,

Sonjoe Joseph.

Mob.No.94972-82865

Done.

Hi SONJOE JOSEPH,

I am also facing the same issue.

Please see the below link how to calculate the frequency. Go to you tube website and search as “frequency function in excel 2010” and please find the below screenshot also.

https://www.youtube.com/watch?v=IelRI5GD2Ik

Thanks for sharing the link Saravana !

Thanks saravana for the link.

Dear Sir,

Why and where this frequency function is to be applied/used ? Purpose ?

Usually to check for the distribution pattern of the data you are looking at.

Hi karthik , i calculated mean for nifty based on last one year data (08-12-2014 to 07-12-2015), i got mean as -0.03, should we consider negative value or absolute value while calculating upper and lower ranges???

Take the actual value and not really the absolute value.

Dear Kartik,

How can i find out the % winning probabilities of Nifty Call Option and Put Options by taking the reference Nifty future price. I know this can be done in excel by entering the Nifty future price, Nifty Call option Strike price, Nifty Put option Strike price, Call option implied volatility, Put option implied volatility , Days to expiration. In excel there is a function called normdist or normsdist through which it can be done. I tried doing it but not coming correct. Can you help me out if you know the excel function.

Not sure Sanjoe. The normdist function in excel is used in the context of normal distribution. What you are asking for may not be implementable using this (at least as far as i know).

Dear Kartik,

How can i find out the % winning probabilities of Nifty Call Option and Put Options by taking the reference Nifty future price. I know this can be done in excel by entering the Nifty future price, Nifty Call option Strike, Nifty Put option Strike , Call option implied volatility, Put option implied volatility , Days to expiration. In excel there is a function called normdist or normsdist through which it can be done. I tried doing it but not coming correct. Can you help me out if you know the excel function.

Replied earlier.

dear karthi,

i am confusing with sd and volatility both are same? please guide

Volatility is Risk as measured by Standard Deviation.

so if volatility of a stock is .80 then we can conclude that sd will .80 right? (

Yup, but do keep the time frame in perspective.

Sir, Fantastic reading material ……… I am reading it again and again to digest it fully …….. Some queries on the calculations of volatility. Will be grateful to you if you can attend the same …….

1. In your excel sheet, are the values displayed in columns G & H used only for plotting the graph of daily returns?

2. While arriving at the value of yearly average why have you multiplied the daily average by 252 & sq root of 252 when the actual no. of trading days from 29/07/2014 to 28/07/2015 are 244?

3. You have taken the sample data for 1089 days i.e. for 3 years approx. In Sharekhan’s TradeTiger the data is available right from 06/09/2010 So, should we restrict the import of data to 3-4 years only? What should be the optimum size of the sample data?

Please revert.

Thanks & Regards.

CA. Prakash Tanak

1) G & H columns are basically creating bins and plotting a frequency of their occurrence. Of course, this is based on daily returns and used for plotting the graphs.

2) 252 is by practice, yes taking 244 would be more precise.

3) For short term trading, 2 year look back is good. With this calculate 2 year, 1 year, and 6 months volatility to get a fair reference.

Thanks for your prompt reply.

Welcome!

if tatasteel daily volatility id 2.63 and i want to calculate 1sd then I should multiply 2.63 by square root of 30 or square root of working days in a month i.e22?

I feel that it should be sq root of 30 & not 22 because you are more concerned with the no. of days for which funds are locked if invested for 1 month. Am I right, Sir, Karthik Rangappa ?

30 is good I guess.

If you want the 30 day Vol, you will have to multiply with Square root of 30.

How did you get Daily Average / Mean = 0.04%

Sir, I got it from your excel sheet. No need to reply on this query

Thanks 🙂

Add up all the returns and divide it over the number of days you will get the average.

Sir, If I have to estimate the range for next 1 week, how many days data should I use to make these calcualations?

Awaiting your reply on my query of ” If I have to estimate the range for next 1 week, how many days data should I use to make these calcualations?”

5 days.

HI Karthik,

I was trying to calculate the strike of nifty which is worth writing in this expiry, i have followed your steps explained in next chapter. my query

a) Can average daily return be negative. i have observed this while calculating avg mean for teh period 25.03.2015 to 23.03.2016. Due to this negative value i am getting a wrong nifty range for next 8 days(days left for march expiry).

b) I am still confused about number of days to be considered for calculating annualized daily SD and Annualized daily avg , should it be 365 or 248 in my case.

thank you . please correct if i am wrong

1) Yes, averages can be negative.

2) Stick to 365.

Due to negative average i am getting wrong range in which nifty will be trading for next one year.

and is Annual avg mean+ annual SD same as Annual SD+ Annual AVG mean, i am clear, because these both make a lot of difference while average is negative.

Please throe some light on calculations when average is negative.

thanks in advance

Will try and do this sometime soon.Thanks.

*i am not clear

A similar Algorithm has been developed by us, which has given average returns of 70% per year, where all trades would be automatically placed into your own account. you can check http://www.returnwealth.com

Nice, btw have you checked this – https://developers.kite.trade/login , we basically give out APIs to trigger orders. You may find this helpful.

sir, how can we get Daily Average / Mean =???????

Calculate the daily return and find out the average of it : )

how can we calculate 252 daily returns? for one company, as it takes long time to do so

Use Excle, it just takes 30 secs to do this calculation 🙂

WHY BIN WIDTH IS 50 IN DENOMINATOR IN EXCEL SHEET

This is completely arbitrary. It depends on the number of bins you need…for example – if the data set is large, say 500 odd, I’d choose 50 bins.

Honestly, i owe you a drink. This is the way to explain boring concepts. Keep it up. Cheers

I prefer whiskey on the rocks please!

Cheers!

Dear sir,

It may sound stupid but I am not able to resist myself asking this. Why are we calculating daily returns, instead we can find out the SD, mean directly on the daily closing prices itself. This would give us the range of closing prices for 1SD/2SD/3SD directly. I tried doing so but somewhere i am missing something. Not able to find out the mistake. Please clarify.

You can calculate SD and other things on the prices – this gives you how your capital will fluctuate but what really matters is how your returns fluctuate, after all your P&L is a function of the variation in returns. Hence the preference for calculating these on returns and not really prices.

Dear Sir,

I am lil bit confused,Can you tell me

what does dialy volatility in NSE website denotes?

Does it denotes Daily Average or standard Deviation?

is there any relation ship between Average and Standard Deviation?

Daily Volatility represents the daily standard deviation. Daily standard deviation gives you a sense of how much the stock/index can vary on any given day, which in other words is the volatility of the stock/instrument. Higher the daily standard deviation, higher is the volatility of the stock/index.

Thanks Karthik for simplifying things for us!! I have few doubts related to volatility chapters. Could you pls share few mins to resolve.

1- In chapter-15, we simply calculated the yearly range of Nifty, with spot price and annual volatility. But, included daily avg/mean in the following chapter-17 for the same. Pls elaborate.

2- Why do we use log return instead of simple return? And why did we again converted log percentage into regular% to get the range value.

Thanks in advance

Aditya

If you need a yearly range, you need to take the yearly number. If I have used daily numbers, I may have done a mistake. I need to re check this.

For log returns, please check this – http://tradingqna.com/3574/why-stock-returns-are-calculated-in-log-scale?show=3574#q3574

Thank you sir. My question: If I sell 420 CE at 1.00 for a lot size of 1500 (at this time the spot price is 360). So I get the premium of 1500. On the expiry day the Spot price is below 420. So I do NOT square off and allow the trade to expire on its own so that I keep the premium received. Now how will the tax and other charges be calculated in this case. can you please explain with this example. Thanks.

No tax implication here as you are a seller of the option. However, if you had bought options and let them expire in the money then you will have to pay a hefty STT, check this post – http://zerodha.com/z-connect/queries/stock-and-fo-queries/stt-options-nse-bse-mcx-sx

kindly show the calculation ,if i know max,min and average volatility then how to calculate standard deviation.if i know only three thing max,min,average volatility value.

The SD calculation on excel is explained in the chapter. Request you to kindly go through the same.

Dear Karthik

Wonderful explanation and a common man also can understand the way you have explained it. One question is still unanswered which is on look back period. There must some rule for look back period for a given future time horizon. Say I wish to get 99.7% confidence for next one week range prediction, what should be look back period for SD, Similarly what should be look back period for SD for next one month range prediction. If I choose any number of look back period, the SD and average return will vary and output range will also vary, may not be to a great extent but still theoretically we should plug the question to be more precise.

The higher the Standard Deviation, the higher is the accuracy. However, with higher accuracy the range also increases. For example 3SD is more accurate than 2SD, which is more accurate than 1SD. Accuracy in this context is simply because of the virtue of it including all possible data points.

Thanks for your reply…… my question was on look back period, should we always take last one year data or we should change the range? Apart from this, you have suggested to add last one years average gain to find out future range = spot price ×(average return+volatility %)for upper limit. Will it not be wrong when market goes in apposite direction. May be the past return was calculated in uptrend and now there is downtrend.

The look back period depends on the extent to which you intent to predict the raneg. If you are trying to forecast the range for the next one year then clearly look back period of 1 year is required.

Also, we consider both the upper end and lower end of the range…so this kind of takes care of down side.

Dear Karthik, thank you for the wonderful article.

I have a question on calculating yearly and 30 days SD from the NiftyExample.Xls. while calculating yearly SD we use Sqrt.252 which is the # of trading days and Sqrt.30 while calculating monthly SD which the total number of days.

From NSE website the way they have calculated ‘Annual volatility’ is daily volatility*sqrt 365 [ for example for nifty ]

Can you please help me in understanding what is the best way to derive Annual volatily and X-period volatility from daily volatility

Thanks and Regards

Sekhar

I’d suggest you stick to the time count convention used by NSE i.e 365 as you would be more aligned to market prices.

Karthik, Thank you for your prompt reply. Similarly, Can I go with actual number of days[ ex: 7 for a week, 30 for a month] in calculating SD for any period?

Regards

Sekhar

You can adopt any time count convention as long it is aligns with market rates.

Karthik, Yeah, got it, thanks a lot Karthik

Regards

Sekhar

Welcome!

Dear Karthik,

Thank you for the wonderful article.

I wonder is there any web site who can provide the high/low volatile stocks compared to their 30-day,180-Day, 1 year averages?

What is the best time period to compare to understand if the stock is high/low volatile compared to historocal volatility – i.e 30-day,180-day,1 yr?

I am assuming by knowing high/low volatile stocks compared to their historical volatility one can understand the options on that underlying stock are having high/Low IV index – is this assumption correct?

Could you please help me in understanding the above

Regards

Sekhar

Unfortunately, I’m not aware of any site which would give this information (accurately). One can certainly develop a deeper insight into trading options by looking into Volatility.

Karthik, Thank you for the reply.

I have a question on NSE web site’s Daily and Annualized Volatilizes and options IV an don Vega values

1.Does it make any sense to compare annualized volatility with options IV [ from options chain ] ?

or Do we need to theoretically compute option prize every time to understand if the option premium is over priced or under priced?

2.Is there a way to quickly understand if the option premium is over/under priced and the IV is high/low?

3. can we derive some useful information on IV from options Vega values [ assuming if we have Vega live data ], meaning if Vega is above value X the IV is high and vice versa

Appreciate your help,

Regards

Sekhar

Regards

Sekhar

1) No, but lots of traders use this from a ‘quick and dirty’ perspective to get a sense of how cheap or expensive the option really is

2) Yes, most easiest method is by comparing IVs with historical volatility, also I’d suggest you read the note on ‘Volatility Cone’.

3) Yes, again I’d suggest you read the note on Volatility cone.

Thanks.

Karthik, Thank you for your prompt reply.

Sure, I will revisit the Volatility Cone section

Regards

Sekhar

Cheers.

Hi Karthik,

I am trying to link between previous chapter and the beginning of this chapter. Not sure whether I am missing any thing here.

In the previous chapter(16) I learned about the Daily Returns, Daily Volatility and Annual volatility.

However in the beginning of this chapter(17) you have mentioned that,

“In the earlier chapter we had this discussion about the range within which Nifty is likely to trade given that we know its annualized volatility. We arrived at an upper and lower end range for Nifty and even concluded that Nifty is likely to trade within the calculated range.”

I am confused that where did we discuss about the upper and lower range of Nifty. I see only for Wipro.

Also the below points from this chapter.

”

Daily Average / Mean = 0.04% —- How do calculate this?

Daily Standard Deviation / Volatility = 1.046% —— Is this daily volatility?

Current market price of Nifty = 8337″

I am sorry to bother you. I have been reading this Options module for last one week. I stuck here as I could not find the link between end of the chapter 16 and the beginning of the chapter 17.

I guess the range calculation is mentioned in chapter 15, towards the end. We discuss the range for both TCS and Nifty.

Daily average is simple – select the daily returns and use the function ‘=Average()’ in excel. The same is explained in the excel.

Yes, that is daily volatility.

Good luck.

Hi Karthik, I could answer my above questions by visiting the last two chapters and the excel sheet which you shared. sorry for posting the basic questions above. Thanks for your detailed explanation.

Glad you did 🙂

Solution 1 – (Nifty’s range for next 1 year)

Average = 0.04%

SD = 1.046%

Let us convert this to annualized numbers –

Average = 0.04*252 = 9.66%

SD = 1.046% * Sqrt (252) = 16.61%

I have a confusion with the multiplication of figure 252 (i believe we should use 365 here instead of 252 ) in the above equation and siting example from the 30 day Mean and Std. dev numbers from 4-5 lines below., i also believe that in the above quoted equation ( the one i am citing in this example ) The average should (Annualized ) should be written as = 0.04%*365 & not Average = 0.04*252 = 9.66%

Please clarify my both doubts

Yes, you can use 365 days, no problem with it. In fact, I think NSE uses the same.

Hi

Would you please let me know, in distribution of Nifty’s daily returns graph (image with blue vertical lines), x-axis is % of Returns, what is the y-axis.

Thanks

Y-axis represents the number of times a certain return has been generated in the past. For example in Nifty, approximately 80 times a return of 0.2% has been generated.

Hi

Thanks for clarifying, now it makes sense.

Regards

Cheers!

Sir i have one doubt ! Why do we use log normal while calculating returns.. rather than simply multiplying with the no. Of days

Using log normalizes the numbers and brings it to the same plane.

Thank u sir!

Welcome!

In the previous chapter, you had used 365 as the base. However, you have used 252 as the base here. Why so ?

Ideally it should be 252.

Hi zerodha

when calculating L&T daily avg i am getting negative value, (i.e daily avg = -0.14%, so annual = -36.13%), But Std Dev annual = 28.07 is positive. because of which i cant able to get upper and lower range. eg ( upper range = avg+sd= -36.13+28.07=-7.06% and lower range = -36.13-28.07=-65.01) so upper range of LT 1467 and lower range 826. But current price is 1583..

So it is a 3 sigma event 🙂

hi karthik,

If you can explain how to calculate upper and lower value when daily average is Negative, with support of example it will really helpful.

Will try and do that sometime soon, Nakash.

Have been going through your articles and to say they are lucid and informative is an understatement.

On September 18 in one of replies to queries on the volatality chapter , you had mentioned you would be writing a chapter on calculation of range when mean is negative.

Have you done that and could you okease provide the reference if that chapter.

Vimal, thanks for the kind words. Unfortunately, I’ve not been able to do that. I’ll try and do that as and when possible. Thanks.

Sir, you pls calculate exponential of the log to get the simple return. it is very confusing

Thats the math part 🙂

Sir how did you get these numbers 68%,95%,99.70% is these are natural

Check out section 17.2 – the Galton board experiment.

Really Appreciate all your efforts to write such a nice article/book. The articulation, language and the ease in explanation is really amazing. You are an Star Karthik!! Keep it up.

Thanks for the kind words, happy learning 🙂

how to calculate Daily Average / Mean = 0.04% of nifty.

Use the standard excel function ‘=AVERAGE()’ on the daily return time series.

Dear Sir, Thank you for such wonderfull writing, I have become a real fan of your articles. I was doing the calculations here for Federal bank and I dont get a normal distrubution, can you please help to check this and let me know if this is not in normal distrubution. I took the data for Federal bank for last year i.e 1.1.16 till 31.12.16. I really appreciate if you can help me understand if Federal bank is in normal distrubution or not.

Thanks for the kind words, Murali. Most stock returns are normally distributed. I will check this as soon as I can.

First I wanted to thank you for detailed and elaborate info.

I have few questions to ask

How do you convert log percentage to normal percentage? or am I missing something. what does exponential of a percentage signify. Please if you could explain this. just once

To convert a log number back to a normal percentage, we take the exponential.

Hey Karthik,

To calculate the SD, why do we consider the daily returns. Why can we not do it using the closing prices?

i.e. take the closing prices, calculate the mean, variance and then SD?

Thanks.

For all such calculation we consider the daily returns, and not closing prices. One of the main underlying principles is that the returns are normally distributed while the closing prices (or stock price in general) are not.

First I wanted to thank you for detailed and elaborate info.

i wanted to ask you one question

in the excel file why have you taken bin width as =(H8-H9)/50.. why 50?

thank you

50 is the number of bins. You can select this based on the number of data points you have. Higher the number of data points, larger is you bin size. No preset formula to decide this.

hi ,

How can i find probability of particular (given) value in next two month when the current value is given . pl guide me

If the given value stems out of series which is normally distributed, then you can extent this and assign a probability to it.

I calculated historical volatility using stdev.p function with simple return (B3/B2-1) data of index during one year. In order to have max & min value we need to have mean of the return.

How can we calculate mean value? Just using “mean” fn of excel, i think , is not sufficient. The mean should be calculated using normal distribution.

You can use the ‘=Average()’ fn in excel.

I tried deriving the daily average from daily volatility for nifty from the nseindia site

daily volatility is the exp( daily average)

(a)Current Nifty : 9615

(b) daily volatility(sd) : 0.49 – nseindia

(c) days to expiry : 17

(d) daily average : ln(b) = (-0.71)

(e) volatility for 17 days : (b) * sqrt(c) = 0.49 * sqrt(17) =2.02

(f) average for 17 days = 17 *(d) -0.71 =-12.12

when i add e and f for the upper range for 1 sd i get a negative number and hence resistance is coming lower than the current price.

For other stocks this method is working fine.

Daily average can be calculated by running a simple average function on stock return. Step (d) seems redundant.

I am trying to avoid the downloading of historical data .. as daily volayility is readily available.

When i tried the above for nifty, the 1sd upper range came in negative for nifty.

This worked for me till now but when the upper range is negative the resistance goes below the market price and hence wondering what am doing wrong.

I can send you the excel template on the mail which might help in understanding what and where am going wrong

Not sure if I can run through the excel, Varun. I think you are taking the wrong approach while calculating daily average.

When I calculated the average daily returns for nifty for the last one year ( 15 jul 16 to 14 jul 17) the value turned out to be negative. And when I annualized the returns ( both volatility and average daily return) and added them it’s still a negative percentage for the upper limit at 1sd. How come this be true? Does that mean nifty is bearish?

Also in your calculation, you have taken the average of daily return for nifty over 4 years. What is the rationale behind that? How many years of data should one take to find the average daily returns and volatility if you are looking for a time span of 15-30 days vis-a-vis 3-6 months?

The daily volatility shown in nse website, is it calculated in ln scale?

Avg daily returns can be negative, however, this may not be the case with Nifty as the markets have been trending upwards. Ideally, for a 15-30 day period you should look at maybe 1-1.5 yrs of data…and for 3-6 months…at least 2 years.

I’m not really sure about NSE’s calculation.

In the example of volatility used to calculate the stoploss( airtel), The upper and lower range for 5 days is computed by using volatility only. Shouldn’t we take the avg. daily return of airtel, in this case, to calculate the range for 5 days as done is previous examples?

Also, I would like to thank you for the articles you have shared here. Great work.. Kudos.

We should be using the average daily return. Let me recheck this. Good luck and happy learning.

Why I can’t extend Freq column range in your formula.Please help me.I want to add more column data.As per your data range = FREQUENCY(E9:E1096, G14:G64). I can’t extend more than E1096 data range.What i want to do? Thanks for advance. I m trying to attach snap shot. But don’t have option.

You just have to extend your selections to accommodate more cells.

Thanks for your reply.But actually array formula can’t edit as usual.I find from the forum for edit. “After you edit, press CTRL+SHIFT+ENTER not just ENTER.”That’s all. I really need to lot of thanks such a wonderful describe about options. I like it so much the way you example and describe.You have a great talent.Hats off to you.

Yes, all array function requires you to key in Crtl+shift+enter.

Good luck and happy learning, Anantharajan 🙂

How did you calculate MEAN 0.04%?

Average of returns, use excel function ‘=averege()’.

Thanks @Karthik. Standard deviation for sample data you have taken is 1.046%. Can you specify the date range for which you have calculated? When I try to calculate it from (2014,7,22) to (2015,7,22), it is 0.896.

I’d request you to please check the excel 🙂

Hello,

I have one doubt here.

In above excel you calculate probable volatility. For that you have consider nifty from 2011 to 2015.

Now, suppose I have calculate volatility for net 10 or 15 days only so, for that how much past record should we consider.

Means, to calculate volatility for next 10 to 15 days should we consider the same past record for 10 to 15 days back.

or, is it a random selection…?

Not random, really 🙂

If you want to do this for 10-15 days, then you need to look at at least 6 months of past data.

1)When i calculate Daily volatility it comes 2.04 for tata motors for last 365 days.Am I right???Is my calculation correct ???On NSE website it show daily volatility has 1.65.

2)When i calculate average for tata motors for last 365 days its comes -.091% it it right value , could please advice.

Venu, try the same calculation for 252 trading days. Also, I guess NSE’s volatility calculation method is slightly different. Average could be correct. Hope you’ve used the excel function ‘=avergea()’, on the returns.

Hi Sir,

Can we do the 1SD and 2SD and 3SD calculation as simple like this …

we can get the Daily Volatility Data from NSE website on daily basis, “… In the NSE home page, click on ‘All Reports’ and select ‘Daily Volatility (CSV) … ” …

On Nov 21st, Jetairways Daily Volatality ( means 1 SD ) is 0.0368

If we want to know the next 15 days Volatility can we calculate like this ,

1SD : 0.0368 -> 0.0368 * 100 = 3.68%

1SD * Sqrt(15) = 14.25%

CMP : 663.50 ( close price )

14.25% ( 663.50) = 94.54

So the Upper range ( 663.50 + 94.54 : ) is 758.04 and Lower range ( 663.50 – 94.54 ) is 568.96 …

2SD Calculation ( 1SD * 2 ) is 94.54 * 2 = 189.08 …

Can we proceed like this …

Yes, this works!

Thank you Sir …

Cheers!

What about adding SD to Avg and then finding a range

You can use Bollinger bands for that!

If we want to calculate the Daily volatility. How many days shall we consider for calculating daily returns. I mean last one year, two years , four years(As per your excel) or more. And can we interpret that more number of days means more accurate results we will get

At least 1 or 1.5 years will help.

Note these % are log percentages (as we have calculated this on log daily returns), so we need to convert these back to regular %, we can do that directly and get the range value (w.r.t to Nifty’s CMP of 8337) –

Upper Range

= 8337 *exponential (26.66%)

= 10841

And for lower range –

= 8337 * exponential (-6.95%)

= 7777

how to calculate exponential what is formula plz help

You can you the ‘=exp()’ function in excel for this.

how to calculate exponential plz help

Can you please elaborate on how did you arrive at 1.046 ? Daily Standard Deviation / Volatility = 1.046%. I am stuck here and it will be very helpful. _/\_

Let me check this Rohit.

Awaiting for your reply.

I’d suggest you run the excel function ‘=stdev()’, on the daily returns of Nifty. Do this on the same set of data that we have used in this chapter.

Hi Karthik,

Instead of using Log Average Calculation, can we use the normal Calculation for Daily Returns like this,

“” (current close / previous close) – 1 “”. It gives same Results, still I need to cross check again …

Yes, you can use that calculation.

In the excel sheet downloaded, for “bin width”, you have calculated =(h8-h9)/50. How did you arrive at number 50? Also find a way to update website, so that we get email alerts, whenever you respond. It haappens in other websites.

50 is arbitrary and I assumed it based on the number of data points. It can be 25, 50, 100, or 200 based on the number of data points.

Hi Karthik. This is Omprakash. Article was really wonderful. I have downloaded the Nifty Example Sheet. I am little bit confused. Just tell me whether put the close price of any stock for 1 year I can get the data correctly means the range it will trade for the month If I am wrong please correct me.

You can try doing that, OM. Please check if the cells are properly linked to the formula.

Also whether i have to change anything in frequency ?

I have downloaded 1 year data of aurobindo pharma stock close price form nse since it allows for 365 days but nothing changed in excel sheet after filling in price column. can you please help me sir….

I have done all the calculations for NIFTY expiring 22nd feb and upper limit tends to be 10720 and suppose if we sell Call option 10750. How to calculate the stop loss referring to the above example? The OTM transits to ATM (10750)? Thank you.

In this case, you really need to have a tight SL as you’ve already have buffered enough safety. For example, if I have written the option for 10, I’d start feeling uncomfortable the monment it goes above 12 or 13.

As the range increases the confidence level is also increasing, I’m a bit confused about it. That should be other way round??

No, as the range increases, there is more room to accommodate the volatility, hence less room for error, hence more confidence.

Hello sir,

It’s been amazing reading it, little doubts by average you mean = MEAN of last one year daily returns AND will the 1st SD levels would be good for bank nifty as it expires within a week and it’s volatile also

Yes, mean=MEAN 🙂

You really need to check this, Bank Nifty is volatile, wont be surprised it it swings 2 SD in a week 🙂

Hi Karthik,

I saw that you are using exponential calculations to calculate volatility.

Instead of using the exponential calculations. Is it possible to calculate is using the below formula’s.

Daily Return = (Today’s Close – Yesterday’s Close)/ Yesterday’s Close

Daily Volatility = STDEV ( Daily Return )

First Standard Deviation(Upper Range) = Spot Price*(1+ (Daily Return * Days) + (Daily Volatility * SQRT(Days)))

First Standard Deviation(Lower Range) = Spot Price*(1+ (Daily Return * Days) – (Daily Volatility * SQRT(Days)))

Does this formula looks correct to you? It’s the same as yours only I removed the logarithmic base.

Regards

Kulbir

There is no difference (or very small difference) between percentage based volatility and exponential based volatility calculation when time period is small (t->0).

However if one is calculating volatility for long periods, its best to use exponential calculation.

For ex: If you calculate volatility for long periods of time using % based method, you might endup with a negative stock price (not a possibility), however, you would never get that with the exponential calculation

Hi Karthik,

Thank you for your reply.

As you said that Volatility Calculation for longer periods based on percentage formula can give incorrect results. What do you mean by longer periods ?

For example in my case I am using stock prices of 1 year to calculate volatility and daily return.

Regards

Kulbir

By longer, I have one plus year in mind.

ok, thank you Karthik for the clarification.

Welcome!

Hello Karthik Sir,

If we need to calculate Banknifty deviations for 1-week expiry then a percentage based volatility is better then exponential based volatility calculation as you said that exponential is better for more than one-year calculations or it also gives an edge for shorter periods as well, as in the case above.

And in excel sheet you’ve provided above I see you’ve used 252 ( trading days ) in a year for calculations, but when it comes to a month you’ve used whole 30 days, is that 30 days are 30 trading sessions??

Vinay, yes look at the regular % returns for less than 1-year time frame.

That is a good observation – maybe I should use 22 trading session for monthly calculation.

Very interesting topic. You are a genius, Karthik!

Thanks for sharing such insight.

‘Genius’, is a big word.

Thanks for the kind words, anyway 🙂 Happy learning!

how calculated Upper & Lower range,

Upper Range

= 8337 *exponential (26.66%)

= 10841

And for lower range –

= 8337 * exponential (-6.95%)

= 7777

because as my opinion

Upper Range is:

=8337*1.2666

=10559

No, we use exponential to convert the log scale back to normal scale. So go with exponential.

where do i find implied volatility chart of underlyings for indian market?

I’m afraid these are not available.

Hi Karthik

Even if there are 100s of comments still i wanted to salute you for bringing this kind of tough topic in a easy manner !, couple of questions with curiosity .

1, Have you ever traded options based on 1SD or 2SD ? and what is your winning rates ?

2, I can see on tastytrade.com they talk a lot about both SDs and the trade opportunities related to this , specially strangle strategies , do you have any words on this ?

3, Have found a website stockmaths.com where i can get SDs as of now and historical too , compared your XL template calculation with it and its matching , have you ever tried it ?, would it be a reliable source of SD?

4, On your XL sheet you had used about 4 years data, is it ok to calculate SD with just 1 year data ?

Regards

Neeraj.

1) Yes, multiple times. At 2SD, I’ve had greater success but the profitability is low. Maybe 3 (or maybe 4) out 5 were successful.

2) I’ve not used tastytrades, so no idea.

3) Thanks for sharing the link, I’ve not used it. Will try and look it up

4) Yes, in fact, the better approach is to look at 2 years, 1 year and last 6 months SD. Gives you a perspective of how the SD is changing.

Good luck!

I have created a Galton Board that demonstrates this idea. It is call The Random Walker. See http://www.therandomwalker.com

Enjoy.

Thanks for the link, Mark.

hi Karthik,

Using your excel sheet suppose if I’m calculating SD for a company which has issued bonus in the last year (example – M&M), does the excel produce correct results or any correction is required to account for the decrease in the share price after bonus is issued?

No, not really. The excel is static and does not adjust to corporate actions.

Hai!

I have a doubt. How do we know whether volatility is high or low? Say the IV of stock is 34%, then is it high or low?

You can always calculate the historical volatility and compare this with present-day vol to get a perspective.

Hello sir,

As you said in previous chapter that

Mean annualised = mean daily * sqrt (days)

But in the above explanation you said that mean annualised = mean daily * days

Can u plz clear this doubt.

Thanks in advance

Ah, I think that’s a mistake. You can multiply the mean by the number of days but SD you will have to multiply with the Square root of time.

Hi!

Thanks for the wonderful explanation!

However, I’m facing a dilemma here regarding a real life example of volatility. As of today (13th May 2018), the daily volatility of PCJewellers as per the NSE website is 14.59%, while the annualized volatility is 278.82%!

So, if volatility of any stock is greater than 100%, would it mean that the range for the stock extends from being worthless to being double or triple it’s current value for that given period or is there something that I am missing out?

Yes, that’s exactly what it means, however, the downside is capped to 0 as stock prices cannot be lower than that.

Thank you for the reply. You are doing an amazing job educating people about this and enabling them to explore markets with a sense of market literacy. Can’t thank you enough. 🙂

Keep learning, Anshul 🙂

Hi Karthik,

For calculating upper and lower range I used excel’s exponential formula. I calculated upper range and lower range which you have mentioned in the explanation above has different figures as follows:

As per excel

Upper Range

= 8337 *exponential (26.66%)

= 10884 (as per explanation above=10841)

And for the lower range –

= 8337 * exponential (-6.95%)

= 7777(as per explanation above=7777) this is correct.

I need to look into this, Kunal. Will get back as soon as possible.

Hi Karthik,

When we are calculating the annual returns or SD or anything, how many days should we take? is it 365 or 252? in some calculations you have taken 365 and in others 252? from where does this 252 days come? plz explain.

Also for daily average returns should the no.of days be same as we take for annual calculation? will the average returns and SD keep changing as no. of days change?

Thankyou

Priya, I prefer to take 252 days as this represents 1 full trading year’s data. Apologies if I have not been consistent in calculations, but yes, 252 serves the purpose.

Hi,

I’ve calculated SD and average of nifty data from (6 jun 17, – 5 jun 2018) with log returns. Daily and yearly average come 0.04% and 9.61%, Volatility come 0.64% (daily) and 10.20% (yearly) and CMP 10594 . Using this data 1 year range come Upper Range 19.81% and Lower Range -0.59% with this exact range comes 10532-12914. Upper Range seems good but i think there is something wrong with lower range So can you please tell me where is the mistake.

Please answer asap as long way to go.

Gurjeet, this is quite expected as the daily avg is positively skewed. I’d suggest you look at 1.5 or 2SD.

First of all thanks for reply. I calculated the 30 day range with 1 SD it comes 10345.47-11099.6 and 1 year range with 2 SD

9511.21-14300.86. From this i think there is something wrong on yearly average so is there any solution to fix this ?. So i was right but there was some average issue right ?.

Gurjeet, the average has a positive bias so it is not surprising that you’ve got such values.

Hi Karthik – Sorry to bug you again but, when doubt comes you are the only recourse.

So, when you say positive bias do you mean Average is positive? If, yes then does it mean if average comes out to be negative then positive upside will be less than downside?

Also, saw you mentioning in one of the comment that you will let us know the calculation of range when Average is negative have you already done that if, yes appreciate your providing the link for the explanation.

Vivek, ideally the daily average return should be as close to as zero. If it is near zero, then the range calculation will turn out much better. If the average is slightly positive, like say 0.4%, then the range tends to be slightly positive. Likewise with a slightly -ve value.

I have explained this somewhere, I’m unable to trace it back myself 🙂

Hello Karthik ! Is the composition of nifty (i.e the fifty stocks it contains,weightage adjusted ) also normally distributed? What i mean to say is if say nifty rises 1% for the day,then 68%of comprising stocks should be in 1%+1S.D range or 1%-1S.D range and so on.Does this holds true or not?N how about going for a pair trade by going long and short simultaneously in the either end of the spectrum then?

Not really, Anshul. Only the daily returns of Nifty are normally distributed, not prices or the index constituents. You can try doing calendar spread on Nifty by going long and short on Current and mid-month contract.

Hi,

Here are the calculations for nifty

1SD Daily Yearly 30 days

Average 0.04% 10.42% 1.24%

SD 0.65% 10.37% 3.58%

CMP 10699

Range Calculation with 1 SD

1 year

Upper 20.78% 13170

Lower 0.05% 10704

30 days

Upper 4.82% 11226

Lower -2.34% 10451

I understood the calculations part. My following queries are :-

1. What SD should we use say if I need to trade banknifty options? Which one do you use?

2 .In 30 days lower range i am getting – ve value whereas in 1 yr lower range i see it is +ve. how come?

30 days

Upper 4.82% 11226

Lower -2.34% 10451

1) Calculate the daily and convert it to your desired time period. This is what I use.

2) I think your calculation for 30 day is wrong. Can you please check that again?

Hi

Please see below link. calculations done.

https://drive.google.com/open?id=1jbg1WxJBDueh1i44KaKK6RmcjfY8oXUL

Can you please check the calculation for 30 days lower range. Unable to find out the error

Will try and do that over the weekend, Shyam. Thanks.

Hi Karthick,

By going with the above calculation, let’s say if I taking some strike price which beyond the 95% confidence Level with 2SD. Those strike prices are not allowed to trade due to the limitation(range outside the trading level) provided by NSE right. Then, in that case, we can never use this to sell options which will go worthless right…

Request you to clarify if my understanding is correct…

Selvam, this may be applicable only with Bank Nifty weekly expiry. Other contracts should not be an issue.

Thank You.. got the point.

I had calculated the range calculation with 1sd for 2 days . It was 10963 as per calculations . and today nifty is in range of 10932

This really works if your directional bet is right. Made a small profit today as i wanted to check if my analysis was right. But i got out early as usual . Guess this has to be learned the hard way.

Hats off to you sir and to Zerodha for sharing this knowledge .

Yes, this takes time to get used to. Good luck, Shyam!

Can we calculate intra-day volatility also ?

Please reply.

You can, Suhas but this requires you to build a volatility model using techniques like ARCH/GArch etc.

Thank you very much Karthik. However, request you to please explain ARCH/GArch

Please. Thanks.

Suhas, I’m aware of these concepts but not to the extent where I can explain to others.

Maybe I should learn these concepts well enough to do so 🙂

It’s okay Karthik. Thanks.

Cheers!

Hey Karthik,

I have seen in some cases the IVs of the stocks does not fall even after the announcement of the results. Could you tell me why this happens?

Thank you.

Yes, this could happen if the stock is influenced by its own event and the market event, wherein the market event follows through the stock’s independent event. Example – Infosys’s quarterly results on 25th and election results on 28th. In this case, the volatility will remain at elevated levels.

Thanks Karthik,

Have another question. Let me take example of ICICI bank. Quaterly Results for that script is tomorrow i.e on 27th. IVP of this month contract which is expiring today is 99 and the ivP of Aug contract is 85. These results wont effect july contract right? In that case ivp of Aug contract should be high right? Will the announcement of results effect the IV of Aug contract ? Same case for Axis bank. Results are on 30th and this month contract iv is high. Why the difference ?

Got these values from sensibull.

It will affect both the options. The sensitivity of the July contract will be higher than the sensitivity of the August contract.

how to calculate daily average?

Wasim, the daily average of what?

While calculating annualized numbers you took 252 but while calculating monthly SD you took 30..aint that suppose to be 22 then?

Yes, it does. I’ll change it as soon as I can.

Hello sir

i really liked the way you explained the topics, i have a small doubt i, e in nifty example in excel sheet while calculating 1SD yearly you used =k9*SQRT(252) As formula but i don’t understand why it’s 252 and not 365 days.

Please help me understand the same.

I have attached a link for a excel drive please can you help me verifying it whether all the calculations are correct.

https://docs.google.com/spreadsheets/d/1ADgTIDH1fqQvYYbgaJPPWRNT4riXhllEn38wFIeWol4/edit?usp=sharing

Regards

Thank you

Guess, I answered this earlier.

Yes sir but I am not sure whether the calculation i have done is correct so if possible can you go through the excel file and let me know, it would be a great help to me to. validate my calculation.

Regards

Thank you

Running a very tight schedule today, but I’ll try and do that sometime soon, Rishi. Thanks.

Thank you sir for your valuable time and clarifying my doubt , waiting for your validation for the excel file.

Regards

Rishi jain

Hello Sir,

Thanks a lot for the wonderful articles. I have a couple of questions.

1. I am thinking of buying NIFTY AUG 11800 CE. So I downloaded the historical data of Nifty from NSE for the period, 21st Aug 2017 to 20 Aug 2018 and calculated the daily return mean (0.07%) & SD (0.65%) using the excel as you have shown in the previous chapter. For Aug 30th expiry, number of trading days is 7. Hence, 7 days’ daily return mean is 0.49% & SD is 1.72%. Current Nifty spot is at 11551.75. Hence I got the lower end of Nifty as 11410.53 & upper end as 11809.89. Since there is a 68% probability of Nifty hitting 11800, I can go ahead and buy right? Is my understanding correct?

2. Similarly, if I have to calculate the range in which any index or stock would trade for the next few days/weeks, I need to know the daily return average right? which means should I calculate it like I explained above every single time using the past 1 year daily return values?

1) The calculation is right, but I’d suggest you do this writing options as opposed to buying options

2) Yes.

Okay. Thank you very much.

Welcome!

Upper Range = 16 day Average + 16 day SD

= 0.65% + 3.567%

= 4.215%, to get the upper range number –

= 8462 * (1+4.215%)

= 8818

Sir pls explain above calculation ? and how to take it in excel?

example from previous chapter was simple to calculate in excel as below

Upper Range

= 8337 *exponential (26.66%)

= 10841

Amazing !!!

Thank a lot Karthik sir !

Happy learning, Arun 🙂

i got the daily mean/average as negative, because of this the upper limit becomes less and the lower limit becomes more negative. This happening is normal?

Yup, especially when the stock or index is trending down.

Hello, Karthik can you please tell me how did you plot the normal distribution graph, I was using the NORMDIST function but I don’t know what should be the input for “X” the other two is specified that is mean and SD but what about cumulative distribution function should it be true or false, can you please explain how to plot the graph or how to get the values of normal distribution after calculating daily returns, Avg daily returns, SD daily, annual SD. Please tell what are those values in y-axis thank you.

Dwijesh, I’ve not used the NORMDIST function, instead, I’ve used bin arrays and distributed the returns across the bins and then plotted a line chart over it. If the data (stock price returns in this case) is normally distributed, you will get a bell curve, which is what I’ve got in these charts.

Hello Karthik,

When the average is positive – difference of upper limit with spot and difference of lower limit with spot is highly different. Is this calculation biased towards writing call options? Upper limit is too far from the spot and lower limit is too close to the spot, using this data how to write a strangle in NIFTY and BANKNIFTY?

Abbas

Not really, Abbas. This depends on the data points (also check of the stock/index has trended). I’d suggest you replicate this calculation of few other stocks to check the way the numbers pan out.

Hi Karthik,

Your write up is super super lucid and easy to follow. I can understand the the kind of patience it requires to do write ups like these, clarifying each and every point.

Indeed, no one goes hungry (without any doubt in mind) after reaching such blogs.

Thank you very much.

Hey Altamash, thank you so much for the kind words, glad you really liked the content 😉

Hi Karthik,

Where can i get Nifty Daily Volatity readily available?( e.g. For Wipro, i can go to ‘Derivatives Quote page’, n get it in ‘Other Information’)

Also, is it possible to get High and Low of IV of all Stocks(including Nifty) for last 1 year? If yes, then where exactly do we get it?

Tks a lot

You can do that for Nifty Futures as well. The high/low vol should be available with Sensibull, let me check.

Hi Karthik,

When we calculate ‘Daily Mean’ from ‘Daily Return’, can Daily Mean figure be negative? if yes, then should we take this negative figure into account to calculate 1SD n 2SD? Pls explain.

Tks a lot

I’m not sure if I understand your query completely. Daily mean and daily return is the same. Yes, if this is a -ve return, then you will have to take that for std dev calculation.

Hi,

Tks a lot. What i meant was that when we calculate Daily Mean from LN(D3/D2), i was getting negative figure, so got confused that should i take it as positive figure or it can be negative also.

Kindly guide where exactly can we get Daily SD of Nifty/Bank Nifty/Other Sector Nifty Indices?

Also, do we get IV of Nifty/Bank Nifty/Nifty Stocks readily for last 1 year to get range of IV for underlying. If so, where exactly to search for the same.

You can take the negative values of daily returns. There is no issue with that! NSE puts this information up on their site, click on any derivative contract and click on ‘other information’. IV is a little tricky I guess, Dharam.

Sir, in the excel sheet what is the term “Bin width” you have calculated and what does it mean?

That is the size of the bin which contains all the data points ranging from the lower bin value to the higher bin value. For example, if the data points are 2, 5, 7, 9, 3, 4.5 and if the bin width is from 2 – 6, then it will contain 2, 4, 3, and 4.5.

Hi Karthik,

You have given examples of how weights or heights of people follow normal distribution.

Is it that:

– Actual values of weights and heights follow normal distribution

or

– Deviation from mean of weights and heights follow normal distribution?

Thanks,

Akshay

I was referring to the actual weights. However, if you are talking about stock prices versus stock returns, then stock returns are normally distributed and prices are not. Stock prices can trend.

But the Bollinger Bands track movement of stock price away from its mean, not stock returns.

What am I missing?

Akshay, yes, BB is on the price and not returns. Frankly, I never thought about this – stock prices can trend, so BB bands may not be that effective.

how does – 68 %, 95 % and 99.7 % gets calculated of standard deviation in first example of Galton Board

These are the normal distribution properties, Vishal.

= 8337 *exponential (26.66%)

= 8930

How did you calculate that value? i am getting a very large number while using = 8337 * exp(26.66) in excel.

I’ll try and post a screenshot.

Ok thanks

This will work same for bank nifty weekly expiry?

Yup, it does.

Why is it that the lower end is much lesser than the higher end, in the volatility calculation? In 1 SD calculation of ranges of Nifty the upper range is around 27% but the lower range is only -7%. Aren’t there chances there are equal chances of going up or down of the same value? Is there any specific reason that that i am missing out to see?

This depends on the past data as well. If the data has some sort of trend (strong), then there could be a bias.

How do we calculate IV rank. is there a way to do that using excel

Possible, but I think it could be cumbersome, Narendra.

Hi Karthik,

Can the Return Average be -ve? I think it can be however in that case when I do the range calculation of the current Nifty Trend then I get the below data. Do you think any problem with that? I took 600 days data.

Daily Average -0.03%

Daily Volatility 0.73%

Annualized Average -7.88%

Annualized Volatility 11.55%

Nifty Spot 10907

Range 3.67% Upper 11306.99

-19.43% Lower 8787.83

Looks alarming.. 😀

Suvajit

Suvajit, I think your numbers are very slightly off. Btw, yes, return range can be -ve.

Daily Avg = -0.03%

Yearly Avg = -0.03% * 252 = -7.56%

Daily Vol = 0.73%

Yearly Vol = 0.73% * Sqrt(252)

= 11.59%

So how did you get 3.67%

Hi Karthik,

I did Range Calculation

Upper Range=Yearly Avg +Yearly Vol = -7.56+11.59 = 4.03%

Lower Range=Yearly Avg -Yearly Vol = -7.56-11.59 = 19.15%

Is this correct calculation please?

Suvajit

Yup, it is.

In the excel sheet i downloaded, Why BIN WIDTH = (H8-H9)/50. Why divided by 50 only? Can we do that with 100 or 60?

Okay. I got it. Read the comments above. No need to reply.

50 is an arbitrary number, it may as well be 25 🙂

Larger the data points, higher the number of bins.

You mentioned in module that option writes should be done before 15 days expiry date then what type of trade should be done just after the expiry? Will be appreciated for your response.

I mean, its best to consider writing post 15th of the month so that the time decay is in your favor. Earlier in the series, you can look at buying opportunities.

Hi Karthik,

I have few questions for you?

1. Is annualized volatility and historical volatility are same?

2. Just for info, comparing IV with HV determines the IV rank?

3. as per sensibull, is IV calculated based on Average of ATM(call & Put) of current month? or includes OTM strikes IV as well?

Thanks!

1) I can calculate the volatility as of today and then annualize it. Historical volatility is based on the past data

2) Yup, you can use this for a back of the envelope calculation

3) I’m not too sure, maybe you should check with them.

If i buy call option today and sell it a few days later before expiry, do i need to have margin to sell it?

Nope, you dont need margin to square off an option.

Hi Kartik

Where can we find the historical implied volatility data for nifty and any stocks.

Is india vix and implied volatility same.

Aasim, India ViX is implied volatility. There is nothing like historical implied volatility….I mean, the current implied vol becomes just the historical volatility t’row.

Hi Karthik,

I got a doubt here.

We have types of volatility

1) Historical Volatility (which you have calculated earlier based on stock price)

2) Forecasted Volatility

3) Implied Volatility

Realized Volatility which is nothing but past implied volatility (actually volatility which occured earlier)

Now, when you are using “Normal Distribution” and calculating (+1 SD, +2 SD), the volatility here was calculated based on stock prices right.

Similarly, when you introduced “Volatility Cone” in the next chapter, you are calculating volatility based on “Realized Volatility” or simply past Implied volatility.

Up to this, let me know if I am correct?

If my above understanding is correct, suppose we calculated volatility (using stock prices) for the next trading day and think it came around (1.52) -> Volatility based on historical stock price data (Historical Volatility).

Now, in the next trading day, the implied volatility , the actual volatility which will occur can be different from what we just calculated(1.52) (Implied Volatility).

So, how come the past implied volatility could be same as Historical Volatility? Please let me know.

Thanks

Srikrishna

Hello,

What is the logic behind using exponential function as opposed to normal one in the Range calculation?

THANKS

Guess the returns are calculated using log returns, to convert it back to normal scale we use the exponential function.

sir, I am learning algo trading and also quantitative strategies but I couldn’t understand why people use log return instead of arithmetic returns like daily return.and in above in one calculation u were calculating 1-month return but u have used 30 instead of 22 to calculate the monthly return

Log return gives you a slightly better representation of true returns, this is true for shorter look-back periods. Guess I have explained this in detail with an example somewhere in the comments. Can you please look it up? Thanks.

in Excel sheet, I don’t understand in bandwidth why it is divided by 50

sorry, please explain Bin width, bin array and frequency, what the useof it

I’ve explained this in the chapter itself, Vinoth.

That is to create different buckets, Vinoth.

Hi sir,

Please correct me for the calculation of mean of a stock.

Mean = sum of % daily returns of a stock for 1 year divided by total no. Of days??

Is it correct? And for calculation of SD it is in NSE page as volatility.. Likewise is there any source to get mean of a stock?

Bala, that is the right formula. No, I’m not sure if any websites helps you calculate the mean of a stock.

Sir, As per the Standard deviation formula i did calculated the 1st SD range for nifty. I did virtual trade option writing in these CE and PE options. It was is profits only. Thanks for a such wonderful strategy. Inspired. I want to move to real trade, my question is , on the day of expiry what would happen if I don’t find any buyer to square off my position ( if my options are expires in OTM ). Do the exchange will impose a penalty to me?

Your option will be squared off and settled by the exchange.

Hi guys

first of all thank you very much for all the explanations and all the learning you make available.

I just don’t understand why the standard deviation here is multiplied by 2.I read few times the chapter and my understanding is that the 2SD is related to the distribution theory.If my understanding is right I don’t actually get why applying *2 or *3 to the standard deviation.My understanding of the theory is that you have like a basket of observations represented by the 100% of the cases observed, in which the first distribution represented by the 68% of the cases falls let’s say in the central bins, the second represents the 95% of the cases and the third the 99.7%.

Said that and assuming my understanding of the 1SD and 2SD mentioned in this chapter is right, I think the first SD should be calculated on the 68% of the observations (the daily returns between -0.85% and 0.89% in your file), the second 95% on the daily returns between -2.27% and 2.89% of your file and the third with the daily returns between -3.69% and 3.26%.

While I perfectly tie back with your calculation for the overall period (0.038325% average daily return and 1.045661% annualised standard deviation), I calculated an annualised daily return average of 0.035014% and annualised standard deviation of 0.450559% taking the first distribution (daily returns between -0.85% and 0.89%), respectively 0.06858% and 0.951959% with the second distribution (returns between -2.27% and 2.89%) and 0.03832482% and 1.044886% with the third distribution.

But I may have misunderstood what you mean with 1SD and 2SD.

Please let me know what are your thoughts about that

Thank you very much for your support

Pasq, I read your comment a couple of times, I’m not sure if I completely get it. 2SD, is simply adding 2 to 1 SD, which as it implies leads to 2 standard deviations. Likewise with 3SD.

hello karthik,

I did not understand the converting log % to normal% part could you please explain how to arrive to that number

Ashutosh, when you convert log to normal, you are essentially converting the number from a log scale to a regular number.

How do we arrive form to exponential(26.66%) value

Meaning? Can you kindly elaborate this?

Hello Mr. Rangappa

I’m a bit confused with why you calculated the Bin Width, Bin Array & Frequency in the sample excel sheet of the calculations. Meaning, what is the use of it? I didn’t get that…

This is to help you plot the distribution of the data points, especially to see if the data is normally distributed.

Okay, I understood now! That you used it for plotting the Normal Distribution Graph of Nifty.

But can you please explain me the calculations of:

Bin Width (why divided by 50)

Bin Array ( why add by $H$10 function?) and,

Frequency?.. Didn’t get the calculation of that at all

50 —> It depends on your data size. If the data points are many (more than 500, maybe 50 or 100 will do)

Bin array – to ensure all bins are of equal size

Frequency – This is an excel function.

Thank You 😃

Good morning Karthikji

1)What to do if average 1 year return is negative ??

For eg- Nifty avg return is positive number say 10% which can be converted to daily, weekly or monthly return avg. But since many top Nifty stocks had given negative returns For eg- Indiabulls housing had given -58% negative returns then how we shall proceed with daily avg & thereby calculating Std Dev

2)Also Bear swipe is brute. It’s easy for stocks to go more than 50% down in year but harder to give even 12% returns in bulls phase. So is there different calculations approach? Because such big negative returns give bizarre even 1 std dev results! What to do for this ?? 🙁

Thanking u for your time & have a blessed day 🙂

1) This can be a tricky situation. In case, of a compelling trade situation, I’d look at other parameters to trade besides the returns.

2) I’m guessing you are relatively new to markets (less than 4 years), is this true? Because in a true bull market (pre-2008), the returns can be crazy 🙂

Good evening Karthikji

Thanking you for rply to above query.

Well no I’m not new to market I’m since 2008 😅. Yes I’m new in F&O space since 2017. Yes u r right that returns r crazy in bulls phase not only in pre-2008 but recently in 2017 where more than 700 stocks gave more than 100% returns!! But that’s largely from midcap & smallcap space. Largecap especially bluechips except banking & IT others had struggled to give 15% returns also (but yes still better than risk free FD returns ) 🙂

Anyway so can we apply Volatility based Stoploss plus 1% extra buffering to negative returns stocks apart from other checklist like technical & oi analysis ??

Kindly rply to this above query. Thanking you 🙂

Yes, Harsh, you can 🙂

Thanking you so much Sir.

Have a great evening 🙂

Welcome! Happy reading, Harsh!

The Bollinger bands give us the same SD variance plotted on the chart wrt to a 20 day moving average, right? The same can be used as an alternative to normal distribution range?

Yes, you can use the BBB as an alternative for short term SD.

Hi kartik can you tell in excel sheet bin array function, how you used it?

I’ve explained that in one of these chapters, Shrikant. The key point to remember is to use ctrl+shit+enter when pressing enter.

Dear Karthik , When finding trades in 1 SD range , we are taking current market prices 8337 ins this example . But I am sure the average / mean of normal distribution is somewhere else . But as per my understanding 1 SD + – is to be seen in context of the mean value and not the current value of Nifty in this case ? Kindly help me to clearly understand the concept

Thats right, Rajendra. You need to look at it from the current market prices perspective, as in you will have to do the same with the latest prices.

mean and average .. are not they same ? how can you divide them ?

They are the same. Can you share some context on this? Thanks.

In the chapter about “Volatility & Normal Distributions you explain

Converting Upper and Lower Range Log Returns to Simple Returns as ” Spot * exponential( Average + SD)

and in the very next chapter “Volatility Applications” you explain the same conversion as “Spot * ( 1 + (Average + SD)) and Spot * ( 1 – (Average + SD)) for upper and lower range respectively.

Can you please explain why this difference. Thou I am late to start but I guess its never late to learn

Ah, let me double-check this, but most likely I’ve taken the log-returns when I used the exponential function. For simple returns, you don’t need the exponential returns.

[…] 17. Volatility & Normal Distribution […]

Hello Karthik

First of all thank you for writing these articles in a lucid manner. Really appreciate it.

I have a query though.

When you annualise daily return you multiply by 252 (I assume we excluded the days when markets are closed). However when calculating daily return for 30 days you did not exclude the non-working days (Saturdays & Sundays) before multiplying. Doesn’t this create inconsistency in the returns calculations?

Hi Karthik ,

The Excel Worksheet has words like ” Bin Width ” , ” Bin Array “, ” Frequency ” , Have you explained these on this Article ? where is this explained . i m missing to understand these . Please point me to the article where you have explained these .

Ah, I’m not sure if I have explained this separately. I must have done this contextually in the flow itself. Let me also recheck.

sir I understood everything but only have one doubt that what is the daily average or mean is it the average of daily volatility %or something else please sir kindly reply I need your help

Avg can be on anything, returns in this case.

Dear sir,

Thanks for putting such a valuable information here. I have a query regarding the calculations of upper range and lower range of stock value based on average and standard deviation. Question is as follows:

What if the average daily return value is negative? It is just an average of all the daily returns of (say 1 year data).

How will be the upper and lower values in such a case? I have done a calculation for a share price for last one year and found the average value as negative. After that the upper and lower bound values looks absurd.

Regards,

Prasad

-ve values can be tricky. Happens when the stock has continuously trended down. Probably like a Yes Bank. The calculation technique remains the same.

Hi Karthik,

Thanks for putting out such wonderful content to understand trading.

I was trying to calculate daily volatility for last 1 year starting from 09 Apr 2020 in excel and my Daily SD came as 1.8 %. In NSE website daily volatility is showing at 4.7. Why such big variance?

Birsha, please check the previous comments.

@karthikrangappa sir , can daily average be calculated as the mean of daily returns ?

Mean and average is the same no?

@karthikrangappa in the first solution , why did u calcualted standard deviation as daily vol*sqrt(242) ? why dint you calculate as *sqrt(364) as you mentioned previously?

in the second solution you have directly calculated 30 day standard deviation without using SQRT ,i.e std.dev = 1.046%*30 but you have calculated all others using SQRT ! which one should I consider ?

It is Sqrt of time. Not sure if I missed this.

sir ,how to find daily return average of nifty ? i tried finding the historical data of nifty index but it shows calls and puts data ! how to find nifty spot historical data?

Please download the historical closing prices of the index and calculate the returns and then use the average function on excel to get the average returns of Nifty.

Sir

Volatility implies RISK associated with a stock. Once we have the volatility data, we are trying to compute the range within which stock / index can go viz. UP or DOWN. By computing this range, aren’t we looking at the UPs and DOWNs of the stock / index ? So volatility means ups and downs of the stock / index but we are calling it as RISK. Kindly correct me if I am wrong.

Thanks

Fair enough, another way of looking at risk 🙂

Sir

In Solution 1(Nifty’s range for 1 year) above, its written 0.04*252 = 9.66% but actually it comes out to be 10.08%.

Thanks

I could never really understand normal distribution or for that matter, most of the things taught in Prob & Stats back in college.

If only things could be taught the way you do, they can be made much easier and fun to learn.

Thanks Karthik 🙂

Happy learning, Rohit 🙂

Respected Sir,

Namaste, In the graphs plotted representing the normal distribution of daily average returns for Nifty, Bank Nifty, TCS, Cipla etc, Y-axis represents daily average . What does the X-axis represents which is scaling from 0 to 100 or 120. Kindly explain please. (Though I am not a statistics student, I could understand all other concepts explaned so far. Thanks a tonne for your methodology of teaching which can be understood even by a lay man sir.)

Y axis is the number of observations and X axis is the % return.

Hello Karthick,

Firstly thank you for posting these chapters and indeed its of great help for novice like me.

My Query: How to determine IV (Implied volatility) for Banknifty ? In the chapter you discussed on calculation of historical volatility using excel and then determining the Strike price. In my understanding, in order to determine the correct strike price, we would need IV and HV and then determine a +1 -1 SD range and decide on a strike.

Please if you can share the process of

a) Determine the IV

b) How to consider the IV and HV and then come out with a % that can be applied to determine upper limit and lower limit for the Normal distribution

Thank you in advance.

1) You can use the B&S calculator to identify the IV, check this – https://zerodha.com/z-connect/queries/stock-and-fo-queries/option-greeks/how-to-use-the-option-calculator

2) This is explained in the chapter itself no, Anurag?

I am surprised to see that stock returns follow a normal distribution.

Food for thought: It would be interesting to see what kind of distribution does trader’s earnings follow. Would it be somewhat normal distribution (or heavily skewed that most traders make loss/profit), or some other distribution altogether? Perhaps if Zerodha has such kind of data of its users, it would be an interesting exercise.

I don’t think we can do that as a broker 🙂

Sir ,

There is a posting on September 21, 2017 at 11:53 am User Says :

I’m also facing the same problem while trying to change the FREQ formula in H14. The current formula is =FREQUENCY(E9:E1096,G14:G64). Now my data range has changed in col E, so I need to change that. When I’m trying the same, it is giving the error message – “You can not change the part of an array”. Can you please look into this?

TO WHICH YOU REPLIED :

Are you sure you are selecting the right date range? Also do pay attention to the Çtrl+shift+enter thing when using the frequency function.

So i am Also Trying to re Create the Work sheet But facing the same problem ( Please Clarify the Following Points ) :

a) . I am Unable to keep Cell numbers constant Actually it should be =FREQUENCY(B10:B274,D10:D60) but as i Drag the Formula it becomes =FREQUENCY(B11:B276,D12:D62) ….. =FREQUENCY(B59:B324,D60:D110) where am I Going Wrong ? .

b). in my Excel Sheet Frequency is all ZERO – 0 no other number . Why is it so , what is wrong with me ?

a) Try locking the cells with $

b) The excel issues will be very hard for me to solve, suggest you look up for videos online to check how -Frequency() function is used in its right syntax

Hello sir,

Great journey so far, lockdown can’t be better than this.

I have a small query, the avg returns are their in terms of logs. Sometimes we are changing it to normal and in the next chapter, we are not. Can you state the logic behind it. Also what is the best formula for returns, is it the log one or the normal one?

Use the log returns, Pranav 🙂 I was just trying to showcase different methods.

Sir,

Thanks for elaborate & informative study materials. I want a clarification regarding daily & annual volatility calculation. I used same excel sheet in the chapter 17 (nifty caln). I checked for nifty & many other f&o stocks. Daily volatility comes <2 roughly & annual around 25%-30%. But in nseindia site, it shows huge difference , for daily ~3.5-3.8 , annual vol. ~ 66% to 75%. Even after changing no of days from 252 to 365, only 4 to 5% difference. but nowhere near the figures shown in NSE site. I feel my calculations seems to be correct. I have only copy pasted one year data with date, for nifty & various stocks. Pl help.

https://www1.nseindia.com/live_market/dynaContent/live_watch/get_quote/GetQuoteFO.jsp?underlying=NIFTY&instrument=FUTIDX&type=-&strike=-&expiry=28MAY2020

I’m aware of this difference. NSE calculates this slightly differently, they calculate the previous day;s vol and kind of extrapolate the values. They may be doing this keeping the margins in perspective.

sir , i want to know that why u selected 1 year period for calculation of sd and average return. Why u didn’t take 2years or any number of years or months and for what future period is this sd and average return is relevant.

1 year is a good starting point 🙂

so you mean to say that if i calculalte volatility for nifty then i should take date of last 1 year and caculate sd and this sd will be relevat for upcoming 1 year.

Hmm, frankly I don’t know at this point. Doing my research on it.

Sir,

In that case, which one to refer ? difference with NSE data is more than double.

I know, please give me some time and I’ll figure this out.

ok

hie sir,

sorry for bothering you again and again,

1. how did you calculate daily mean which is 0.4% ?

2. I was calculating daily volatility of reliance share , It was something 0.02344 like there was so much numbers after point, how did you get that in percentage ?

1) Daily mean is the average calculated over the daily return time series

2) If you are using excel, then click on the % sign, it will convert.

as we can calculate the daily return and daily volatility. this is will also help us to find annualized volatility.

what if I want to calculate the 52wk high and 52wk low volatility of the stock/Index.

India VIX gives us low and high for nifty. Is there any way to find out the same for stock.

so that I can compare the Historical Volatility and Implied Volatility to find the right strike.

I’m afraid historical high/low of vol is not easily available.

so can I use the black sholes formula and as implied volatility is the reverse engineering process also if I use” goal seek” a formula to determine the volatility and then compare it with historical volatility and see if the given strike is expensive/cheap?

Yup, you can.

1. daily mean is daily volatility?

if no then how to calculate daily mean using excel?

No, they are different. Use the average formula to calculate the mean.

Good Day,

Thank you so much for this amazing content!

Just wanted to know, being a long term investor (3-5 years) approx, is it okay to gauge the risk by considering weekly avg. returns instead of daily returns?? or will it cause too much change in the confidence levels ??

Weekly is fine, Ronak. You can go ahead with that.

Hi Karthik,

When I calculated Mean(average) for last one year’s daily returns of nifty I am getting a negative value (eg. -0.12%), so is there a condition that mean should always be positive value..or have I gone wrong in my calculation…please guide me.

Waiting for your response..

Shabarish.

Negative values is possible given the crash in the market. Dont think you’ve gone wrong in your steps 🙂

Dear Sir,

It seems that Standard Deviation calculation of Normal distribution is not working in BANKNIFTY from the last two weeks.

As BANKNIFTY is very Bullish and increasing 1000 to 1200 points in a week. Selling Bank Nifty is not a wise step at the present situation. What should be the strategy now can you please suggest.

You need to deep OTM calls, but that will be a risky affair given the momentum. Maybe you should consider buying opportunities 🙂

Hi Sir

Please Correct me if i am worng

1.) I am very much confused by this 2 calculations in this chapter

Average = 0.04*252 = 9.66% { we do the same in calculator (10.08)}

SD = 1.046% * Sqrt (252) = 16.61% {we do the same in calculator(25.31)}

2.) And

when we are calculating range for next one year why is reason we are using 252

(is it because we are exclude Sundays and Saturdays )

And

when we are calculating range for 30 days why is reason we are using 30 days itself

Please correct me if i am wrong somewhere

Waiting for the response

Thanks Sir

Regards

1) 0.04*252 = 10.08 is correct, the other one is 16.61%

2) 252 = number of trading sessions. If you are sticking to 252, then monthly you should stick to 22.

Firstly very well articulated chapters and it just keeps me glued wanting to read more. Options simplified !

Had a query around the calculation. Plz let me know if my understanding is right

Stock Maruti

Mean – Daily (-0.089%), 30 day (-0.49%)

Std Dev – Daily (3.13%), 30 day (17.12)

Now say i am calculating range for 30 day @ confidence level 2

SD 2 – 5000 * Exponential (-0.49% +2*17.12) = 5831 upper band

SD 2 – 5000 * Exponential (-0.49% – 2*17.12) = 3263 lower band

Am I going right in the calculation considering the mean is negative value ?

Yes, this is correct.

Thanks that helps understand.

Also when we say VIX it means a plot of the daily SDev of the nifty day closing over what period of time ?

Aditya, vix is the implied volatility of ATM strike. Not sure about the context of SDEV here.

Helpful, will try and read up on VIX

2. Also when u say daily mean is (0.04%) and when you say annualized mean is 0.04% *Sqrt(365) how is this different from daily compounding and annualized compounding in interest rate. I am just a little confused if the 2 work in same fashion

The difference is in the math, volatility is proportional to the sq root of time. Please don’t ask me the math behind, I’m not good at that 🙂

hi sir ,as i was going through the calculations of wipro ltd i am getting a negative mean of daily , weekly and monthly.And when i am applying those value to find an upper and lower range for 1 year it is showing negative numbers for both upper -6% and lower – 84% .

I’d suggest you calculate the log returns, Vishal.

Sir i calculated the log returns but still it is showing negative values for mean ,infact i had put values in your excel sheet which you provided in the course ,in that also it is showing negative values. thank you

Vishal, has the stock trended down continuously? If yes, the returns will show -ve.

okay sir thank you .

Welcome!

How have you calculated this fig:

Daily std deviation/volatility

In last chapter, it’s said volatility aka SD

Is it that volatility for curve refers to 1SD ?

Yes, when we talk about volatility, it usually refers to 1SD.

Sorry, I thought it as division

Ok, happy reading!

hey kartik,

thanks for the content

Btw you could have simply used excel forecast for predicting the range rather than all these tiresome calculation.

Hmm, maybe. But the idea was to explain a few concepts along the way.

sir ,

Can we directly add or minus volatility % which is given on nse website to the spot (nifty ) without considering avg % to get range ?

ex. spot = 10772

volatility =1.88%

upper range =10772+1.88% = 10974

lower range =10772 – 1.88% = 10569

for tomorrows range .

Yup, you can.