Adjusted and Raw Prices in Backtests with Corporate Actions
Summary
The discussion examines how adjusted and unadjusted stock prices affect backtests, especially cointegrated pairs trading. Adjusted prices can remove artificial jumps from splits and dividends, which helps when measuring returns or momentum. But later adjustments can alter historical price levels and pair spreads, changing which signals appear to have occurred and potentially introducing look-ahead bias. The problem is acute when only one stock in a pair has a corporate action.
The responses suggest handling corporate actions explicitly and matching the price series to the strategy’s purpose: signal inputs may need point-in-time prices, while performance calculations must account for dividends and split-driven changes in shares. One contributor reports excluding pairs with later splits or bonus issues, accepting lower but more dependable backtest results; another describes adjusting holdings and reference levels as the test progresses, while noting unresolved execution issues. Accurate adjustment factors and data quality also matter. The discussion offers practitioner experience, not a settled or universally validated procedure.
Key ideas
- Adjusted prices prevent splits from appearing as ordinary returns or momentum changes.
- Later adjustments can change historical pair spreads and create look-ahead bias in signal testing.
- Corporate actions should be reflected in share counts, reference prices, and realized performance.
- Dividend treatment depends on the instrument and whether income is reinvested.
- Adjustment-factor accuracy and execution assumptions can materially affect results.
Tags
Full text
# Close or Adjusted Prices when Backtesting # Close or Adjusted Prices when Backtesting I've been doing this for some years now, but recently, since I started fiddling around with an old pairs trading strat of mine again, when updating the databases before running the tests, I was thinking about the prices used. I was used to getting all adjusted close prices, dividends, splits, inplits, bonuses, etcs, and just running the strategy with those, but when eyeballing some of those time series and comparing them with the non adjusted series I get directly from the exchange (holy parsing, batman!) I noticed (the obvious) that some stocks are just way way away from their "raw", unadjusted prices and that that could lead to some really big data errors, contaminating the results. I ran across a little white paper where the writer goes along about this issues and I exchanged some emails with some veterans in the industry. The latter told me that they just use adjusted prices for everything on the backtest procedures. I was thinking, isn't it a little bit of a stretch to use adjusted prices for mimicking the execution of the trades? I'm running a plain vanilla cointegrated pairs trading with some bells and whistles on top, and the difference between the two datasets, adjusted and non adjusted is just too big. Would you consider using the adjusted series for in sample / cointegration / signal triggering, and then just using the real raw unadjusted prices at those times? (when triggering a trade, for example) Or would you just use the adjusted ones and that's it? The only part I'm sure here is about not using the raw series in cointegration and signal triggering analysis, too many jumps, gaps, with all the dividends, events, splits, etc. Best Regards ## Answer by Parikshit Bhinde (score 1, accepted) https://quant.stackexchange.com/a/36566 The most important rule of backtesting is to ensure that you do not fall into the 'look-ahead' bias trap. IMHO, while adjusting for splits, bonuses and dividends in regular strategies does not cause look ahead bias, in case of pair trading it does influence the backtesting results. I realised this when using backtesting results of about 750 pairs to choose the best performing pairs and trade them henceforth. Since the spread in pair trading is derived from prices (or log prices), to backtest on adjusted close prices implies measuring profitability of trades in the past that would have actually not been triggered (or best been triggered at different price points) by the strategy. This is especially troublesome when only one of the instruments in the pair has an adjusted close price different from the real close price; that is only one instrument has undergone a split while the other has not. While trading one of the pairs, I realised that profit/loss accrued from the trade as of now (say 23rd Oct 2017) might be very different from the profit/loss generated by the trade as shown in the backtest result carried out on the very same pair using adjusted close prices 2 years from now (assuming one of the stocks undergoes a split before that). In fact I would even go further to say that using the adjusted close prices two years from now in a backtest may not even trigger a signal to enter the trade on 23rd Oct 2017. Hence it is my belief (a reasonable one I hope) that adjusted close prices introduce look-ahead bias into pair trade backtesting. I haven't come across any academic paper or quant site discussing this issue but have experienced while trading myself. It would be nice if you could share the link of the paper that you ran into. To avoid this situation as mentioned above, I select only those pairs that have not undergone splits or bonus issue after the starting point of the backtest period. It yields less profitable but more dependable results. ## Answer by ChrisD (score 3) https://quant.stackexchange.com/a/80918 I've had a lot of experience here. If you are calculating % returns or momentum factors (i.e. price changes over a horizon of days/weeks/months) then you need to use adjusted prices otherwise you pick up large prices changes due to stock splits, etc. if they happen to land in the middle of your horizon, which gives you an incorrect value for change in price. If you are using historical price levels as an explanatory variable in an expected return factor model (i.e. time-varying cross-sectional returns across a universe of stocks), then you should definitely use unadjusted prices as you need point-in-time metrics otherwise you'll be incorporating lookahead bias. I should also add that the adjustment factor needs to be as accurate as possible. I've encountered rounding errors in Bloomberg data that resulted in predictive issues in one of my ML models. 6 decimal places may not be sufficiently accurate! This is where DataOps and MLOps are important - checking the consistency of data (i.e. adjustment factors change -> loss of accuracy -> incorrectly adjusted prices and hence slight differences in ML-based optimised parameters -> causes portfolio consistency problems). ## Answer by berkorbay (score 1) https://quant.stackexchange.com/a/30503 If you are using unadjusted data, you need to do the adjustments yourself. For instance, not too long ago Apple made a 7-for-1 stock split. It would be astonishing if you don't account for it. Then there is the case with dividends as they are discrete in nature. Suppose we are talking about cash dividends as the dividend amount is usually assumed to be discounted from the stock price. If you are trading options, options are not protected against regular dividends and special dividends are decided on a case-by-case basis (at least it is what I remember from reading CBOE guidelines). Plus, if you are trading on indexes such as S&P 500 then it is not a big problem that you take adjusted returns and assume continuous dividends for discounting future returns. Suppose you are trading a single stock (e.g. MSFT). Then you earn those dividends if you are long the stock and pay for dividends if you are short. You should take these into account when calculating your returns. The error gap widens if the dividend paying company is generous in handing out cash. Otherwise, it might not worth the trouble for backtesting. It also has something to do with what you want with the dividends. If you are reinvesting, you can use S&P500 total return index (SPXTR). ## Answer by SwissCaesar (score 1) https://quant.stackexchange.com/a/61890 Eduardo, what did you decide? I think I share your understanding of the dilemma: I for instance am using a 200 day simple moving average to signal when to buy/sell. I add an envelope to the SMA to avoid whiplash. Yet, if I use adjusted prices, I do better if I use a wider envelope than if I used unadjusted. On the surface, it makes sense to use the adjusted prices to calculate the SMA. Yet, the adjusted prices from two years ago reflect dividends that we wouldn't have known about at the time. So in backtesting, I can't replicate the limited information I would have had real time were I implementing the strategy in the past. Specifically, the prices at which a stock is trading today will eventually be adjusted, but for now I don't know to what degree. Would you agree? One thing I realize is that there's much less difference between the adjusted SMA and the unadjusted SMA for the last 200 days than there was for the 200 day SMA five years ago. So I'm leaning toward using unadjusted prices in my backtest because they are closer to the information I would have known at the time were I making a daily decision as to the best trade to make. I'd love to know your thoughts now that you'd have more time to consider. One thought I had would be to trade based on unadjusted prices for now, while at the same time I'd run the alternative strategy in paper money. ## Answer by Praval Shah (score 0) https://quant.stackexchange.com/a/74571 We face the same issue in backtesting our long-only strategy for Indian markets. We have used the unadjusted price for signal generation and the adjusted price to calculate the performance. Example - Long A (Stock) -> A undergoes a 3-1 split(Signal from a separate Corporate action database) -> We adjust the relevant data points for stock A (52-week High, Low, CMP, purchase price, number of outstanding shares, number of shares in the portfolio) -> Exit A This happens on an ongoing basis as the algorithm traverses from the beginning of the testing period till the end. We are still facing execution issues so we wouldn't guarantee the results with this approach.
Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.