Historical Earnings Trend Indicator for ThinkorSwim

BenTen

BenTen

Administrative
Staff
VIP
This indicator will display several earnings trend that can be beneficial for traders who use historical earnings data for their investment decision. Another great share by @KRose_TDA on Twitter.
  • Red Squares = Earnings Lower
  • Green Square = Earnings Higher
  • Red Arrow = Earnings below estimates
  • Green Arrow = Earnings above estimates
  • Point of Arrow = Earnings estimates


thinkScript Code

Code:
#Follow @KRose_TDA on twitter for free updates posted for this and other scripts
#Earnings trend study is used as part of the generating income with dividend stocks webcast presented Monday nights @ 7PM ET   https://events.thinkorswim.com/#/webcast
# I build custom studies like earnings trend as part of my Thursday night thinkscript webinar @ 5:30PM ET
#     https://events.thinkorswim.com/#/webcast
#This study creates a line chart tracking the trend of a stock's quarterly EPS values(it doesn't work for ETFs).A red square appears when Earnings Per Share(EPS)is lower than the prior quarter's EPS, and a dark green square appears when EPS is higher than the previous quarter's EPS. The arrows represent a comparison of an analyst's estimated EPS for that quarter versus the actual EPS. If the arrow is colored Green, the company's actual EPS was greater than the analyst estimates. If the actual EPS was less than the analyst estimates, the arrow will be Red. The point of the arrow equals analyst estimate value.

declare lower;
declare Hide_on_intraday;

def EPS = if !isNaN(GetActualEarnings()) then GetActualEarnings() else EPS[1];

plot EPS_line_chart = GetActualEarnings();
EPS_line_chart.EnableApproximation();
EPS_line_chart.SetDefaultColor(color.black);

plot earnings_date = GetActualEarnings();
earnings_date.SetPaintingStrategy(PaintingStrategy.squares);

earnings_date.AssignValueColor(if EPS > EPS[1] then color.dark_green else color.red);
earnings_date.SetLineWeight(5);

plot EstEarning = GetEstimatedEarnings();
EstEarning.SetPaintingStrategy(PaintingStrategy.arrow_up );

EstEarning.AssignValueColor (if EstEarning < EPS then color.DARK_GREEN else color.DARK_RED);
EstEarning.SetLineWeight(5);

# end code

Shareable Link

https://tos.mx/gt605c
 
1

15minofpham

New member
Is it possible to write a scan to show the best/worst historical performance over the past X quarters a week before and after earnings?

Thank you.
 
V

vganji11

New member
VIP
Hi,

Is there a way to create a customer scan to search for companies with a certain % increase in EPS and certain % increase in earnings YOY for past few years ?

Thanks,
Vamsi
 
B

Break Trader

New member
is it possible to script a 3 to 5 years revenue percentage growth label for chart and or watch column
also same for a 3 to 5 year EPS percentage growth label for chart and or watch column?
I have been searching every where but no luck. If I can be done it sure would help.
Maybe Sales growth ?
 
Last edited:
P

PSK

New member
VIP
is it possible to show on the chart percent drop or gain after each earnings?
 
O

Orios

New member
alright so i have no experience with thinkscript but i have an idea for a think script or possible scan query. im hoping someone could help me with this.
so here we go.
-financial markets are reflective of the past.. what youll notice is that some assets post earnings regardless of beat or miss will either go up or go down
-an example would be msft in the past 5 yrs has gone up 90% of the time post earnings.
-i did see there's a earnings trend indicator posted by one of you guys. what im asking for is a slight variation on that
-im looking for historical price performance post earnings
 
O

Orios

New member
side bar. can someone help add a custom filter in a column that shows when an earnings date is for a company. from work im only able to use mobile but havent found a filter for earnings dates
 
S

soary

Member
NICE! This is very useful.
Good idea Orios but not just historical price performance post earnings but also a certain % move up/down

TOS has something similar but without %
TOS ->analyze tab->earnings shows next earnings date on top->volatility implied & historical, ATM straddle move, EPS comparison of actual vs wall street in trend lines
 
Last edited:
O

Orios

New member
NICE! This is very useful.
Good idea Orios but not just historical price performance post earnings but also a certain % move up/down
You can figure that out using options usually the stays in the expected range. A rough estimate is taking the 15 Delta put and call adding them together. Then from current price plus or minus. I have an Excel sheet that does it with the actual calculation but yeah as long as you know standard deviation based on options it tends to stay in that range 68.2% of the time. For earnings the hardest part is knowing probable direction especially if you want to flip money fast. Like right now I could do just 13 Delta iron condors roughly a month out and still win roughly 70 to 80% of the time. But if I knew the usual direction poster earnings I skew bets towards usual outcomes and have the ability to free up capital sooner
 
S

soary

Member
You can figure that out using options usually the stays in the expected range. A rough estimate is taking the 15 Delta put and call adding them together. Then from current price plus or minus. I have an Excel sheet that does it with the actual calculation but yeah as long as you know standard deviation based on options it tends to stay in that range 68.2% of the time. For earnings the hardest part is knowing probable direction especially if you want to flip money fast. Like right now I could do just 13 Delta iron condors roughly a month out and still win roughly 70 to 80% of the time. But if I knew the usual direction poster earnings I skew bets towards usual outcomes and have the ability to free up capital sooner
I like using Excell what is the formula? I;m guessing you're talking about expected move.
 
O

Orios

New member
I like using Excell what is the formula? I;m guessing you're talking about expected move.
Candle open price of aggregation period * options IV of stonk /100 * sqroot(days to expiration/365)

That's the basic formula
 
O

Orios

New member
im looking for a way to make a scan query showing tickers 3-5 days after earnings have occurred rather 3-5 before earnings have occurred. im new, i dont know what to do. i look at the code and feel alone and scared. please help
 
J007RMC

J007RMC

Well-known member
2019 Donor
VIP
This is an upper chart earnings, estimated, actual, percent gain/loss indicator

Code:
def price = close;
def estimate = GetEstimatedEarnings();
def actual = GetActualearnings();
def get_price = if estimate and actual then price else get_price[1];
def gain = (actual – estimate);
AddChartBubble(estimate,close, “Est: ” + estimate + “\nAct: ” + actual + (if gain <= 0 then "\nLoss: " else “\nGain: ”) + gain, if actual <= estimate then CreateColor(247, 25, 91) else CreateColor(25, 202, 247));
 
Last edited by a moderator:
wilmanv

wilmanv

Member
VIP
Any script to show the date for Earnings on the chart , that show me highlighted

Thanks
 
C

Craighaber71

Active member
2019 Donor
VIP
If You hit the gear Icon on the chart....Go to the equities tab...check the show corp actions
 
B

Bamilus

New member
I love this script, but just an FYI. For some reason, I don't know why the corporate actions (the little circles at the bottom of each chart if enabled) doesn't actually show quarterly EPS. For example, symbol AMT, reported diluted EPS of 1.26 for Q4 2019 in February 2020. The corporate actions shows $1.93, and consequently so does this indicator. However, if you look at the Fundamentals tab in TOS it shows the correct $1.26. I did some digging and the $1.93 comes from AFFO, which is a non-GAAP measure. While non-GAAP measures such as AFFO or EBITDA can be helpful to understand the core operations of a company, they're also different for every company/industry and therefore are considered non-GAAP, because they are subject to managements interpretation. If you look at their 4Q Earnings 8-K it shows quarterly EPS of $1.26.

And note that non-GAAP measures can and often are drastically different from GAAP measures, such as EPS, in terms of dollars and percentage change. AFFO Q3 19 for AMT was $2 vs $1.93 for Q4, for a decrease of 7 cents a share. Diluted quarterly EPS was $1.12 for Q3 19 and $1.26 for Q4, for a gain of 14 cents a share. Comparing preceding quarter is bad analysis, because of seasonality, but I just wanted to demonstrate how you need to understand what this indicator is actually showing.

I've done this analysis with other companies and have come to the same conclusion.

Tl;dr - this indicator uses non-GAAP measures and not actual diluted quarterly EPS, so use caution when analyzing it. Non-GAAP measures have their use if you understand them and how they reconcile to GAAP EPS, but EPS is still king.
 
B

Bamilus

New member
So, I discovered there's a function for the HistoricalEPS (https://tlc.thinkorswim.com/center/reference/thinkScript/Functions/Stock-Fundamentals), I've been playing around but have found no examples and so far have been unable to get any code to work because I don't know how the constant fiscalperiod.QUARTER is to be defined (e.g. =1? =Q1?).

Google search showed that basically no one uses these functions, but if I can figure out how to define the fiscalperiod I think we could swap that in instead of the corporate actions getearnings pull.
 

Similar threads

Top