Adjust For Dividends When Backtesting – Why And How

It’s paramount that you you include reinvested dividends in your backtesting. 

To show you why, we backtested a trading strategy using two different datasets: on dataset not including reinvested dividends and one including reinvested dividends. The difference is huge: the first dataset ended at 554 000 dollars, while the the dataset with reinvested dividends ended at 668 000.

Please also read our backtesting guide if you are new to backtesting. Or if you really want to learn backtesting, you might want to consider our inexpensive backtesting course that includes one trading strategy.

Why include dividends in backtests

When you backtest, a lot can go wrong, so you better make sure you are accurate with the things that you can control.

One of the things you control is to make sure dividend payments are included in the backtest. 

Dividends matter for both long and short strategies:

  • Long positions: if you exclude dividends you are most likely underestimating the returns and performance; while
  • Short positions: you are overestimating the returns and performance because a short seller needs to pay the dividend to the real owner of the shares. 

Thus, you must include dividends.

To show you why it matters, we make a backtest of a trading strategy as a practical example.

Adjust for dividends when backtesting – why

We backtest the same strategy but with two different datasets:

  • S&P 500 cash index; and
  • SPY, the ETF that tracks S&P 500 but has dividends (and reinvestment) included in the dataset.

You must keep in mind that it’s the dividends that are reinvested that matter – not the dividend payment.

We might argue dividends are included in the cash index, but they are not reinvested.

In the dataset we have for SPY the dividends paid out from SPY is reinvested. Because the dividend payments are reinvested, the returns get better because the number of shares snowballs over time.

For the backtest, we used the following trading rules shown below. This is just an example to show the difference between reinvested dividends vs. not, so don’t focus much in the strategy.

  • When the 2-day RSI drops below 10 we buy; and
  • We sell when the 2-day RSI rises above 60. 
  •  

For the cash index of S&P 500 we get an average of 0.49% [er trade from 1993 until today. The corresponding average for SPY is 0.56%.

For many, this might not sound like a lot of difference. But over time, it really does matter.

To show you why dividends matter, please have a look at the two graphs below. The first one is for the cash index of S&P 500:

From 1993 until today your equity grows from 100 000 to 554 000. 

But if you had reinvested the dividends, you would have compounded better and increased your equity to 668 000:

Adjust For Dividends When Backtesting
Adjust For Dividends When Backtesting

That’s a hell of difference, if you ask us, and thus you are underestimating the potential returns if you backtest the cash index and not reinvested dividends.

Some argue it’s not relevant because a lot of traders and investors don’t reinvest the dividends, but we disagree. 

Keep in mind that this is reversed when you are backtesting a short strategy. Datasets without dividend adjustment shows much better returns than you’ll get in real life. The reason is simple: short sellers are required to pay the dividends to the owner they borrow shares from.

How do you adjust for dividends

When a dividend is paid, it’s subtracted from yesterday’s price. 

How do you adjust for reinvested dividends

Reinvested dividends are not paid out, but reinvested, ie. you are buying more shares for the dividend you are entitled to. 

In practice, it looks like this: 

The table above is for Advance Auto Parts, Inc. (AAP). On the 11th of January it paid a dividend, the two last columns is without and with reinvested dividends (the last column). The latter column reflcts, over time, the reinvested dividends. 

Thus, the difference between column 5 (close*) and 5 (Adj close**) grows bigger over time: 

If we go back to January 16th 2018 we see that the close was 113.9, while the adjusted dividend close was 104.44. Todays price is 61.3, and thus the return is -52.6 dollars without dividends, and -43.14 with reinvested dividends (thus better). 

Similar Posts