## 6.1 – Overview

This is off topic – but a little digression hurts no one, I guess. Of all the chapters I have written in Varsity, I guess this one will be a very special one for me. Not because of the topic that I will be discussing. It is because of the place where I’m sitting right now and writing this for you all. Its 6:15 AM – surrounding me 360 degrees are misty mountains; the landscape I guess cannot get any better. There is only one shack here with a little music player, playing Bob Marley’s Redemption Song. Can it get any better? At least not for me I guess 🙂

Anyway, back to school ☺

We discussed Portfolio Variance in the previous chapter. It would be pointless to crunch all the numbers to extract the variance of the portfolio, unless we put that to good use. This is exactly what we will achieve over the next 2 chapters.

Over the next 2 chapters, we will try and do the following –

- Discuss Equity curve and an alternate method to calculate portfolio variance
- Estimate the portfolio’s expected returns over 1 year
- Optimize the portfolio for maximum returns and minimum variance

Note, this chapter is a continuation of the discussion panned out in the previous chapters. You need to know the context here. If you are reading this chapter without knowing what happened over the last few chapters, then I’d suggest you go back and read those chapters first.

## 6.2 – Equity Curve

** **We will use this opportunity to develop an equity curve for the 5 stock portfolio that we have. In a very lose sense, a typical equity curve helps you visualize the performance of the portfolio on a normalized scale of 100. In other words, it will help you understand how Rs.100/- invested in this portfolio would have performed over the given period. You can further use this to benchmark the portfolio’s performance against its benchmark – say Nifty 50 or BSE Sensex.

There are certain attributes which can be extracted out of the equity curve to develop deeper insights on the portfolio. More on that later.

Let us proceed to build an equity curve for the 5 stock portfolio. Remember, we had the following stocks and we also assigned random weights to these stock to form our portfolio. Here are the stock names along with the weightages –

Stock Name |
Investment weight |
---|---|

Cipla | 7% |

Idea Cellular Ltd | 16% |

Wonderla | 25% |

PVR | 30% |

Alkem | 22% |

So what does ‘Investment weight’ means? – It represents the percentage of your corpus invested in the stock. For example, out of Rs.100,000/-, Rs.7,000/- has been invested in Cipla and Rs.22,000/- has been invested in Alkem Lab. So on and so forth.

While developing an equity curve, the usual practice is to normalize the portfolio for Rs.100. This helps us understand how an investment of Rs.100/- in this portfolio behaved during the period of investment. I have incorporated this in the excel sheet (please note, the excel used here is a continuation of the excel used in the previous chapter)

Have a look at the image below –

I have introduced a new column next to the daily return column and included the weight of the respective stock. At the end, you will find two new column being introduced – starting value pegged at 100 and total weight at 100%.

Starting value – this is basically the amount of money we are starting with. I have set this to Rs.100/-. This means, out of the 100 Rupees in total corpus, Rupees 7 is being invested in Cipla, Rupees 16 in Idea, Rupee 25 in Wonderla so on and so forth.

Now, if I add up the individual weights, then they should all add up to 100%, indicating that 100% of Rs.100 is being invested.

We now have to see how the investment in each stock has performed. To help you understand this better, lets take up the case of Cipla for now. The weight assigned to Cipla is 7%, which means out of Rs.100, Rs.7 is invested in Cipla. Based on the daily price movement of Cipla, our money i.e Rs.7/- either increases or decreases. It is important to note that, if on day 1, if Rs.7 becomes, Rs.7.5/- then the following day, our starting price is Rs.7.5 and not Rs.7/-. I’ve done this on excel for Cipla, and this is how the calculation looks.

On 1st Sept, Cipla was trading at 579.15, this is the day we decided to invest Rs.7 in the stock. I understand that this is technically not possible, but for the sake of this example, let us just assume this is possible and proceed. So on day one i.e 1st Sept, 7 is invested, on 2nd Sept Cipla closed at 577.95, down -0.21% from the previous day. This also means we lose -0.21% on our investment of Rs.7/- making it Rs.6.985. On 6th Sept Cipla shot up by 0.11% to 578.6, hence we gain 0.11% on 6.985 to make it 6.993. So on and so forth the rest of the data points.

I’ve done this math for all the stocks in portfolio and here is how the table looks –

I’ve calculated the daily fluctuation in the invested price across all stocks and I;ve highlighted the same in blue.

Now, think about what is happening here – I’ve basically split Rs.100/- across 5 stocks and invested in different proportions. If I sum up the daily variation in each stock, I should be able to get the overall daily fluctuation of Rs.100, right? Doing this gives me the overall perspective on how my portfolio is moving. Let me add these up and see how Rs.100 invested across 5 stocks moves on a daily basis –

Adding up the values on a daily basis gives me the time series of the daily fluctuation of the portfolio.

An ‘Equity Curve’ (EQ curve) can be developed if you plot the chart of this – i.e the time series data of the daily normalized portfolio value. I say normalized because I’ve scaled down the investment to Rs.100/-.

So, here is the EQ curve for the portfolio that we have –

As easy as that. Eq curve is a very popular way of visualizing the portfolio performance. It gives a quick estimate of the returns generated by the portfolio. In this case, we started with and investment of Rs.100/- and at the end of 6 months the portfolio was valued at 113.84. Have a look at the image below –

So without much thinking, I know the portfolio has done close to 13.8% during the given period.

## 6.3 – Portfolio as a whole

Now, here is something I’d like you to think about. In the previous chapter, we calculated the portfolio variance. While doing so, one of the key things we had to calculate was the standard deviation of each stock. Standard deviation as you may know, represents the volatility of the stock which is nothing but the risk associated with the stock.

To calculate the standard deviation, we used the inbuilt excel function ‘=STDEV()’ applied on the daily return of the stock. Now, think about this – we anyway have the daily value of the portfolio (although normalized to Rs.100).

Now imagine the portfolio itself in its entirety, as a whole, as a single stock, and calculate its daily returns. Just like how we calculated the daily returns of the stocks in the previous chapter. Further, what if I apply the ‘=STDEV()’ function on the portfolio’s daily return? The resulting value should be the standard deviation of the portfolio which in other words should represents risk also called as Variance of the portfolio.

Are you able to sense where we are heading? Yes, we are talking about calculating portfolio variance using a different approach all together ☺

To help you comprehend this better, let me paste the portfolio variance value we calculated in the previous chapter,–

We calculated the above value using the matrix multiplication and the correlation matrix technique.

We will now look at the portfolio as a whole and calculate the daily returns of the normalized portfolio value. The standard deviation of the portfolio’s daily returns should yield us a value equal to or somewhere near the portfolio variance calculated previously.

I’ve included a new column next to the daily normalized portfolio value and calculated the Portfolio’s daily returns –

Once I have the returns in place, I will apply the standard deviation function on the time series data, this should yield a value close to the portfolio variance value we previously calculated.

So there you go, the STDEV function gives us the exact same value!

You can **download** the excel sheet used in this chapter. In the next chapter, we will use the portfolio variance to estimate the expected returns along with optimization.

Quick Task – I’d like to leave you with a quick task here. We have assigned random weights to the stocks. Go ahead and change the weights of the stocks and see the impact on the overall returns. Do share your observation in the comment box below.

### Key takeaways from this chapter

- An equity curve is a standard way to visualize the performance of a portfolio
- A standard industry wide practice is to normalize the portfolio to a starting investment value of Rs.100/-
- We assign weights and the respective investment to each stock
- We need to calculate the daily change in investment value in each stock
- The sum total of all the variation in each stock adds up to the variation of the entire portfolio
- The graph of the change in daily prices of the portfolio yields the equity curve
- We can look at the portfolio as a whole, as a single stock and calculate its SD
- The SD of portfolio also yields the portfolio variance

Dear Karthik,

What if Quantity of Shares (i.e. Weightage %) is not constant, due to additional buy/ reduction by sell in any scrip?

Also what if we add/remove any scrips from portfolio in between?

How to take care of that while calculating the portfolio variance?

Thanks 🙂

Ah, good point. When you add remove shares, your weightages in each stock changes and you develop the EQ graph in the routine way. Anyway, will try and put out a supplementary note on this sometime soon.

Thanks a lot Karthik. Your webinars are also awesome. Zerodha Varsity is great source of knowledge for a novice like me. The subject is so vast and there is so much to learn, but the way you are feeding us spoon by spoon, it makes things simple and easy to grasp. I am really greatful to you.

Thanks once again 🙂

Hey, thanks for the kind words, Santosh. Its still a long way to go for all of us at Zerodha 🙂

Happy learning.

hiiii sir im krishna saud

palan

Great to meet you, Krishna!

The first is question – Where is that blissful place ? 🙂

Somewhere in the North East of India 🙂

Hi, Nice chapter!! Well I would like to know how to manage risk while trading in Commodities Derivative and about commodity position sizing, hedging position!!

Will that be covered in coming chapters, Sir??

Yes, we are currently discussing risk from a portfolio perspective, we will soon move to single and muti leg futures position.

Dear Karthik,

Well Karthik all your classes are just equivalent to gold like me. Wonderful Job Karthik, One doubt.. when i have done the Portfolio SD its coming 1.12% instend of 1.11%. You have mentioned the formula in ur excel file as “_xlfn.STDEV.P(R5:R130) didn’t understand this formula. What’s the problem if we give the formula stdev(R5:R130) which comes to 1.12.

Awaiting the doubt to get cleared.

Regards,

Sonjoe Joseph

‘=STDEV()’ is a excel function, behind which is the mathematical formula to calculate standard deviation. 1.12% is good, I guess minor decimal difference. Are you doing this on the same portfolio?

Yes i’m doing on the same portfolio.

Good luck!

Sir,

I have tried the above exercises but I am facing a problem. The the result of STDEV which has been calculated here is nowhere matching my portfolio variance. Also, since the SD would anyway vary with the changing weight of each share, how would the Stdev. then always match the portfolio variance ? BTW I am not using the above portfolio, I have developed a portfolio of my own. AND a TON of thanks for creating such a great resource :-).

Abhas, if it’s a different portfolio, then the values will not match with what we have here. Btw, the portfolio variance won’t vary drastically on a day to day basis.

Respected Sir,

Gratitude !!

This module seems like a boon for (neophyte) Investors. Unfortunately, I categorize myself as a Trader (my trades range mainly 0-6 days or so). I understand that it is valuable for both Investors & Traders, depending upon one’s ability to retrieve useful info from data for one’s use. But, a novice like me would like to have some clarity of ‘Risk Management’ section from a Trader’s perspective as well. Also, I wonder if ‘Trading Psychology’ section of this Module will also throw some light on psychology of a trader.

My experience –

Few years ago, I was apprised by a broker to put orders at, say, 189.95 instead of 190, or at 150.05 instead of 150. Nothing technical, he told some pure psychological reason (do not remember now) leading to a special order picking behavior in market depth. Later I browsed a lot but couldn’t figure this out. I wonder if such psychological scenarios exist. If yes, will these be included in this module? Or please provide any reference/ books for such insights that one (otherwise) learns from one’s experience only.

By the way –

Graph of typos has been above its 20DMA for last 2-3 Modules. It has formed Bullish Marubozu in last two chapters consecutively. I guess it’s better to go Long on spell&grammar check tool, like Ginger, to crash such trends in few seconds. Sorry for pointing it out.

–

Coming soon in the awesome world of Zerodha 🙂 🙂

–

Regards

James

Thanks pointing this out. I understand the grammar and typos – there are way too many. I’ll probably use one of thoes tools.

Anyway, I too use figures like 189.95 instead of 190 – I’ve observed the fills are faster. As of now the module’s focus is risk management from portfolio perspective. Will soon shift to the traders perspective.

Ohh !! Thanks a lot. I would be highly glad & obliged to see more such (traders’) psychological tricks in this module so as to understand their mechanism insight – how these works. By the way, is/are there any book(s) for same??

Question – You have described two methods of return calculation in excel — ‘=ln(c3/c2)’ and ‘=c3/c2-1’. Which one is more practically preferable?

Thanks in advance

Best Regards

There are are quite a few books on this topic, unable to think of one though. Will keep you posted.

For more than 2 year of data, I’d suggest you take the ln returns, otherwise regular rt should be alright.

Thanks a lot.

Welcome!

Hi Karthik,

I am eagerly waiting for next chapter(s).

I also request you put a module on financial modelling.

Thanks ☺

Financial Modelling is next module, next chapter will be up this week.

Hi! Any update on when the supplementary note regarding ‘how to consider portfolio variance and maintain equity curve when shares are reduced or new shares are bought’ will be updated? Eagerly looking forward to learn from it. Thank You!

Check this – http://zerodha.com/varsity/module/trading-psychology-and-risk-management/

Sir, can you please tell me how to draw the equity curve in excel. I have completed rest of the work very similarly and perfectly but i am unable to chart the equity curve. I guess there is some problem with axes. It would be great if u can help me out. Actually i am a newbie in excel

Thanks in advance sir.

Can you tell me where exactly you are going wrong?

The axis which is supposed to hold the values from 120 to 80 is not there as i am charting. The values are coming from 0 to 100. The axis with time is fine. And because of this the eq. Curve that I am getting is a flat line at 100. What can I do to fix it?

And also sir, my portfolio variance is coming at 1.40% how am i supposed to interpret it?

Port variance of 1.4% is alright. However, I’m unable to figure out the exact problem. I have explained this step by step, can you please try doing this again?

Sir, in the charting of normalized equity curve X axis which contains the time is alright, but the Y axis which contains the values(in your chart it is 80-120) is not alright. It is coming from 0-100, and because of this the equity curve is like a straight line at 100. How can I fix it?

If you are getting the fixed value as hundred than I suspect you have not linked the portfolio values properly. You need to calculate the daily returns and then link it to the normalized values.

sir, it’s my humble request to please tell how to select stocks for portfolio for a beginner? i am newbie here and read tech. and fund. analysis, but still can’t find.. please help? how should i select a company to invest?

I;d suggest you take a look at the Fundamental Analysis module here – https://zerodha.com/varsity/module/fundamental-analysis/

Hii..you should compile a book of all these chapters..awesome teacher you are..could you please tell me how to download these chapters ..so that i can read them at my ease..i am not able to find download option like it was there before.

Thanks for the kind words, Mahek.

The download option is right below the module page where all the chapters are listed. However, the PDF for this one is not up yet. That will be available in over 15 days.

I m new to stock market and learn everything on zerodha varsity. Thank you guys for making this very simple.

U guys are doing awesome work.?

Happy learning, Manish!

Karthikji,

I have a doubt. We are calculating Variance of portfolio based on which we will can have an educated guess of expected returns.

I am not able to understand the timeframe for it. When do we realise the returns?

When do we do the trade?

Because the data goes on changing everyday thereby changing the returns.

A newbie here!

I need a bit more clarity on your question, Sanjay.

1) What do you mean by realise the returns? Are you talking about the look-back period?

2) Depends on the trading strategy itself.

What I mean is, we have calculated the variance, we also know the min. & max. expected returns using Variance.

I want to understand at what point or what should be the trigger so that I’ll sell my shares and book profit which will be hopefully in the range as calculated above.

The trigger could be any portfolio event – for example, a drawdown of 10% at a portfolio level.

Can we check the equity curve and variance of our portfolio directly from Zerodha ?

No, we do not have this feature yet on our Platform.

Is the portfolio variance value equal to the beta of the portfolio??

Hmmm not really, although both are somewhat a measure of risk.

Im waiting for the part in risk management – Hedging with Options.

Ah, I missed it again. Will add that as a separate note one of these days.

Dear Sir

Portfolio Variance calculation by VC Matrix and Equity Curve standard deviation method comes slightly different values. In my case it 0.10% Why so? Please explain.

Not sure, Sougata. Maybe a rounding off error? Can you check and reconfirm?

Greetings!!! Karthik,

First of all Thanks for sharing the In dept details on how to Manage our Portfolio. Coming to the point, there is a difference in my Portfolio Standard Deviation (3.71%) and Portfolio Variance (2.46%) though i am carrying 3 Stocks in my Portfolio. Let me know how to adjust the same.

Thanks

Ah, I need to see the excel for this.

Hi Karthik,

Let me know where to sent, i hope you have my mail id.

Thanks!

Beta of a stock we know, Beta of a portfolio can be calculated by weight of stocks and average ? This is right approach ? Instead of calculating so many value as discussed in chapter, will it help?

Beta of the portfolio is the beta of individual stocks times the weight of the stock in the portfolio, all summed up. Or you can quickly calculate the equity curve of the portfolio and check the beta of the equity curve.