Earnings scan to display only after market close


New member
Would anyone know how to tweak this to show Earnings After Close from last night and Before market for today?


input days = 1; 

declare once_per_bar;  

plot scan = sum(HasEarnings(EarningTime.AFTER_MARKET),days)[1-days] + 

sum(HasEarnings(EarningTime.BEFORE_MARKET),days)[0-days] > 0; 
Last edited:
@15minofpham Are you looking for this?


More earnings scripts here:


New member
I got this off of your One Note sticky post from Chris Baker from 2013. This is what he said.

I created this because the default TOS Earnings filter is useless for actually highlighting earnings plays.  For example, when set to 2 days,  it includes both stocks that already had earnings this morning, as well as those that won't release until tomorrow afternoon. 

TODAY'S POTENTIAL EARNINGS PLAYS - Shows only stocks with earnings tonight or tomorrow morning 

Scan tab study that selects stocks with earnings either after the market today or before the market opens tomorrow.

The problem with his scan is that it only looks into the future. I was playing with days such as -1 to try to get last night's earnings but it didn't work. I'm looking for a way to scan for earnings After the Market FROM LAST NIGHT & Before the market from today. TOS default After the market earnings scan is for tonight, NOT last night. Hope this makes sense.
Last edited by a moderator:


Well-known member
@15minofpham A lot has changed in TOS since 2013. Look again at BenTen's picture above. Ben has it correct. Otherwise search the OneNote with the word "til" in the context of earnings. It may take a bit, but the syntax you need will be there. But, as I stated, Ben has it correct above, you just need to work with it.

Last edited:


New member
I finally figured it out on my first ever TOS script (albeit with a head start from Chris). This scan is for the prior day's AFTER MARKET and today's BEFORE MARKET.

input days = 1;
declare once_per_bar;
plot scan = sum(HasEarnings(EarningTime.AFTER_MARKET),days)[1] +
sum(HasEarnings(EarningTime.BEFORE_MARKET),days) > 0;
Last edited:


New member
@Likos There isn't a set up per se. The reason why I need this scan is because I like to play the opening range breakout after the initial 30 minutes. It was cumbersome for me to have separate After Market scan from the previous night and Before Market. I guess another way one can play is to look for a gap up or gap down then wait for a higher/lower move in its respective direction.

Last edited:


New member
@Likos I use the ORB script here on this site. Earnings has been a fading game. Most don't go higher after their initial 30 so instead, I've been using for gaps where I put it in a watch list to see if there's a continuation.

Last edited:


New member
@Likos My modification is a lot better. The default automatically changes the next day meaning the After Market is now for that day, NOT the previous night.

Last edited:



Rich (BB code):
(Cindy was one of the original script masters that worked for TOS)
#HINT: watchlist label that shows days-to-earnings and next earnings date (if next earnings date is available).  Includes a visual alert if "EARNINGS TODAY"

#def allows you to teach ThinkScript new "words" to save time and typing by using your new "words" later in the code

def bn = BarNumber();

def na = Double.NaN;

def getNextEarnings = AbsValue(GetEventOffset(Events.EARNINGS, 0));

def findDay = GetDayOfMonth(GetYYYYMMDD());

def findMonth = GetMonth();

def findYear = GetYear();

#ThinkScript thinks in numbers, including converting dates into numbers and viewing each bar on the chart as a number.  Therefore you can use BarNumber to tell ThinkScript which bar, and use lines in ThinkScript code to 'trick' ThinkScript into displaying that daily bar in date format

def getNextEarningsBarNumber = if !isNaN(getNextEarnings) then bn + getNextEarnings else na;

def NextEarnings = bn == HighestAll(getNextEarningsBarNumber);

def getNextEarningsMonth = HighestAll(if NextEarnings then findMonth else na);

def getNextEarningsDay = HighestAll(if NextEarnings then findDay else na);

def getNextEarningsYear = HighestAll(if NextEarnings then findYear else na);

#plot tells ThinkScript what data you want displayed.  Hide() is used in this case because desired display is the label and not the numberic equivalent of the data

plot DaysToEarnings = getNextEarningsBarNumber;


#AddLabel makes the data more user friendly when viewing the watchlist column

AddLabel(if getNextEarnings > 1 then yes else no, getNextEarnings + ";" + " Date= " + (getNextEarningsMonth) + "-"+ (getNextEarningsDay) + "-" + AsPrice((getNextEarningsYear)) , Color.BLACK);


#because of the condition at beginning of AddLabel, if today is earnings date then days-to-earnings label will be hidden and this visual alert label will be visible

AddLabel(if getNextEarnings == 0 then yes else no, "  EARNINGS TODAY !!!", color.RED);

Here is another Earnings Watchlist, sorry, no .mx available

Rich (BB code):
# blt
# 10.27.2016

# Plots the # of days to next earnings with before/after market coloring.
# It appears that the watchlist has a limitation of around 30 days into
# the future. So anything with earnings already reported or greater than
# 29 days are indicated as "NaN".

def ebm = fold i = 0 to 90

          with value = 0

          while value == 0

          do if GetValue(HasEarnings(type = EarningTime.BEFORE_MARKET), -i) then 1 else ebm[1];

plot getNextEarnings = if AbsValue(GetEventOffset(Events.EARNINGS, 0)) > 29

                       then Double.NaN

                       else AbsValue(GetEventOffset(Events.EARNINGS, 0));

getNextEarnings.AssignValueColor(if ebm == 1 then Color.GREEN else Color.RED);

I merged the other topic into this one so it's easier to browse and find things.
Last edited:


New member
Trying to scan for pre-market or prior day earnings event, "events.EARNINGS within 1 bar" is showing multiple results in addition to today and previous day earnings ?


New member
Hey, i'm looking for some help on a thinkscript. i want to scan for tickers that have dropped on the day of/day after earnings release. My logic is to play bounces off of overly-negative reactions to positive earnings reports.

Similar threads