Plot Earnings Dates

Some packages show you in the plot when the earnings dates were in the past with an “E” or another symbol. It helps to see sometimes when earnings impact the chart. I’d imagine I’d need a source of that data and then a way to plot. Has anyone done this or have any ideas for this?

1 Like

I agree, that would be nice to have as most charting does so on the bottom for splits, dividends, earnings and news flags etc.
-S

https://www.amibroker.com/guide/afl/getfndata.html

I am not in front of my computer to show you an example but I think that if you have that data available from your data feed , you extract it using GetFnData.

Then you can chart it explore it use it etc.

Thankss portfoliobuilder. i think that could give us one event…but many graphic products plot them out along the timeline…so you’d need somewhere to store or a way to access multiple earnings dates (and potentially other events). Thinkorswim does this well as does the new medvedtrader (not sure where they are getting their data).

Yes, it would be great to have something like that for earnings or dividends, but in the documentation it says that there is no array for that kind of fundamental events, but maybe someone knows a workaround.

Oh really?
Forgot something?
How about Aux1/Aux2 fields. There are 64 bits per bar auxiliary info to be used so you can have PLENTY of information on bar by bar basis.

Again question answered already in the Knowledge Base
http://www.amibroker.com/kb/2015/01/29/importing-auxilliary-data-into-amibroker-database/

Hey @tomasz, that’s great. So I know since the data can be stored per bar in the database…that we can plot it. So, I guess the questions are:

  • Anyone know of any good databases that would provide this data by ticker by date
  • Wondering what the best way to import this data is if we get it

Thanks!

I was talking about GetFnData, following @portfoliobuilder comment, and checking your documentation it says:

ACCESSING FUNDAMENTAL DATA FROM FORMULA (AFL) LEVEL

To access fundamental data from AFL level you can use new GetFnData function. It has quite simple syntax:

GetFnData(“field”)

where “field” is any of the following fundamental data field supported. For detailed list please see GetFnData function reference.

The function returns the number (scalar) representing current value of fundamental data item. There is no history of values (no arrays are returned), so it is useful for scanning, explorations (for current situation), market commentary / interpretation, but not for backtesting.

I know what you were talking about ( I wrote that User Manual that you quote remember ??? and I don’t have Alzheimer yet so I mostly know what I wrote)
The point is that you are wrong, i.e. you said that there is no array, bu the array for ANYTHING (including fundamentals) is available.

And since such events occur rarely (not more than once per day) you could scan market using GetFnData (current ones) and store historical markers when new data arrive (again static vars) in Aux fields. Everything is doable. But not everything is given away for free and brought to you on silver plate.

On a side note price action actually precedes official announcements so the whole thing is pointless exercise anyway.

1 Like

Thanks for your help @Tomasz and I’m happy to know you don’t have Alzheimer yet, it’s great for you and for the AB community :wink:

1 Like

Here is sample code that shows how you can store CURRENT fundamental data into historical arrays. The code below retrieves LastSplitDate (see Information window) and stores flag in Aux1 field on bar that split occurred the same can be done with dividend dates or whatever. If you run such scan over all symbols once a day you could accumulate historical data over time.

// Demo showing AB versatility
SplitFlag = 1;

lastsplit = GetFnData("LastSplitDate") ;
if( lastsplit )
{
    lastsplitstr = DateTimeToStr( lastsplit );
	printf("%s", lastsplitstr );
	
	AB = CreateObject("Broker.Application");
	stks = AB.Stocks;
	st = Stks.Item( Name() );
	qts = st.Quotations;

	// retrieve quotation that matches split date
	qt = qts.Item( lastsplitstr );

	// if not already marked
    if( qt AND ( qt.Aux1 & SplitFlag ) == 0 )
    {
		// mark split
		qt.Aux1 |= SplitFlag;
		_TRACE("Marking split flag in Aux1 for " + lastsplitstr );
	}
}

Then you can display split date as circle on price chart:

SplitFlag = 1;

Plot( C, "Price", colorDefault, styleCandle );
PlotShapes( shapeCircle * ( Aux1 & SplitFlag ), colorRed );

This proves that it is perfectly doable now.

Using binary flags 1, 2, 4, 8, 16 and so on you can combine multiple info in single Aux field.

8 Likes

Thanks. Was looking at there is a service from quandl that makes Zacks earnings database data available. I think it’s downloadable, but i think there is also an API to the service.

If I looked into the API… do you think it would it be feasible to query the API in real time and plot out earnings by showing the symbol on the screen and at that moment in real time using an API call to bring in and plot the earnings data? Or do you think it would be too slow?

Querying online APIs is always very slow. AFL formulas take less than 1ms to run, web query is a matter of hundreds of milliseconds each so it is at least 2 or even 3 orders of magnitude slower.

For those looking for a data feed with Fundamental data, check out Norgate premium data.

https://norgatedata.com/beta-testing-program/amibroker-database-layout-content.php




etc. etc.

3 Likes

Aux1 and Aux2 fields are wiped out on any OHLCVOI quote update, regardless of $HYBRID 1?

Since the FA date fields in AmiBroker are not arrays, I don't see how its possible to have a history of the flags in Aux1/Aux2 as repopulating with the scan won't get any previous dates that were in the FA date fields.