0
$\begingroup$

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

$\endgroup$
  • $\begingroup$ Which numbers would your strategy be using when released into the real world? Would a raw price actually be realised? Or would it be reversed/altered before you can act on it? $\endgroup$ – will Oct 9 '16 at 16:42
  • $\begingroup$ Hi there! Thanks for the reply! In the real world I always used back adjusted prices with all included dividends, splits, etc. Then I traded on the real prices in real time, when the trades were triggered (using the adjusted time series for the signal generation). The thing is, when backtesting, I don't have the "real prices of real time" at the time of the triggering of the trade. I can only choose to use the adjusted, or the raw unadjusted ones. $\endgroup$ – Eduardo Gonzatti Oct 9 '16 at 16:45
  • $\begingroup$ All I'm saying is that you need to run your back testing on the same thing it will be running on when it goes live. Of you can't, then you need the closest to it you can get. If you don't have equivalent data to what you're going to run it on when live, then what does your back test really represent? $\endgroup$ – will Oct 9 '16 at 16:48
  • $\begingroup$ @will I agree, but when one doesn't have the exact data, which one would be more correct? I honestly don't know if using raw prices for triggering trades and adjusted prices for modeling (what I'm doing now) is the best way to be as close to the real world as possible. To do it correctly I'd have to get all the events that occurred to each specific stock and then adapt it in a rolling window of some sort, as the backtest goes by. That is, unfortunately, not an option.. $\endgroup$ – Eduardo Gonzatti Oct 9 '16 at 16:51
  • $\begingroup$ Do you have any sets at all where you have both to compare? Or nothing at all? What would happens you were to run your algorithm and it encounters a price that gets adjusted? Would you actually realise it? I guess that's the important question. $\endgroup$ – will Oct 9 '16 at 16:52
0
$\begingroup$

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.

$\endgroup$
0
$\begingroup$

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).

$\endgroup$
  • $\begingroup$ Thanks for the reply, @berkorbay, I agree with everything you said. The only difference here in my country is that when trading options you get the premium adjusted after the underlying stock pays off dividends or whatever, but that's not the case here. I'm trading stocks against stocks, so it does make a difference in time, if I'm getting the adjusted time series, today, from 2012..today, I'd get prices in 2012..2013..who are way away from their "raw prices" at that time.. The question is : which one is closer to the real world? Using these back adjusted series for modeling and triggering $\endgroup$ – Eduardo Gonzatti Oct 11 '16 at 12:13
  • $\begingroup$ And then using the unadjusted (raw) prices for execution of the trades (everything in backtest here) , or using the adjusted time series for every step of the procedure? $\endgroup$ – Eduardo Gonzatti Oct 11 '16 at 12:16
  • $\begingroup$ @EduardoGonzatti it shouldn't matter as you are using the adjusted series for calculating the logreturns (or returns) and "fitting" parameters for your model (or strategy). Then, for out-of-sample estimation you can use the raw data as long as you take dividends and splits into account. The main problem of adjusted returns is they take dividends out of the process and it has an effect on your P&L. $\endgroup$ – berkorbay Oct 11 '16 at 12:47
  • $\begingroup$ I agree, but the thing is, I only have pure raw unadjusted prices and fully adjusted prices, nothing between those. So I'll be suffering from the risk of taking a trade in the out if sample part, and not taking the dividends or whatever events into account, when using unadjusted prices. More than that. Those prices, which are prone to jumps because of the unadjustments can trigger stop losses, or take profits that don exist, even "take profits" that are actually a loss in PNL.. $\endgroup$ – Eduardo Gonzatti Oct 11 '16 at 12:53
  • $\begingroup$ @EduardoGonzatti If you are covered for the dividends as you said earlier. Use adjusted prices to calculate logreturns and use unadjusted prices for $S_0$. It seems like the most convenient way. $\endgroup$ – berkorbay Oct 12 '16 at 13:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.