Errors in Dogs of the Dow strategy
Author: Sammy_G
Creation Date: 7/4/2010 3:43 PM
profile picture

Sammy_G

#1
There are mistakes in the Dogs of the Dow rotation script.

1. Yield calculation
It is wrong. For starters, since yield is expressed as a %
CODE:
Please log in to see this code.
should be changed to
CODE:
Please log in to see this code.


Secondly, the function
CODE:
Please log in to see this code.
is being miscalculated. It uses the fundamental item "cash dividends"; this is wrong as this item not only includes dividends paid on common shares but a number of other items as well (see the fundamental data guide, pg10). A much better calculation is:
CODE:
Please log in to see this code.


Note: While this modification is better than the original, it still has a limitation - namely, one is aggregating last 4 instances of dividends/share; while many stocks pay dividends quarterly and aggregating 4 values will equal dividends paid over a year, this may not always be true as a company may pay dividends more than or less than 4 times/year; in that instance, this would give incorrect results. The correct way would be to aggregate dividend/share over the last rolling 12 months (since I am a newbie to WLP5, I haven't figured out how to do that - yet). Notwithstanding this caveat, the code I have given above is still *much* better than the original. As an example, you can check the values for American Express; the original code gives the dividend per share as 0.19 and the yield as 0.00 (its only till 2 decimal places) whereas with the mods suggested above you get the values of 0.72 and 1.83, respectively (as of bar dated 7/2/10). Compare that with Yahoo website at: 0.72, 1.80% (Yahoo rounds off the 2nd decimal place).

2. Bar loop
Since we are aggregating dividend data over the last 12 months, I would imagine the loop should start after 1 year, not at bar 1.
profile picture

Cone

#2
Thanks for your observations.

Re: Yield
100 is a scaling factor and can't change the results for this script. also note that the % yield is displayed in the Entry signalName in the Trades list. Anyway, this can be changed so that that yieldSeries plot is better scaled too.

Re: CashDividendsPerShareSeries
You're correct.
The bad news is that I don't see a way to incorp the WealthLab.Rules.FundamentalsRatio method to aggregate ttm for external symbols, which is necessary for a rotation script like this. (The method only looks at "this" Bars.) It looks like I'll have to come up with a custom aggregation method and/or lobby to add a FundamentalDataSeriesTTM function to WealthScript.

Re: Bar loop
Take note of the comment in the code /* Do the processing on the last trading day of the year */
The loop starts at bar 1 so that it uses all the data possible no matter where the user starts the data load.
profile picture

Sammy_G

#3
Do the best you can, Cone. While awaiting the "rock solid" version incorporating a true TTM dividend yield series, you can still post the modified version of the script for users' benefit.
====================================

A question on the side: WL4 had a study named Fundamental Data Ratios Library, which users could review and modify (if needed), that was the basis for fundamental ratios used in the program. Is there something similar in WL5, and of so where is it? Or is it all "hard coded"? - stored in a DLL or other file? - and how can I open that file?
profile picture

Cone

#4
I don't want to make a half revision when another revision is required. "Dogs" isn't really a good Strategy to be using in a secular (and soon-to-be-cyclical-again) bear market anyway, so there's no hurry. imho, those yields are on their way up, but not due to rising dividends. (Actually, I think the Russell 2000 is already 20% down from the recovery high = cyclical bear)

Re: "Fundamental Data Ratios Library", in the other thread I gave you the reference to its v5 counterpart in the Programming Guide. All .NET references like this come in the form of DLLs. (The term "hard code" roughly means "not flexible to input", which isn't the case of a method in a DLL.)
profile picture

Sammy_G

#5
I think its a decent strategy to trade in all types of markets. With a few mods, of course.

Ciao.
profile picture

Cone

#6
I think I've got a simple and accurate solution for this now. Look for "Dogs.. [Rev A]" in Strategy Downloads (.. as soon as I can figure out how to get it approved.. Eugene, help!)
profile picture

Eugene

#7
Done.

But in general, our webmaster needs to apply the fixes ASAP.
profile picture

Cone

#8
Thanks Eugene.

Also, there's a way to fix the original script as follows:
CODE:
Please log in to see this code.
There are expected differences from Rev A. and the original script with these changes because the yield is calculated differently and at different times. Rev. A. calculates yield based on the the actual cash dividends paid in the prior 12 months, where as the FundamentalsRatio.YieldSeries method is based on the last quarterly report's "cash dividends" item. In my view, Rev A. is more accurate (and gives you 4 extra years of testing.
profile picture

Sammy_G

#9
Thanks for the revised script, Cone.
It was a dog-gone good idea to add the filter to exclude one-time large dividends.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).