Note: Please read the disclaimer. The author is not providing professional investing advice.
If you’re using historical data to perform backtesting of trading algorithms it is important that your data be transformed from actual to effective historical prices. Otherwise your algorithm may, for example, interpret a 2:1 stock split as a 50% overnight drop.
Luckily if you’re using Yahoo! Finance as your source for historical data they provide an easy way to account for such issues. Yahoo has a short write-up about this, though in my opinion it falls a bit short. Therefore I’ll provide an example here.
The process of normalizing the data is simply to take the ratio between the stock’s “Adj. Close” to “Close” and apply it to all prices – that is the raw High, Low, Open, and Close.
For example, consider the following output from Yahoo’s historical database:
|1-Dec-06||3:2 Stock Split|
If for each entry of each row (besides volume) we multiply by the ratio of that row’s Adjusted Close to Close, we get the effective historical prices:
For example, we compute the effective Open of the 30-Nov-06 row by multiplying the original value, 45.51, by 30.31 / 45.47 resulting in 30.34.