Tuesday, December 10, 2013

Custom Column: Days Until Earnings

12/10/13


This custom quote displays the number of days until earnings (shown above in the last column). If earnings are after market close then it adds .5 to the number; otherwise, it ends in .0 when earnings are before market open.
  • Examples-
    • TOL = 0.0: earnings were today before market open
    • COST = 1.0: tomorrow before open
    • CIEN = 2.0: day after tomorrow before open
    • ADBE = 2.5: day after tomorrow after close

##### Begin Custom Quote: Earnings
#
#hint: displays the trading days til earnings. after-market earnings add 0.5 to the count. this code is meant to be pasted into a custom watchlist column. rev: 1.1 http://www.smallDogInvestor.com 
# author: allen everhart
# date: 08oct2013
# rev 1.1: 22oct2013 add 0.5 if earnings are after-market.
#
input length=20;
def xx = -getEventOffset(Events.EARNINGS);
def yy = sum(HasEarnings(type = EarningTime.AFTER_MARKET),length)[-length +1] > 0;
plot x= xx+yy*.5;
#
##### End.

1 comment: