Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 1/14/2006 Posts: 436
|
I am trying to create an indicator that will generate the next anticipated earnings date for a stock, in terms of days in the future, and display it in a watchlist column. I think I have a workable approach, but I need some programming help.
The starting point is the Earnings 1-yr indicator on a weekly graph (note, using a weekly chart is important, it wont work on a daily chart). Then create a 1 period "rate of change (net)" child indicator. Then generate a combined condition with 1) rate of change moving up, or 2) rate of change moving down. This creates a spike graph, with a spike every 13 weeks or so. That part is easy.
Now I need some help to take the latest spike (most recent Earnings Event), find its date, add 13 weeks to that date to generate the next anticipated Earnings Event, then find the difference between the current date and the next Earnings Event in days, and then display that as an integer in a watchlist column. If the number is small, I know the next EE is pending. If the number is near 90, I know the next EE will be several months away.
If someone can figure out a simpler or more accurate method, that would be fine as well.
Thank you
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:Next Earnings Date
'|******************************************************************
'# Earnings = indicator.Library.Earnings 1-Yr
'# Cumulative
Static CountDown As Single
If isFirstBar Then
CountDown = Single.NaN
Else If Earnings.Value <> Earnings.Value(1) AndAlso _
Price.DateValue = Earnings.DateValue Then
CountDown = 63
Else
CountDown -= 1
End If
Plot = CountDown
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 1/14/2006 Posts: 436
|
Bruce - Thanks, that worked pretty well.
|
|
Registered User Joined: 6/5/2010 Posts: 27
|
Bruce,
I have applied this to my charts, and the indicator portion appears to work well, but when used as a watchlist column, the values are not the same as what is given in the indicator window.
Any suggestions?
jm
|
|
Registered User Joined: 6/5/2010 Posts: 27
|
Bruce, please disregard the above post; I have found and now have included
'# Cumulative
Now the watch-list lists correctly.
Thanks,
jm
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
I am happy to read you were able to figure it out on your own.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 5/5/2010 Posts: 185
|
Bruce,
Does the above code still works or is there a better way to have upcoming earnings included in the watchlist?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The above code still works. I do not know of any other way to add earnings dates or upcoming earnings as a WatchList Column in StockFinder (it was added to TC2000 after SF stopped development).
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |