One aspect I really appreciate of charting apps that offer custom coding capabilities is that you can present information visually that typically is not shown in that manner. For example with a few lines of thinkscript code you can plot a line graph of quarterly EPS in thinkorswim.
What follows is a screenshot of the line graph I wrote in less than 30 lines of code. The red and green dots represent the quarterly earnings, indicating if the current results were up/down from the previous report. I also appended at the bottom of the image the optional EPS bubble.
Installing the EPS Line Graph
If you have thinkorswim installed, click here to install the EPS line graph from the thinkorswim Sharing Center.
You can also copy/paste the link into thinkorswim’s Open Shared Item feature, the link is: https://tos.mx/gzJMkvw.
EPS Line Graph thinkscript Code
Here’s the code to create the line graph as well as show the optional chart bubble.
# EPS line graph # # Written by: @JohnMuchow http://twitter.com/JohnMuchow # Website: PlayTheTrade.com # # v1.0 declare lower; input showEPSBubble = yes; def e = GetActualEarnings(); def earnings = CompoundValue(1, if IsNaN(e) then earnings[1] else e, e); # Plot the earnings as a line plot earningsLine = e; earningsLine.SetPaintingStrategy(PaintingStrategy.POINTS); earningsLine.SetDefaultColor(CreateColor(90, 122, 176)); earningsLine.hideTitle(); # Given earnings are not relevant for each bar, approximate line from bar to bar earningsLine.EnableApproximation(); # Plot green/red dot indicating earnings up/down plot earningsUpDownIndicator = GetActualEarnings(); earningsUpDownIndicator.SetPaintingStrategy(PaintingStrategy.SQUARES); earningsUpDownIndicator.AssignValueColor(if earnings > earnings[1] then (CreateColor(120, 184, 86)) else CreateColor(164, 36, 22)); earningsUpDownIndicator.SetLineWeight(4); earningsUpDownIndicator.hideTitle(); # Optional EPS bubble AddChartBubble(showEPSBubble, earningsUpDownIndicator, earnings, Color.GRAY);
September 13, 2020 at 10:40 am
Nice. Thanks John. Should be on MarketSmith too (it’s on WONDA).
September 13, 2020 at 2:28 pm
Great Study, Thanks John.
Is it possible to add future estimates on a box to the side of the plot?, not sure if the raw data is actually available on TOS.
September 13, 2020 at 2:49 pm
Unfortunately, it seems there is no earnings estimate information available in TOS.
September 13, 2020 at 8:11 pm
John
This is great really helpful.
I have two requests for you:
Is it possible to do the comparison to the same quarter the previous year rather then the previous quarter?
Could the bubble display percentage growth vs same quarter previous year as well as the EPS?
Thank You
Esteban
September 13, 2020 at 8:16 pm
Thanks Esteban, the results show quarterly earnings per share compared to earnings in the same quarter of the previous year. Same with the chart bubble.
September 17, 2020 at 4:20 pm
Thanks john
Is there any way to show percentage growth vs previous quarter?
September 17, 2020 at 7:06 pm
Esteban, you might be able make this work by keeping track of the EPS of the current quarter and then when you find the next quarter, do the math to determine the % change. You could add the information into the chart bubble.
September 19, 2020 at 2:00 pm
I could be wrong, but to me color of earning green or red is based on previous quarter vs same quarter previous year. correct me if I am wrong. I am very thankful of you doing good work here. I copied webbi’s RSI. i will copy earning graph too. Thank you again.
September 19, 2020 at 5:37 pm
Rakesh, the results show quarterly earnings per share compared to earnings in the same quarter of the previous year. Same with the chart bubble. Check out this tweet that shows the results are the same in MarketSmith as they are with the TOS script (for MSFT): Quarterly Earnings Tweet
September 14, 2020 at 2:06 pm
Looks great - thank you!
September 15, 2020 at 8:06 pm
Totally going to use this!!!! Nice work!!!