Compare earnings announcement date to date of bar?
Author: kbellare
Creation Date: 9/2/2016 9:51 PM
profile picture

kbellare

#1
I'm running a strategy on 15-minute bars, which buys the day after earning announcement at the 10am EST bar and sells after 4 days.
The code below compiles but gives me an error - it's likely failing at the date compare
Runtime error: Object reference not set to instance of object

How do i compare the earnings date to the date 2 bars ago, so i don't get this error?

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

LenMoz

#2
Note that fundamental data from WealthLab sources is not generally available as quickly as you would hope, taking up to 10 days. See discussion at:

https://www.wealth-lab.com/Forum/Posts/Fundamental-Data-Reporting-Lag-Consequences-35353

Len
profile picture

Eugene

#3
QUOTE:
if(fi.Date == Date[bar-2] && fi.Date != Date[bar-1])

While hardcoding like that is inelegant, it might do the job with liquid stocks. But I would rather use Bars.IntradayBarNumber( bar ) == 0 to find the first bar of today (see the QuickRef). You should find enough examples of mixing intraday and daily data in the Wiki: Intraday / Multi-Time Frame

QUOTE:
sells after 4 days.

Wealth-Lab Wiki Knowledge Base >

Intraday | Building blocks of Intraday trading strategies > Exiting after N days in an intraday strategy
Intraday / Multi-Time Frame | Mixing intraday and daily data > Selling a position at close at after the 2nd market day after purchasing

QUOTE:
"[msn] eps"

The MSN provider is broken beyond repair and has been taken down years ago. You have to change that to "eps" (Fidelity data), "[si] eps" (StreetInsider), "[ms] Earnings Per Share" (annual data by Morningstar), or "[yc] eps" (YCharts free/paid data). Note that the "eps" item is also available in the free part of YCharts data but is limited to the few recent releases which should be sufficient for your task.
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).