Plotting dividend yield for ETFs
Author: Sammy_G
Creation Date: 7/1/2010 5:31 PM
profile picture

Sammy_G

#1
Can't figure out how to plot the dividend yield for ETFs. I would just like to create a series by adding any dividend(s) received over the past 12 months; this series will be divided by the Close to get the dividend yield (ttm).

I may be wrong but it appears the dividend data inside the ETFs' WLF files is not as a series but as discrete per-share amounts. However, this is even better as one wouldn't have to calculate div/share; its already there in the value. Is there a way to retrieve this info and create a div yield series?
profile picture

Cone

#2
Assuming you're using WLP5, "dividend" is a fundamental item just like any other, so you can access it series for Strategies and plotting just like any other too.

CODE:
Please log in to see this code.
profile picture

Sammy_G

#3
Thanks for the tip, Cone. I am trying to get the dividends paid over the past rolling 12 months (ttm). The closest I have come to that is
CODE:
Please log in to see this code.

But this is not entirely correct as it reports total dividends paid in the past fiscal year, not over the trailing 12 months. Please advise.
profile picture

Eugene

#4
profile picture

Cone

#5
Well, that solution was for data "off the chart", so it doesn't have to be that complicated for past fundamental data.

Use this version of the FundamentalDataSeries signature:
CODE:
Please log in to see this code.


In other words, dividend TTM is just this:
CODE:
Please log in to see this code.

And then you can plot it like any other DataSeries.
profile picture

Sammy_G

#6
Thanks!

One more thing - where is the setting for Indicator decimal places? My WLP5.6 only shows to 2 decimal places, I would like more.
profile picture

Eugene

#7
This setting was purposefully left out (simplification), check out the Symbol Info Manager tool - entering a symbol there will do the job. (More in the User Guide.)
profile picture

Sammy_G

#8
Playing with
CODE:
Please log in to see this code.

I have come to realize that it actually sums the last 4 occurrences of the dividend regardless of the time frame. In other words, if the payments were made quarterly, *only* then will this total equal the amount paid over past 12 months, otherwise it could be any time frame. Many funds pay dividends monthly so there the sum would be over past 4 months.And then there are others like OIH that pay out dividends several times a month so the 4-period frame could be less than a week! Check out OIH, DIA, LQD etc to see what I mean.

Clearly unreliable.

Can you suggest some workaround to calculate the ttm div series while you either fix this in a future release or, better still, create a new function altogether to do this calculation?
profile picture

Cone

#9
Re: Decimals
The next release will provide a preference for price and indicator decimal display.

Re: Workaround
The product design is apparently for U.S. stocks, which have to file 10-Qs (quarterly). Then there are ETFs, ADRs, and whatever else. Anyway, probably the best workaround would be to work with the FundamentalItems list and do the aggregate yourself by date. Otherwise, knowing the ETFs that you trade, you can conditionally program an aggregate value based on the Bars.Symbol (use a switch statement).
profile picture

Sammy_G

#10
Will try to aggregate myself, not hopeful I would get too far. (Hints or pointers to existing scripts would be appreciated.)


But I would like to make the following suggestions:
- The description for FundamentalDataSeries in the help file could be modified to indicate to viewers that a value of 4 for the item may not equal 12 months of data if the item is not quarterly. (The design of this item was probably to calculate ttm values but, as we now know, its based on an assumption of quarterly events that is not always true).
- It would be terrific if a separate item is created, something like FundamentalDataSeriesTTM which would automatically do the calculations for the trailing 12 months w/o the user having to do anything other than specify the fundamental item; this would be like FundamentalDataSeriesAnnual except that it won't be limited to the fiscal year.

Just my 2 cents.
profile picture

Cone

#11
Sorry I didn't remember this before (the memory is the first thing that goes), but we have a solution for you in WealthLab.Rules. For more, see the WealthScript Programming Guide: WealthLab.Rules Classes > FundamentalsRatio

CODE:
Please log in to see this code.
profile picture

Cone

#12
Actually, that method isn't going to work. First because ConvertName("Dividend") converts to "cash dividends". Also, it seems that the method relies on aggregating the dividends for the previous 4 FQs, so it wouldn't work for ETFs, funds, etc.

Separately, I've spent some time looking at a ttm aggregate method, and the truth is that it is not straightforward at all. You have to take into account irregular pay dates as well as those that are mostly regular, but might fall 7 or 8 days earlier/later in the previous year. It will take some work, but it will take time, which I don't have a lot of right now due to other deliverables.

Here's something to work with and improve. It essentially aggregates a TTM as of the last item in the period. It might be what you'd expect, but requires more analysis.
CODE:
Please log in to see this code.
profile picture

Sammy_G

#13
Thank you so much, Cone.

I don't know if you have included this in the code above but an item like dividend is a raw per-share value and needs to be modified for splits that may happen after it was reported. For stocks, one can use the adjustment factor for the divisor but since there is no adj factor for non-stocks (e.g. ETFs), and as we are looking for a solid solution that will work across ALL securities, its best to locate splits directly and then adjust the value of dividend accordingly. I will be happy to share the method I used in WL4 for this; as a WL5 newbie, I don't feel confident that I can port it over reliably.
profile picture

Cone

#14
The code above only attempts to aggregate a fundamental item's value by TTM. It doesn't take anything into account other than that; as I said, I don't have the time required to finish this now, sorry. This really needs to be a WLP enhancement to get it integrated properly.
profile picture

tedclimo

#15
Cone,
Your code posted 7/5/2010 does the job effectively.... but is an elaborate workaround.
My question is, does Fidelity have it on their "to do" list to provide Dividend Yield (for Funds/Trusts/ETFs) in same manner as it does for Stocks & REITS?
In particular, I am concerned with Closed End Funds... 5 symbol examples below.

I just discovered that I was missing numerous Div Yld opportunities b/c symbols like MSY,PGP,NFJ,PSP,VLT, etc show no Div Yld using the standard method shown below
CODE:
Please log in to see this code.

All the while they actually have a 10-13% Div Yld currently.

Thanks in advance for any update you may have.
profile picture

gbullr

#16
Dividend Yield.

Trying to buy when Div Yield crosses over 4 pct lets say. But I have a problem. How do I recognize when there are at least 4 qtrs of dividend data?

Thanks.

also how do I get the Div Yield of SPY as a proxy for .spx meaning how do I bring it in as a part of external symbol.


Thanks.


CODE:
Please log in to see this code.
profile picture

Eugene

#17
QUOTE:
also how do I get the Div Yield of SPY as a proxy for .spx meaning how do I bring it in as a part of external symbol.

Using SetContext/RestoreContext.
profile picture

gbullr

#18
Any guidance on how to ensure that there are 4 instances of the fundamental item so that the ttm calculation makes sense.

Thanks.
profile picture

Cone

#19
CODE:
Please log in to see this code.
profile picture

gbullr

#20
Thank you.