TOS Earnings scan with prior earnings percentage move


Category:
0
0

I currently have a default scan that shows me earnings from the Nasdaq within the next 10 bars (http://tos.mx/VMj5Em)

I want to know if it is possible to add to this scan to only show those that had a 6% (or whatever % you choose) move up or down the prior earnings period.
For example, NFLX has earnings within the next 10 bars and was up 9.2% last earnings. So this would show up with this scan if it can be done.

Thanks

Attachments:
Marked as spam
Posted by (Questions: 21, Answers: 47)
Asked on July 10, 2018 12:35 pm
1260 views
0
Private answer

The solution to this is complicated by the fact that earnings can be reported after market close or before market open. So our logic needs to have enough dimensions to account for this. It took some effort to get everything balanced and working for both scenarios. I had to plot the various elements on the chart so I could exactly how to construct the code to get the right prices. Some of the screenshots below demonstrate part of that process.

Here is the code for the scan:

Edit: The original code contained math that needed correction. I am replacing that with the code below.
There are a couple more changes.

1) The percentEarningMove is enclosed within AbsValue() method in order to pick up both the positive and negative percent moves
2) A filter was added to prevent picking up stocks that have reported earnings in previous 3 days

rec preEarningsClose = if HasEarnings(EarningTime.BEFORE_MARKET) then close[1] else if HasEarnings(EarningTime.AFTER_MARKET) then close else preEarningsClose[1];
rec postEarningsOpen = if HasEarnings(EarningTime.BEFORE_MARKET)[1] then open[1] else if HasEarnings(EarningTime.AFTER_MARKET)[1] then open else postEarningsOpen[1];
rec percentEarningsMove = if HasEarnings(EarningTime.AFTER_MARKET)[1] then 100 * ( postEarningsOpen / preEarningsClose[1] - 1) else if HasEarnings(EarningTime.BEFORE_MARKET)[1] then 100 * (postEarningsOpen / preEarningsClose - 1) else percentEarningsMove[1];
plot scan = Highest(HasEarnings(), 3) < 1 and AbsValue(percentEarningsMove) > 6.0;

 

Attachments:
Marked as spam
Posted by (Questions: 37, Answers: 4086)
Answered on July 11, 2018 9:00 am
0

Pete: I may be asking a stupid question but what makes your code give all 6% moves whether the stock opened up compared to the previous close or down?

( at July 22, 2018 12:04 pm)
0

It does not. In order to scan for 6% down after earnings you would need to change from:
plot scan = percentEarningsMove > 6.0;

To this:
plot scan = percentEarningsMove < -6.0;

Or if you wanted to scan for both you could combine them:
plot scan = percentEarningsMove > 6.0 or percentEarningsMove < -6.0;

( at July 22, 2018 2:55 pm)
0

Based on some emails received from Arun NY I have updated the code in my original answer and included some comments about the changes made. Thank Arun NY for taking the time to dig into the details and report your findings to me.

( at July 23, 2018 8:30 am)
0
I was hoping if I changed the number in the bracket to let's say 4, it would be for the previous 4 quarters but it doesn't work this way. How would you tweak it to show your desired earnings period?
( at April 26, 2019 8:07 am)
0
This would be more than a tweak. The core components of the code were not designed for that.
( at April 26, 2019 8:32 am)
0
Is this something I could ask as a new request?
( at April 26, 2019 9:12 am)