EarningsDate.InWindow returned false when I think it should be true
Author: jlu_68
Creation Date: 1/27/2012 2:30 PM
profile picture

jlu_68

#1
Static Class EarningsDate has a function call InWindow that will return true if the current date falls within the specified window. It didnt work this morning and returned false for symbol RHI. The current next earnings date I have in my local data file is 1/25/2012 which is 1 day off. The real earnings date is 1/26/2012. Even with the date of 1/25 it still should return true because of the window I specified..

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

Eugene

#2
The real next earnings date for RHI in my file is 4/26/2012. What am I missing?

But even if the date was 1/25/2012 and you're specifying 2 bars for barsAfter, shouldn't the function return false? 1/25 is day one, 1/26 is day two, 1/27 (the date of your post) is 3, and 3 is greater than 2.
profile picture

jlu_68

#3
The real next earnings date gets updated regularly. I suspect it varies from symbol to symbol. I just check and my next earnings date is still 1/25/2012. Not sure why I didnt get the update..

I think it should be 2 days after the earnings report date including the 2nd day which would include the 27th. But to make sure, I also tried 3, 4, and even 5 days after and it still return false.. It seems to happen with varied symbols with no discerning pattern. Since it seems to occur with the most current data, I was able to create a code fragment that will use the most current next earnings date and create a time window filter. So I guess for now Im ok as long as the next earnings date is correct.. Just wanted to let the creator know the issue I was having.
profile picture

Eugene

#4
It seems that you were right re: barAfter syntax, as the documentation indicates that the count starts from zero so the 1/27 bar should be included.

As the date is cached, you might want to delete that cache file (see the Earnings Date Helper online help guide for the file name/location) and retry.
profile picture

Mockasino

#5
Hi All,


I am using the Earnings.com Fundamental Provider and i would like to use the EarningsDate.InWindow method .
So generally is that possible ?
Could anybody give me a hint how to code that?

Thanks a lot in advance.
Christian
profile picture

Eugene

#6
As per your ticket, you need to have replaced "earnings per share" to "[e] eps" and updated the fundamental provider's data to make the example code work. However, the Earnings.com website does NOT seem to be delivering the actual data. Looks like it's stuck in the past (e.g. latest AAPL data are from Q2 2013). I assume this provider won't get you going.

Consider switching to one of these providers which seem to be working OK (fundamental item is indicated):

Morningstar data provider, "[ms] Earnings Per Share"
99WallStreet fundamental provider, "[99] eps"
StreetInsider fundamental provider, "[si] eps"
YCharts fundamental provider, "[yc] eps"
profile picture

Mockasino

#7
Hi Eugene,

thanks for your answer.

to calculate the earnings influence in the strategy i would like to create my own "in Window method", because i would like to use
the FinViZ method to get the earningsdate.because i trust FinViZ.

DateTime next_earningsdate = FinvizData.GetNextEarningsDate( Bars.Symbol );

As i understood the EarningsDate Class does only work with Providers like 99, MS etc.
Is that right?

So now i would like to suppress signals when the signaldate is e.g. 2 days -/+ the earningsdate.

if (( next_earningsdate > ( Date[bar].AddDays(-2)))&&( next_earningsdate < Date[bar].AddDays(+2) ))

My problem is, that i want to keep out market Holidays, Weekends etc. from this calculation.


Maybe do you have another hint for me. how can i do that.
here can i get the Dates concerning market Holidays?
Thanks a lot.
profile picture

Eugene

#8
GetNextUseCache has a "Next" on its name purposefully. It downloads a list of future earnings dates from finviz.com for live trading. To calculate the earnings influence in the strategy, you need EarningsDate.InWindow - not GetNextUseCache.

GetNextEarningsDate is the tried and true solution which should work with any fundamental provider installed. For example, Morningstar is a trustworthy provider that Microsoft has chosen to power their MSN Money website.
profile picture

Mockasino

#9
Hi Eugene,

one question concerning the inWindow method:
Do you know when the "old" earningsdate will be updated?

Backround of my question:
Assuming you have an earningdate for a Symbol 24.2.2014 in the data-files.
You run the strategy.
You would get a trading Signal on 28.2.2014 , BUT according to the inWindow method
the next 5 days after Eraning release NO trade signal is allowed.

What happend when, eg. on 26.2.2014, the upcoming earning date (e.g.10.5.2014) is announced and i
do by chance an update of the Provider data (e.g. 99)?
So if the earningsdate: 24.2.2014 is replaced bei the new one: 10.5.2014 than it would
have an effect on the strategy, because when running the method, i would be out of the earningswindow
and i would trade signals towards my rules.

So i hope you understand my concerns.

Thanks for an answer.

Regards
profile picture

Eugene

#10
Hi Christian,
QUOTE:
Do you know when the "old" earningsdate will be updated?

Sorry, no idea. We (MS123) are not affiliated with any data feeds. Please consider asking the website owner, thank you.
profile picture

Mockasino

#11
Ok, thanks for the infomation.
I have another question:
Do you regard in the InWindow-Method the Weekend-days and also the holidays where
the exchange is closed?
profile picture

Eugene

#12
Yes, both weekends and market holidays are honored by the method. You can proof it by peeking inside the open source code.
profile picture

Mockasino

#13
Hi Eugene,

thanks for Information an coding.
I dont want to stress you, but when i try the InWindow method the function
is working well with the 'barsBefore'. I wanted to check it also for the 'barsAfter',
but then in my opinion it fails.
i am using 99wallstreet data and e.g. the Symbol 'MNST' is not working.
The earning date is 2014-2-27 . I set in the InWindow method barsAfter = 6 and it returned false.
I am in backtesting mode and the strategy triggers a Signal on 2014-2-28, which is
in the earningwindow.

It seems to be a similar problem like discussed above with Jlu_68, but i dont know what was finally
the solution.

Do you have a hint? Or is it possible that you check the Symbol in your environemnt?
profile picture

Cone

#14
I took a quick look and it seems that the InWindow method isn't working properly for a window in range of the final bars of a chart. (For backtest it's okay, just not when you actually expect to use it.) I'll investigate.
profile picture

Mockasino

#15
Hi Cone,

thanks for the answer.

I think espacially for the live trading this method is necessary.
And there you will have in most cases the window in range of the final bars.
So do you think you can adapt the method?

Regards
Christian
profile picture

Cone

#16
I agree completely and should have it solved later this week.
profile picture

Cone

#17
The fix is in place. Eugene is doing some other unrelated work with the library, so he'll update this when finished.

Thanks for identifying the problem, and sorry for the inconvenience!
profile picture

Mockasino

#18
Hi cone,
Thanks for the quick Bug fixing.
Do i get the Info when Eugene's update is finished in this thread?
profile picture

Eugene

#19
You get an update when the Extension Manager flashes an update to the library:

Wealth-Lab User Guide > Extension Manager > Extensions How To > How to: Get Update Notifications
profile picture

Cone

#20
The fix is ready in C. Components 2014.03. The EarningsDate methods should be accurate at the end of the chart too now, and in general, the InWindow method should be more responsive.
profile picture

Mockasino

#21
Hi Cone,

i would like to use the FinViz data (Earningsdate) AND the EarningsDate.inWindow method. Is this possible?
Maybe i have not understood the description in Wiki, but it seems to be that FinViz is just directly regarded in
method GetNextEarningsDate.

Can you help me about that?

Regards
Christian
profile picture

Cone

#22
That´s right. Just call the method and it all happens behind the scenes.
profile picture

Mockasino

#23
Hi Cone,

which method you mean? GetNextEarningsDate. or EarningsDate.inWindow ?

profile picture

Cone

#24
Either one should work. InWindow() has to GetNextEarningsDate anyway.

Please start a new thread if you need more help with this. Every time I see this thread pop up, it make me think something is wrong all over again!

If you haven't already, please refer to the Earnings Date Helper in the Wiki.
profile picture

Eugene

#25
Attention:

All methods that delivered Finviz data (earnings, company info) have been removed from Community Components ver. 2015.03. They no longer work after a Finviz website redesign killing the data export feature.
profile picture

gbullr

#26
Help please.

Ticker: BID

I must have a setting wrong or something because the attached script does not recognize the latest Sotheby's earnings day.

CODE:
Please log in to see this code.


Any idea what that setting could be?

Thank you in advance.
profile picture

Eugene

#27
Make sure you've updated the Fidelity fundamental data before running this script.

Works just fine with StreetInsider EPS data i.e. "[si] eps" (as Fidelity's data are unavailable to me). As you can see, both the historical and upcoming data are processed:

profile picture

gbullr

#28
Updating worked.

So to use streetinsider you just create a dataset based on them or can you paste the code that uses their data please so that I can see it.

Thanks once again.
profile picture

Eugene

#29
Every data provider is documented in the Wiki: StreetInsiderProvider
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).