# Calculating returns on a stock: different ways?

I am comparing two ways of calculating the total return on one stock over time and I would like to know if they both make sense. When would you use one over the other and do they have specific names?

Let's take a very simple example:

``````buy 100 shares of XYZ for 10,000
sell 100 shares of XYZ => 20,000
buy 200 shares of XYZ for 20,000
sell 200 shares of XYZ => 40,000
``````

Originally, only 10,000 was invested in XYZ. At the end, I end up with 40,000. The gain is therefore 30,000.

1. If I use the `(total sold - total bought) / total bought` formula to calculate the return, I get +100% =`(60,000-30,000)/30,000`.

2. However, if I think of it as I invested 10,000 initially and ended up with 40,000, it's a return of +300% = `(40,000-10,000)/10,000`.

Those are 2 different returns: +100% or +300%!

## EDIT 2017-31-01

The original example might be too simple with just one initial "deposit" of 10,000 at the beginning. The answers were bending towards this specific case of just one initial deposit but I am trying to understand how it works over several transactions and also several "deposits".

Example #2

``````buy 100 shares of XYZ for 10,000 (initial deposit of 10,000)
sell 50 shares of XYZ => 10,000
buy 150 shares of XYZ for 15,000 (had to deposit 5,000 more)
sell 200 shares of XYZ => 40,000
``````
1. `(total sold - total bought) / total bought`

50,000 - 25,000 / 25,000 => +100%

1. `(total sold - total bought) / total invested`

50,000 - 25,000 / 15,000 => +166%

The first formula has an error. If you want to find the total return on your initial investment then you should be dividing by the initial investment, not by the total number of shares bought. It should be:

`return = 100% * (total sold - total bought) / total initially bought`

`100% * (60,000 - 30,000) / 10,000 = 300%`

The second formula is essentially the first formula with the intermediate buying and selling cancelled out.

• Under your implicit assumption of a single time period and no intermediate cash flows, the proper formula is: FV=PV(1+r) which resolves to 40000=10000(1+r) which simplifies to 1+r=4 So r=3 Jan 30 '17 at 22:00
• The original form of the problem is ill posed and so the implicit assumption is dangerous. The timing of the cash flows is unclear and so each cash flow should be treated as separate until it is shown they are not. Jan 30 '17 at 22:02
• So there is no "proper" way to calculate the return without defining the time period? I have been looking at this example: github.com/SimplyWallSt/Portfolio-Analysis-Model/blob/master/… and they don't seem to care about the time periods. Their `Total Capital Invested` seems to be the `total bought`. I added a 2nd example in my post with not only an initial deposit.
– Ted
Jan 31 '17 at 16:39
• I feel there are 2 types of return: the "pure" return on investment and the IRR where periods matter since it is the annualized effective compounded return rate. What do you guys think? Both ways are correct, it's just a different perspective. I was more interested in the "pure" return on investment for now.
– Ted
Jan 31 '17 at 16:43

You did not provide the timing so you will need to make adjustments to what I am writing. If each of these transactions were one year apart, for example, then the sum of the present values should equal zero at the proper internal rate of return. It should solve:

10000-20000/(1+r)+20000/(1+r)^2-40000/(1+r)^3=0.

There is only one solution to this problem, which is 100%, as r=1. Now, if your example were different, such as if the first two transactions were firm XYZ and the second two were firm ABC and you sold XYZ concurrently with buying ABC, then you would solve:

10000-20000/(1+r)+20000/(1+r)-40000/(1+r)^2=0

Although r=1 is still the valid solution, but for a different reason. You cannot solve this problem without a clear definition of timing.

Timing matters. Let us imagine you had 53 days between the first and second transactions and you waited 30 days between the second and third and 800 days between the third and the fourth. The correct solution for DAILY return would be:

10000-20000/(1+r)^53+20000/(1+r)^83-40000/(1+r)^883=0

In this case, the DAILY return is approximately .1678%. To find the annual rate of return you would solve this as (1+.001678)^365, which is 84.4%.

You will have to be careful though, because there could, in theory, be 883 solutions to the problem as there are 883 roots. This is not actually a problem because there will be one root for every time it swaps back and forth between positive cash flows and negative cash flows. There will be 883 roots, but it will work out in the above problem that all 883 are equal to the same number, .1678%. Still, it is possible, in your problem format, to have up to three roots. The simplest solution to plug each root into Microsoft Excel's NPV function and only one of them will create a NPV of 0 dollars.

Doing it this way also allows you to include the impact of dividends and any custodial fees if this were something like an IRA. Every time there is a cash flow, you create a term, no matter why the cash flow happened of A/(1+r)^t, with out flows and in flows having opposite signs and netting out all transactions on the same day.

Response to edit There is only one way to solve it, it is through the internal rate of return, though there is a more complicated modified internal rate of return method, you did not provide additional information so I am assuming it is inappropriate.

You have to include the amount of time that passes to solve this question. If you doubled your money over 100 years or doubled your money in one day, your periodic rate of return would be different depending on how long you decided a period was.

Also note that the number of shares does not matter, only the cash flow matters.

You would have to solve the equation:

10000-10000/(1+r)+15000/(1+r)^2-40000/(1+r)^3=0.

At one year apart, that is roughly a 61% annual rate of return. It simplifies to 2r^3+4r^2+5r=5. You would solve from there. There is no simpler way to do it. Neither formula one nor formula two that you provided are valid. Once you have anything more than a buy and a sell, you cannot use formulas like one or two.

• Is the 2nd method XIRR that allows different time periods?
– Ted
Feb 3 '17 at 22:34