scan for earnings between 30 and 38 days


Category:
0
0

Hi Pete, i found this earning scan, it scans out those stocks that have earning announcement within 10days

I would like to ask how to amend the code such that it ONLY scan out stocks that have 30-38 days to their earning announcement. Anything that is less than 30 day or more than 38 days, should not appear in the scanlist

Thanks

 

#Scan for earning “input” days out. Input days is modifiable

input days = 10;

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

or sum(HasEarnings(EarningTime.BEFORE_MARKET),days)[0-days];

Marked as spam
Posted by (Questions: 8, Answers: 15)
Asked on August 24, 2019 11:36 pm
146 views
0
Since this is a scan, we are moving this out of the "Frequently Asked Questions" and into the "Stock Scanners" topic. Also, I will be updating the title of your question to "scan for earnings between 30 and 38 days". We need to be specific since there are so many posts related to earnings. This will also help the rest of our viewers searching for a similar solution.
( at August 25, 2019 10:16 am)
0
Private answer

The screenshot below shows how the the code will work on a chart. The only question is whether it will work on a scan. In other words, is the scan engine able to look 30+ days into the future to find earnings announcements? The second screenshot tells us the answer is YES.

Here is the code:

input earningsStart = 30;
input earningsEnd = 38;
def targetStart = HasEarnings()[-earningsStart];
def targetEnd = HasEarnings()[-earningsEnd];
def earningsPeriodBegin = Highest(targetStart[1], earningsStart) < 1;
def earningsPeriodFinish = Highest(targetEnd[1], earningsEnd) > 0;
plot scan = earningsPeriodBegin and earningsPeriodFinish;

Attachments:
Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on August 25, 2019 11:24 am
0
Yup...thanks alot.
( at August 30, 2019 8:59 am)