PlotFundamentalItems using a custom set of values
Author: thodder
Creation Date: 1/14/2011 1:07 PM
profile picture

thodder

#1
In the book "Swing Trading" by Jon D. Markman, Phil Erlanger liked to create a short interest ratio to show sentiment.

I've been able to create the short interest ratio as a series (see code included), but I'd really like to show it on the charts as a fundamental item; however the method PlotFundamentalItems doesn't allow for a container to be passed as a parameter. Is there a way I can plot this ratio like fundamental items?
CODE:
Please log in to see this code.


The calculation in this example is done against a DataSeries, but I could redo the calculation on a "List<FundamentalItem>" instead if PlotFundamentalItems would allow that to be passed as a parameter.
profile picture

Eugene

#2
Creating and utilizing FundamentalItems requires that you develop a fundamental data provider (e.g. our "MSN Fundamental Data for Securities" and "YCharts Fundamental/Economic Data" providers). Unfortunately, no example exists and Fidelity doesn't provide any documentation.
profile picture

thodder

#3
I was looking for a way to treat fundamental data similar to a data series, but plot it is fundamental data:

1) Modify the existing "short interest" into a ratio with the calculation: short interest divided by 12-month average daily volume.
2) Plot the result as fundamental data (using PlotFundamentalItems style) instead of as a series (PlotSeries style).

I guess this isn't available at the moment. It appears to do a calculation against fundamental data and plot the result, it is best to do what I did above and treat it as a series.
profile picture

Sammy_G

#4
thodder, have you considered using 'days to cover' or 'short interest as a % of shares outstanding' if that's what you are trying to calculate?
profile picture

thodder

#5
Sammy G,

Both "days to cover" and "short interest as a % of shares outstanding" look like great sentiment data to use in a script; however, I was trying to calculate something slightly different. I was trying to calculate a ratio that Phil Erlanger used in the book mentioned above. I was thinking about comparing Phil Erlanger's method to the ones you mentioned to see which appear to give better signals for trading.

I believe I got Phil's calculations in the script above, but I had to do it as a DataSeries. I would have liked to plot it using PlotFundamentalItems (instead of PlotSeries) to show when the short interest changed, but I ran into two issues:

1) it was tough to do calculations against FundamentalItems (versus a DataSeries);
2) there didn't appear to be a version of PlotFundamentalItems that could take a custom container.

I thought it would be nice to be able to do calculations with FundamentalItems similar to a DataSeries. I guess it was more of an example of a feature I wish WLP had. For trading purposes, the series (my example above) should be fine.

Thanks!

-- Tim
profile picture

Cone

#6
QUOTE:
I thought it would be nice to be able to do calculations with FundamentalItems similar to a DataSeries. I guess it was more of an example of a feature I wish WLP had
What's wrong with the features of the FundamentalDataSeries and FundamentalDataSeriesAnnual funcitons that return DataSeries that you can use "to do calculations with FundamentalItems similar to a DataSeries"? Voila.
profile picture

thodder

#7
Yes, they work well. I'm probably being picky. Mainly, I thought it would be nice to plot as fundamental values instead of a series so you could see exactly when the short interest changes, but I could not see a way to use the PlotFundamentalItems method with my custom calculation.

There are some weird values that show up in the series with the calculation:
CODE:
Please log in to see this code.

since the "short interest" changes mid-month while the Volume 12-month average changes at the beginning of the month. I could fix this with a custom for loop to only do the calculation for the ratio when the "short interest" changes instead of the one line of code above.

It works good enough. I believe "days to cover" or "short interest as a % of shares outstanding" would work better than this custom ratio anyway.
profile picture

Cone

#8
If you plot Short Interest next to your calculation that uses it, then you'll know when it changes. Maybe it's not as pretty as you'd like, but if you were really motivated, you could create a routine that plotted rectangles, just like PlotFundamentalItem does.
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).