Only show options not expiring within 2 weeks of Earnings

wtf_dude

Active 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
 

wtf_dude

Active member
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;
 

chIza=iChis1A?H

Member
VIP
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

Top