# Upcoming Earnings Scan for ThinkOrSwim (Free Download)

Scan Free Beginner 11 min video 24 lines of code Oct 11, 2022

Scan for upcoming earnings in ThinkOrSwim 2 ways: the built-in Earnings filter, or a 2-line HasEarnings() scan that finds reports exactly 10 bars out.

## Overview

In this tutorial I show you two ways to scan for upcoming earnings in the ThinkOrSwim Scan tab. The first uses the Earnings filter that comes with ThinkOrSwim and needs no code. The second is a short thinkScript filter built on the HasEarnings() function, which can find stocks reporting on one exact date, such as 10 bars from today.

Scanning from the Scan tab lets you layer your own conditions on top of the earnings date, so the list only holds the reporting stocks you care about. In the video I add a before-the-open condition and a 50-period moving average, then check the 2 stocks that made it through on their charts. It's for traders who plan their watchlist around earnings season.

## Key Takeaways

- ThinkOrSwim has 2 ways to scan for upcoming earnings: the built-in Earnings filter under Study, Corporate Actions, and a custom study filter that uses the HasEarnings() function.

- The built-in Earnings filter finds stocks reporting anytime within the next X bars. In the video, 10 bars returned 57 stocks, and 37 when I limited it to reports before the market opens.

- The code version reads earningsDay[-10]. The negative index looks 10 bars into the future, so the scan finds stocks reporting on exactly that bar.

- In the video, the exact-date scan found 31 stocks reporting on October 25, 16 of them before the open, and 2 of those 16 (ADM and Halliburton) closed above their 50-period simple moving average.

- When I recorded the video, custom study filters worked only in the real-money version of ThinkOrSwim, not in paperMoney.

## Two Ways to Scan for Upcoming Earnings

An upcoming earnings scan in ThinkOrSwim can use a pre-built filter or a few lines of thinkScript. Both run from the Scan tab, and both let you stack your own conditions on top. The difference is how precisely you can pick the date.

Built-in Earnings filter HasEarnings() custom filter

Where to find it Study, then Corporate Actions, then Earnings Study, then Custom, then the thinkScript Editor tab

Code needed None 2 lines to start

Date control Anytime within the next X bars One exact bar, such as 10 bars from today

Before or after the market Yes Yes, with the EarningTime parameter

Extra conditions Add more filters beside it Add them to the same code with and

The built-in filter is plug and play, and it gets you running quickly if you have no coding knowledge. The trade-off is control. It answers one question, whether a stock has earnings anytime within the next number of bars, so it can't give you a list of stocks reporting exactly a week from today.

The coding approach takes a little more time and some basic thinkScript knowledge. In return, you control the exact date.

## Method 1: The Built-In Earnings Filter

The Earnings filter is a pre-built study filter in the Corporate Actions group of the ThinkOrSwim Scan tab. To add it:

- Open the Scan tab.

- Click Add filter and choose Study.

- Open the study drop-down, select Corporate Actions, and select Earnings.

- Set it to has earnings (the other choice is does not have), choose whether the report can come anytime or only before or after the market, and set how many bars ahead to look.

- Click Scan.

In the video I scanned for stocks that have earnings anytime in the next 10 bars, before or after the market, and the scan returned 57 stocks. When I changed anytime to before the market opens, the list dropped to 37.

The filter always works in windows. You get every stock reporting at some point in those 10 bars, and there's no setting that pins it to a single date. For that, you need Method 2.

## Method 2: Scan for an Exact Earnings Date with HasEarnings()

HasEarnings() is the thinkScript function that returns true on a bar where the company reports earnings. Paired with a negative index, it finds stocks reporting on one exact bar in the future. In the video, 10 bars from the day I recorded was October 25.

- In the Scan tab, click Add filter and choose Study.

- Open the drop-down, scroll all the way to the bottom, and select Custom.

- Go to the thinkScript Editor tab and delete the code that's already inside.

- Type the 2 lines below, click OK, and run the scan.

The code on this page is written out from the video. The download is a ThinkOrSwim shared link to the finished scan, covered at the end of this page.

(This step's code is free with an account.)

### How the 2 Lines Work

The first line stores HasEarnings() in a variable called earningsDay . With nothing inside the parentheses, the function doesn't care whether the report comes before the open or after the close.

The second line is the scan condition. The number in square brackets picks which bar to read. A positive number looks back, so earningsDay[1] is the previous bar. I put a negative sign in front of the 10 because the scan is looking for something in the future, so [-10] reads the bar 10 bars ahead.

On daily bars, each bar is one trading day. Change -10 to -5 to find stocks reporting 5 bars from today, or to any other number of bars you want to plan around.

In the video this scan returned 31 stocks, all reporting on October 25, with a mix of before-market and after-market reports.

## Before or After the Market: the EarningTime Parameter

The EarningTime parameter narrows HasEarnings() to reports before the open or after the close. It goes inside the parentheses:

(This step's code is free with an account.)

With that one change, the October 25 list in the video went from 31 stocks to 16, and every one of the 16 was reporting before the market opened.

Code What it finds

HasEarnings() Earnings on the bar, any time of day

HasEarnings(EarningTime.BEFORE_MARKET) Earnings reported before the market opens

HasEarnings(EarningTime.AFTER_MARKET) Earnings reported after the market closes

The time of day decides which session reacts to the report. A before-market report hits that same day's open, and an after-market report hits the next day's open. Our free [Smarter Earnings indicator](https://tosindicators.com/indicators/smarter-earnings) uses this same parameter to line up each past report with the bar where price reacted.

## Adding a Technical Filter: Price Above the 50-Period SMA

A technical filter on top of the earnings date turns the scan into a short watchlist. In the video I asked for stocks reporting exactly 10 bars from today, before the market opens, with the close above the 50-period simple moving average:

(This step's code is free with an account.)

SMA50 holds the 50-period simple moving average of the close. The plot line now needs both conditions to be true: earnings 10 bars out, and the current close above the average. A stock that fails either one drops off the list.

That cut the 16 before-market reports to 2 stocks: Archer Daniels Midland (ADM) and Halliburton (HAL). You can swap the moving average for any condition you already trade, such as the near-high filter in our [upcoming earnings with high short interest scan](https://tosindicators.com/scans/scan-for-upcoming-earnings-with-high-short-interest) or the volume check from our [increasing volume scan](https://tosindicators.com/scans/increasing-volume).

## Checking the Scan Results on a Chart

Checking a couple of results on a chart confirms the scan works the way you expect. The upcoming earnings marker sits in the future, to the right of the last bar, so give the chart more room on the right side. On the time axis, I expanded the space to the right from 7 bars to 20.

On the Halliburton chart, that showed the earnings date of October 25, reported before the market opens, and price was above the 50-period SMA I had loaded. ADM showed the same: earnings on October 25 before the open, and price above its 50-period SMA. Both matched what the scan asked for.

## What the Pre-Earnings Analysis Showed for ADM and HAL

The [Pre-Earnings Analysis](https://tosindicators.com/indicators/pre-earnings) indicator shows what a stock and its implied volatility did in the days before past earnings reports. It's a members-only tool, and in the video I set it to 10 days before earnings to match the scan. The counts below are what it showed on each chart in the video, and the video doesn't say how much earnings history each chart covered.

Stock Rose in the 10 days before earnings Fell Implied volatility into earnings My read in the video

ADM 9 of 20 times 11 of 20 times Fell for the most part About 50/50, no directional bias. Volatility tends to fall out of the premium, which favors selling premium.

HAL 14 of 20 times (70%) 6 of 20 times Tended to fall A bullish bias, as a seller of premium to capture the volatility decay.

Two stocks from one scan gave two different plans. ADM had no price clue, so the only lean in the video was the falling volatility. Halliburton had a directional lean and the same volatility pattern. These are historical counts from the charts in the video, and the next report can break the pattern.

[Volatility Box](https://tosindicators.com/products) members can download the [Pre-Earnings Analysis indicator](https://tosindicators.com/indicators/pre-earnings) from the site while logged in with their Volatility Box account.

## How I Use the Upcoming Earnings Scan

The upcoming earnings scan builds a watchlist for earnings season. It tells you who reports and when, and it says nothing about direction. I run it, check each result on a chart, and then look at the stock's earnings history before I decide whether there's a trade.

Earnings can gap a stock past a stop, so decide your exit and your position size before the report, and size the trade so a full loss costs a small, fixed share of your account. Our [earnings page](https://tosindicators.com/earnings) collects the rest of our earnings tools.

## Common Problems and Fixes

Most problems with the upcoming earnings scan come from the account type, the sign of the index or the chart settings. Here are the fixes:

- The custom filter won't run in paperMoney. When I made the video, ThinkOrSwim supported custom study filters only in the real-money version. Run the HasEarnings() scan from a live account.

- The results report on the wrong date. Check the sign of the index. A positive number such as [10] looks 10 bars into the past. Use [-10] to look forward.

- You can't see the earnings date on the chart. Expand the time axis on the right side, as described above, so the future earnings marker has room to show.

- The list is too long. Add EarningTime.BEFORE_MARKET or EarningTime.AFTER_MARKET inside HasEarnings(), or add a technical condition to the plot line with and.

## How to Import the Ready-Made Scan

The upcoming earnings download is a .txt file with one ThinkOrSwim shared link to the Upcoming Earnings Scan, plus a link to the video. To load the scan:

- In ThinkOrSwim, click Setup in the top right corner.

- Choose Open shared item.

- Paste in the link and save the scan.

The Code tab on this page has the final scan from the video, with the other versions as comments you can swap in. Our guide on [how to import a study or scan into ThinkOrSwim](https://tosindicators.com/thinkscript/how-to-import-thinkorswim) covers shared items step by step, and you'll find more free scans on the [scans page](https://tosindicators.com/scans).

The full thinkScript code is free with an account: [create one](https://tosindicators.com/register) or [sign in](https://tosindicators.com/login) on this page.

## Download

Upcoming Earnings Scan Download the Upcoming Earnings Scan for ThinkOrSwim. The download is a .txt file with one ThinkOrSwim shared link to the Upcoming Earnings Scan, plus a link to the video. In ThinkOrSwim, click Setup in the top right corner, choose Open shared item, and paste in the link. You can also copy the code from the Code tab on this page into a new custom study filter. If you haven't imported a shared item before, here's [how to import into your ThinkOrSwim platform](https://tosindicators.com/thinkscript/how-to-import-thinkorswim).

[Download free](https://tosindicators.com/scans/upcoming-earnings)

## Video: Upcoming Earnings Scan, built line by line

11 minutes on YouTube.

[Watch on YouTube](https://www.youtube.com/watch?v=R4RBMtKMSGE)

## Questions

How do I scan for upcoming earnings in ThinkOrSwim?

Open the Scan tab, click Add filter, choose Study, then select Corporate Actions and Earnings. Set it to has earnings, anytime, within the next 10 bars, and run the scan. In the video that returned 57 stocks. To find stocks reporting on one exact date, use a custom study filter with the HasEarnings() function instead.

How do I find stocks reporting earnings on a specific date?

Use a custom study filter with two lines: def earningsDay = HasEarnings() and plot signal = earningsDay[-10]. The -10 reads the bar 10 bars into the future, so the scan returns stocks reporting on exactly that bar. In the video that was October 25, and the scan found 31 stocks. Change the number to move the date.

What does HasEarnings() do in thinkScript?

HasEarnings() returns true on a bar where the company reports earnings. With empty parentheses it counts any report. EarningTime.BEFORE_MARKET inside the parentheses limits it to reports before the open, and EarningTime.AFTER_MARKET to reports after the close. Add an index such as [-10] to read a bar in the future.

How do I scan only for earnings before the market opens?

In the built-in Earnings filter, change anytime to before the market. In code, write HasEarnings(EarningTime.BEFORE_MARKET). In the video, the before-market setting cut the built-in filter's list from 57 stocks to 37, and it cut the exact-date list for October 25 from 31 stocks to 16.

Why does the earnings scan use a negative number like [-10]?

In thinkScript, a positive index looks back at past bars and a negative index looks forward. An upcoming earnings scan is looking for a report in the future, so [-10] checks the bar 10 bars ahead of the current one. On daily bars that means 10 trading days from today.

Why doesn't my custom earnings scan work in paperMoney?

When I recorded the video, ThinkOrSwim supported custom study filters only in the real-money version of the platform, not in paperMoney. The HasEarnings() scan is a custom study filter, so run it from a live account. The rule may have changed since the video, so check your own platform if you only use paperMoney.

Can I combine an earnings scan with technical filters?

Yes. Add the condition to the plot line with and. In the video I defined def SMA50 = SimpleMovingAvg(close, length = 50) and changed the plot to earningsDay[-10] and close > SMA50. That cut 16 before-market reports on October 25 down to 2 stocks, ADM and Halliburton.

How is the Earnings filter different from the HasEarnings() scan?

The built-in Earnings filter needs no code and finds stocks reporting anytime within the next X bars. The HasEarnings() scan takes a few lines of thinkScript, and it can target one exact bar, such as 10 bars from today. It also lets you put the earnings check and other conditions in the same filter.

## Goes with

[Earnings Trading: 1 video · 54 min · Free](https://tosindicators.com/earnings)

## Related tools

[Upcoming Earnings with High Short Interest: Scan · Free](https://tosindicators.com/scans/scan-for-upcoming-earnings-with-high-short-interest)[Smarter Earnings: Indicator · Free](https://tosindicators.com/indicators/smarter-earnings)[Pre-Earnings Analysis: Indicator · Members](https://tosindicators.com/indicators/pre-earnings)[Rate of Change Scans: Scan · Free](https://tosindicators.com/scans/roc)[Stacked Moving Averages: Scan · Free](https://tosindicators.com/scans/stacked-ma)[Anchored VWAP Scans: Scan · Free](https://tosindicators.com/scans/anchored-vwap-scan)

## Get each new indicator by email

One email on Sundays with the week's new tool and its code. A free account also unlocks every .txt download.

No credit card. Unsubscribe anytime.
