HasEarnings

HasEarnings ( int type );

Default values:

type: EarningTime.ANY

Description

Returns true if there are announced earnings, and false otherwise. Use an EarningTime constant to specify the time of announcement.

Input parameters

Parameter Default value Description
type EarningTime.ANY Defines the time of the earnings announcement: after market close, befor market open, or either.

Example

plot isBefore = HasEarnings(EarningTime.BEFORE_MARKET);
plot isAfter = HasEarnings(EarningTime.AFTER_MARKET);
plot isDuringOrUnspecified = HasEarnings() and !isBefore and !isAfter;
isBefore.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
isAfter.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
isDuringOrUnspecified.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);

This example script marks announced earnings with an up arrow if they are expected before market open, down arrow if they are expected after market close, and a dot if they are expected during market trading hours or the time is not specified.