Hey everybody, welcome back to thinkScripting. My name is Mike Fairborn. Today we'll discuss earnings season, which is already upon us again. Specifically, we want to talk about creating a script that can identify a "Gap and Go" scenario—an earnings gap followed by a run. We'll use thinkScript on the thinkorswim platform to do this.
Cameron May joins us in the chat to help answer any questions or comments. Feel free to interact with us in the chat. Let's dive into it.
Head to the Calendar tab on thinkorswim and set it to "Monthly" for a broader view. Configure it to show S&P 500 companies using the gear icon. You can see all earnings announcements in the S&P 500 over the selected period.
The first step involves setting up a scan to identify companies that had earnings within a certain look-back period. Navigate to the "Scan" tab and add a filter, selecting "Study" and then "Corporate Actions". Set it to filter based on earnings within a certain number of days.
input lookback = 20; # Checks for earnings in the last 20 bars (days)
def hasEarnings = HasEarnings();
plot data = hasEarnings[1] within lookback;
We now need a second filter to identify stocks that had both a significant gap up and a subsequent run. Create a new scan:
input gapPercent = 2; # Minimum 2% gap
input intradayIncrease = 2; # Minimum 2% follow-through
input lookback = 20;
def gapUp = (open / close[1] - 1) * 100 >= gapPercent;
def intraday = (high / open - 1) * 100 >= intradayIncrease;
plot scan = gapUp and intraday within lookback;
Combine the two scans to identify stocks that meet both criteria.
input gapPercent = 2;
input intradayIncrease = 2;
input lookback = 20;
def hasEarnings = HasEarnings();
def gapUp = (open / close[1] - 1) * 100 >= gapPercent;
def intraday = (high / open - 1) * 100 >= intradayIncrease;
plot scan = hasEarnings[1] and gapUp and intraday within lookback;
Test it live on the platform to see if it filters out the desired stocks, including applying any additional technical indicators you may find useful for further filtering.
For the test, I chose Discover Financial Services (DFS). I placed a paper trade of 50 shares with an alert set to notify me for a potential extra buy if the stock breaks out above a certain level.
After verifying that the script works, I will add the link in the "more" section of YouTube and post it on X (formerly Twitter).
Q1: What is the "Gap and Go" strategy? A1: The Gap and Go strategy focuses on identifying stocks that have gapped up after an earnings announcement and continued to rise intraday.
Q2: Why is it important to look at volume in a Gap and Go strategy? A2: Volume can confirm the strength of the move. For future improvements, you can add volume-based conditions to the script.
Q3: Can this script be used for downward gaps as well? A3: Yes, with slight modifications, this script can be adjusted to look for downward gaps.
Q4: How do you adjust the lookback period in the script?
A4: The lookback period is defined by the variable input lookback
, which you can easily change as needed.
Q5: Where can I find the shared script link? A5: The script link will be available in the "more" section under the description of the YouTube video.
In addition to the incredible tools mentioned above, for those looking to elevate their video creation process even further, Topview.ai stands out as a revolutionary online AI video editor.
TopView.ai provides two powerful tools to help you make ads video in one click.
Materials to Video: you can upload your raw footage or pictures, TopView.ai will edit video based on media you uploaded for you.
Link to Video: you can paste an E-Commerce product link, TopView.ai will generate a video for you.