Days to Earnings Watchlist for ThinkorSwim

T

tomsk

Well-known member
VIP
Here is a Days to Earnings Watchlist that I have been using for years.
Hope this helps someone

Code:
# TDE - Trading days til earnings
# 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
#
# Author: Allen Everhart
# Date: Oct 8, 2013
# Rev 1.3: Oct 19, 2014 code code watchlist column
# Rev 1.2: Mar 8, 2014 color code the after-market earnings.
# Rev 1.1: Oct 22, 2013 add 0.5 if earnings are after-market.

input length=60;
def xx = -getEventOffset(Events.EARNINGS);
def yy = sum(HasEarnings(type = EarningTime.AFTER_MARKET),length)[-length +1] > 0;
plot x=xx+yy*.5;
AssignBackgroundColor( if x < 8 then Color.RED else Color.BLUE);
 
markos

markos

Well-known member
VIP
@tomsk thank you for posting this watchlist. I also have it on my watchlist pages.
 
T

tomsk

Well-known member
VIP
@markos I have tested probably well over a dozen different such watchlists. That one I posted is the one I use and is the best in my opinion. Glad you have it too
 
mc01439

mc01439

Well-known member
2019 Donor
VIP
Here is the one I use, it has proven to be very good.


Code:
# +--------------------------------------------------+


# |          Highlight days around earnings          |
# |                   Robert Payne                   |
# |           http://rrpayne.blogspot.com            |
# +--------------------------------------------------+
input daysBefore = 10;
input daysAfter = 10;

input showLines = yes;
input paintBackground = yes;

DefineGlobalColor("Before Earnings", Color.YELLOW);
DefineGlobalColor("Earnings Release Date", Color.YELLOW);
DefineGlobalColor("After Earnings", Color.CYAN);
DefineGlobalColor("Fill Before", CreateColor(178, 216, 166));
DefineGlobalColor("Fill After", CreateColor(131, 191, 213));

AddVerticalLine(showLines and HasEarnings()[-daysBefore], Concat(daysBefore, " Days Before" ), GlobalColor("Before Earnings" ), Curve.FIRM);
AddVerticalLine(showLines and HasEarnings(), "Earnings!", GlobalColor("Earnings Release Date" ), Curve.FIRM);
AddVerticalLine(showLines and HasEarnings()[daysAfter], Concat(daysAfter, " Days After" ), GlobalColor("After Earnings" ), Curve.FIRM);

def before = Sum(HasEarnings(), daysBefore)[-daysBefore];
def after = Sum(HasEarnings(), daysAfter)[1];

def value1 = Double.Positive_Infinity;
def value2 = if paintBackground and before then Double.Negative_Infinity else Double.NaN;
def value3 = if paintBackground and after  then Double.Negative_Infinity else Double.NaN;

AddCloud(value1, value2, GlobalColor("Fill Before" ));
AddCloud(value1, value3, GlobalColor("Fill After" ));
 
T

tomsk

Well-known member
VIP
While the version posted by @mc01439 is looks real good on charts. @markos and I were discussing about DTE on watchlists
 

Similar threads

Top