Navigation: Backtest Engine Details >

Dividend Handling

 

 

 

 

RealTest can account for dividends in two ways:

1. Imported price data can be dividend adjusted

This approach is known as total-return adjustment. Dividends are integrated with the price series by converting them to the equivalent of stock splits.

For example if a $100 stock paid a $1/share dividend, that would appear as a 101:100 split. The split price adjustment compensates for the adjustment in the opposite direction that naturally occurs on each ex-dividend day.

Logically this is equivalent to re-investing each dividend payment by buying more shares.

Here is the sample1.rts example script output after adding Adjustment: TotalReturn to the Import, importing, and running:

Notice that there are no dividend payouts.

2. Prices can remain as-traded, with dividends imported as events

In the above example in an actual brokerage account, that $100 stock would be repriced to $99 on ex-dividend day and you'd be paid $1/share on the payout day. Assuming no other price movement, this transaction would not change your account value.

To model dividend events in this more realistic way, prices can be imported without dividend adjustment. Dividend amounts are imported as events attached to the bar of each ex-dividend date and containing the $/share of the payout.

Here is the sample1.rts example script output with the default Adjustment: Capital (splits only):

Now we see the dividend payouts. Notice that the NetProfit, ROR, and MaxDD are very nearly the same either way.

There will always be slight differences between the two approaches even for an identical set of trades.

In this case there are also some trade differences. In fact most of the entry and exit dates are different.

Trade date differences are caused by the fact that dividend adjustment influences multi-bar indicator calculations. With this example script, the moving average crossovers happen on different dates in most cases.

Surprisingly, these differences mostly cancel out and the results remain very similar. This will not always be the case. It is up to you to decide which approach you prefer.

To display the total of dividend amounts received, uncomment this line in the default Results.rts script:

To see daily dividend amounts (combined and by strategy), uncomment this line in the default Graphs.rts script:

Apply this change, then click on the Dividends button in your Graph window (you may need to scroll the button bar to see it):

Note that dividends are credited to the account equity as mark-to-market gains on the ex-dividend dates.

An open position that receives a dividend may therefore allow a new position in a different stock to be slightly larger than it would have otherwise been.

These dividend credits are not, however, automatically reinvested in new shares in the open position.

 

 

 

 

 

 

Copyright © 2020-2024 Systematic Solutions, LLC