How Yahoo Calculates the Adjusted Closing Price
For calculating adjusted prices, there are commonly two kinds of adjustments to consider -- stock splits and dividends. Stocks splits are straightforward. Since a stock split doesn't change the intrinsic value of the company, you recalculate historical per-share data (like stock price) to reflect the latest number of outstanding shares. Everyone seems to agree on how to do that, but adjusting for dividends is a different story.
There are situations where you may or may not want dividend-adjusted prices. For example, using adjusted prices makes it much easier to calculate the rate of return for a long-term investment (a stock held for years) since dividend payouts are folded into the adjusted prices. However, percentage profit and loss calculations of a short-term trade could be skewed by adjusted prices. That most likely wouldn't matter much for a trade happening right now, but it could profoundly affect backtesting results, especially for time frames that were years ago. So depending on your objective, you will need to decide whether or not you want to use dividend-adjusted prices and what kind (more below).
Not all charting sites adjust their charts for dividends. For example, StockCharts.com adjusts for dividends, but BigCharts.com and Prophet.net don't. Interestingly, Yahoo charts don't adjust for dividends, but Yahoo historical prices do provide a single adjusted closing price that includes both splits and dividends. Yahoo's technique for calculating the adjusted closing price looked a bit strange to me when I first saw it. I was expecting the dollar difference between the actual close and the adjusted close to stay the same for stocks that never split. But that's not how they do it.
There are two general approaches on how dividend adjustments are calculated. The first approach, described in this Investopedia article, is simply to subtract the dividend out of the stock price going back to the IPO and adjusting the dividend adjustment for stock splits along the way. It's as if the dividend never existed in the company. This approach is simple and gives accurate absolute profit and loss numbers when calculating the return from holding a stock long-term, over several dividend distributions. But there is a problem -- due to the effect of inflation, it's possible that the dividend adjustment will cause some adjusted historical prices to go below zero. Once that happens, percentage rate of return numbers are trickier to calculate, and negative stock prices in general don't make sense intuitively.
The second approach involves calculating adjustments in percentage terms instead of absolute dollar value. Yahoo uses this type of approach for its adjusted closing price. It avoids the negative adjusted stock prices but as a result skews profit and loss calculations. There is probably more than one way to apply percentage adjustments, so depending on the exact technique, results would vary. I looked closely at Yahoo's adjusted prices and came up with what I believe is their formula. Here it goes..
Yahoo's adjusted close calculation goes like this:
- For the latest available trading day, the actual closing price and the adjusted closing price are the same. (Base case)
- For every other day ("today"), determine what percentage today's closing price is over yesterday's closing price, excluding the effect of a dividend and/or a stock split, if today is the ex-date.
- You calculate yesterday's adjusted close as being the same percentage down from today's adjusted close as the percentage calculated in step 2.
- Repeat steps 2 and 3 for all other historic days.
A-1 = A0 + A0( ((P-1/S) - P0 - D) / P0)
- A0 is today's adjusted price. A-1 is yesterday's adjusted price.
- P0 is today's actual price. P-1 is yesterday's actual price.
- S is the split ratio, if today is a split ex-date. For example, a 3-to-2 split means S is 1.5. S is 1 if today is not a split ex-date.
- D is the actual dividend, if today is a dividend ex-date. D is 0 when not a dividend ex-date.
I ran a couple spreadsheets using that formula and was able to calculate exactly the same adjusted closing prices that Yahoo has. Great! Now I can use the same formula to get adjusted prices for the open, high, and low prices. Then it's onward to building more advanced technical analysis screens!