Historical Earnings Trend Indicator for ThinkorSwim

I am looking to see only the yearly EPS. Is there a function that I can use in the code to plot that? I tried EarningsPerShare TTM but that plotted too many data points. I am trying to only connect total yearly earings (one point per year).Thanks
If you use a yearly aggregation then by default you get one point per year
 
Is there a way to make the range of the study set to auto? I'm using this at the bottom of my chart and some values are getting cut off. They are seen if I expand the study area vertically
LahL4gn.png
 
Is there a way to measure the change of the EPS? Either via the line angle or the % change in EstEarning /EstEarning [1]?

def height = EPS - EPS [1];
def x = ROUND((ATan(height)) * (180 / Double.Pi),0);
 
This indicator will display past earnings.
This can be beneficial for traders who use historical earnings data, to help identify trends, patterns, and potential risks as part of their investment decision.
  • Red Squares = Earnings Lower
  • Green Square = Earnings Higher
  • Red Arrow = Earnings below estimates
  • Green Arrow = Earnings above estimates
  • Point of Arrow = Earnings estimates
View attachment 5368

Another great share by @KRose_TDA on Twitter.

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
Hello, I am looking for some help with the above script. Specifically, I am attempting to do two things.

First, I am trying to modify the above script to use as a scanner when there are 3 green boxes in a row. Essentially, I want to find stocks that have increased, or accelerating, earnings over the previous 3 quarters.

I believe it would be with this line:
earnings_date.AssignValueColor(if EPS > EPS[1] then color.dark_green else color.red);
earnings_date.SetLineWeight(5);

Would I have to use the "and" function? If EPS > EPS [1] and EPS[1] > EPs [2] and EPS[2] > EPS [3]


My second attempt is to look for stocks that have increased from the same quarter of the previous year. I think I worked that out with this:

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

By changing the EPS[1] to EPS[4], would it look at 4 quarters ago? Again, how would I turn this into a scan?

Thanks!
 
Hello, I am looking for some help with the above script. Specifically, I am attempting to do two things.

First, I am trying to modify the above script to use as a scanner when there are 3 green boxes in a row. Essentially, I want to find stocks that have increased, or accelerating, earnings over the previous 3 quarters.

I believe it would be with this line:
earnings_date.AssignValueColor(if EPS > EPS[1] then color.dark_green else color.red);
earnings_date.SetLineWeight(5);

Would I have to use the "and" function? If EPS > EPS [1] and EPS[1] > EPs [2] and EPS[2] > EPS [3]


My second attempt is to look for stocks that have increased from the same quarter of the previous year. I think I worked that out with this:

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

By changing the EPS[1] to EPS[4], would it look at 4 quarters ago? Again, how would I turn this into a scan?

Thanks!

Unfortunately no.
Fundamentals can not be used in custom scans.
read more:
https://usethinkscript.com/threads/...labels-for-thinkorswim.5308/page-4#post-88803
 
Code:
def eps = GetActualEarnings();
AddChartBubble(eps,close,eps,color.YELLOW);

I am finding many stocks with missing earnings data for the last quarter of 2023. (see HSY, JNJ, KO) Is this common for thinkorswim to have unusable data?


Recursion doesn't solve the problem of missing data. Look at KO. On 10/24/23 it reported earnings of 0.74 but there is no value returned for that date. Even the default chart shows an earnings date icon on the chart but no reported value. This is the same for many stocks. missing data == unusable data
 
Last edited by a moderator:
Hello All,

I am requesting a thinkcript that plots earnings vs. time. I intend to plot the graph on the main price action chart. I tried using the attached script but could not see the plot. Can anyone please help?

Thank you very much

Code:
def Earn = GetactualEarnings();
plot a = earn;
 
Hi,

Can anyone help with study that Yearly sales and earnings of past few years and estimated Yearly sales and earnings for next 2 years. Also YOY increases or decreases

Similarly for quaterly sales and earnings. something like attached image.


Thanks,
Phani
 

Attachments

  • Screenshot 2024-11-29 at 1.57.23 PM.png
    Screenshot 2024-11-29 at 1.57.23 PM.png
    120.9 KB · Views: 15
Hi,

Can anyone help with study that Yearly sales and earnings of past few years and estimated Yearly sales and earnings for next 2 years. Also YOY increases or decreases

Similarly for quaterly sales and earnings. something like attached image.


Thanks,
Phani
The ToS platform provides limited ability to interact with fundamentals.
If you are asking for labels on a chart; here is what is available:
https://usethinkscript.com/threads/financial-fundamentals-labels-for-thinkorswim.5308/

If you are asking for a scan of fundamentals; here is what is available:
https://usethinkscript.com/threads/...or-basic-fundamental-analysis.866/#post-49702
 

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
393 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