How to check if bar is ex-dividend date
Author: gfparker
Creation Date: 9/15/2009 1:33 PM
profile picture

gfparker

#1
For one of my strategies I need to check if an ex-dividend date occurs on the current bar. Could someone point me to instructions on how to code this?
profile picture

Eugene

#2
See the QuickRef example of FundamentalDataItems for more on topic.
CODE:
Please log in to see this code.
profile picture

gbullr

#3
Help with this concept.

I have been caught short by mistake a couple of times on dividend paying stocks on ex div dates.

Is there something like the in windows method for ex div dates?


Thank you


profile picture

Eugene

#4
Not sure what your problem is, but hope this might help your development:

Morningstar Fundamental Provider: extended Dividend data
profile picture

gbullr

#5
Thanks.

I am trying to not be short when being short will require me to pay a dividend particularly when it is one of those large extraordinary ones which happened to me last year.



profile picture

Cone

#6
It doesn't look to me like Morningstar can help since it doesn't appear to provide future ex-dividend dates. Fidelity's provider does have future dividend information, for example, in the Dow 30:

CODE:
Please log in to see this code.
If you had this info, you just need to use the TradingDaysBetweenDates function in Community.Components to Alert you to liquidate a position the day before an ex-date. (Note that a future date does have a bar associated with it, that's why you have to work with dates for this task - at least for the ex-date in the future.)

Anyway, I don't understand the concern so much about paying the dividend. If you're short for the ex-date, your position will increase in value as the dividend is essentially knocked off the share price at the open.
profile picture

gbullr

#7
I created a dataset w/ one stock from morningstar. Stock is AWI

I copied the code from wealth-labwiki compile (it compiles) and I get the following error when I click AWI

Runtime error: Object reference not set to an instance of an object.
at WealthLab.Strategies.MyStrategy.Execute()


Thanks for help.

profile picture

gbullr

#8
It creates an accounting nightmare!


profile picture

Eugene

#9
QUOTE:
I copied the code from wealth-labwiki compile (it compiles) and I get the following error when I click AWI


It will compile regardless. You don't have the data provider installed and/or haven't updated its fundamentals. I checked on AWI and it works. Nonetheless, it seems that the provider won't help as Cone said.
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).