Only show options not expiring within 2 weeks of Earnings

wtf_dude

Well-known member
Hey all,
Have zero experience messing with code dealing with dates or fundamentals like earnings. Can anybody else throw me a quick code line for an option scan to exclude options expiring within the 2 weeks before earnings?

Thanks for taking a look
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Just as a follow up, if anybody is interested. I found somebody's old code that's close enough as it scans for companies that don't have earnings within a certain amount of days.

Code:
# EARNINGS-FREE EQUITIES - Shows only equities that DO NOT have earnings in the next 45 days
#
# Scan tab study that selects only equities without earnings coming up in
# the next 45 days. To find stocks *with* earnings, see my other thinkScript:
# Today's Potential Earnings Plays: http://pastebin.com/gC1GJMfB
#
# By Chris Baker <[email protected]> @ChrisBaker97
# Latest version maintained at: http://pastebin.com/wZbyXgEZ
# More thinkScripts at: http://pastebin.com/u/ChrisBaker97
#
# This thinkScript is designed for use in the Scan tab. Detailed
# instructions may be found here: http://pastebin.com/wGi1Mvuh
#
# Future enhancement:
# • Incorporate extensive code from my optimal expiration cycle selection
#   thinkScript (http://pastebin.com/SR7NDzLB) to dynamically adjust the
#   horizon based on the actual expiration date of the option series closest
#   to a user-defined optimal days to expiration.
#
# This work is licensed under the Creative Commons Attribution-ShareAlike
# 3.0 Unported License. To view a copy of this license, visit:
# http://creativecommons.org/licenses/by-sa/3.0/deed.en_US
#
# I created this because the default TOS Earnings filter only allows you
# to find stocks *with* earnings, but there's no way to reverse it to
# eliminate stocks *without* earnings, which is often desirable.
#
# If you want to tweak the time period, you may adjust the days input.
# For example, when set to 60, this will find all stocks without earnings
# announcements through the market open 60 days from now.

input days = 45;

declare once_per_bar;

plot scan = sum(HasEarnings(EarningTime.AFTER_MARKET),days)[1-days] +
            sum(HasEarnings(EarningTime.BEFORE_MARKET),days)[0-days] < 1;
 
Hello Everyone : want to know , what filter do I need to add on TOS screen so I will get a list of all the options where MAX profit is more as compare to max loss. Right now , I have to dig into my results sets and look into details to find this info which takes more time. Thanks in advance.
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
162 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top