TradingView
Fred6724
28 กรกฎา 2022 เวลา 9 นาฬิกา 18 นาที

EPS & Sales 

Enphase Energy, Inc.NASDAQ

คำอธิบาย

Hi everyone,

I just adapted a little utility script to visualise EPS % increase (quarters vs Year -1) and sales.

I used the code from @ARUN_SAXENA and modified it to fix what I saw as issues.
(Using base 3M instead of 1M +
request.earnings(syminfo.tickerid, earnings.actual, ignore_invalid_symbol=true)
instead of
request.financial(syminfo.tickerid, "EARNINGS_PER_SHARE", "FQ")

Data will differ from MarketSmith because they use sometimes actual EPS sometimes standard, but think we can at least trust what we see in term of %

The tool is far from being perfect !

เอกสารเผยแพร่

Just modified a condition that was making the script bug on given charts

เอกสารเผยแพร่

MarketSmith tag added

เอกสารเผยแพร่

Modified:
- Displays NaN when both EPS used for calculation are negative
- Displays + when increase is positive :)
- Modified calculation system, use the closer EPS to 0 when both reported and standard EPS are negative
We are now very close to the calculation method of MarketSmith.
Sometimes number differs but results are often close when differents.
To be honest I always confirm with shared graph on Twitter.

เอกสารเผยแพร่

Now displays '#' in front of EPS growth % to indicate if an EPS for calculation is negative

เอกสารเผยแพร่

Modified some comments to help to understand what I did.
if you have any constructive suggestions, please let me know in the comments

เอกสารเผยแพร่

- You can now change colors to suit your theme

เอกสารเผยแพร่

- Removed indicators that were polluting the visual overview

เอกสารเผยแพร่

- Adjusted Original Colors

เอกสารเผยแพร่

- The Script is now directly added to the chart when added
- Removed the grid transparency
- Added the possibility to choose the position of the table

เอกสารเผยแพร่

- Added the possibility to show the gross margin
- Tried to display Yearly EPS but highly inaccurate results convinced me to only keep the code under comments in case someone one day is able to calculate manually ?
- I'm still not satisfied with the code.
Ex:
- CELH one result is missing
-AEHR, this shoudn't happen but in Da, We, Mo, results differs. The problem is that we need to search previous earning with time and sometimes it defers from one stock to another.
I would love to find a way to get previous earning without using the time.

เอกสารเผยแพร่

- I have removed the colour from the table frame as it pollutes the price graph

เอกสารเผยแพร่

- Modified the code because the case where actual EPS was negative and reported EPS was positive was not taken into account.
(Now the '#' is diplayed correctly)
- Added the possibility to display ROE
- Added the possibility to show EPS used for calculation

เอกสารเผยแพร่

- Now return NaN when last EPS is negative and EPS of the previous year is positive

เอกสารเผยแพร่

- Now possible to plot EPS curve on the graph with another scale on the left.
Please tell me if you don't like this update, because it adds a left scale whether this new option is checked or not

เอกสารเผยแพร่

- I finally corrected the time base period and replace the "3M" by the function barssince. This corrected the bug on AEHR.
I complained about if few updates ago :)

เอกสารเผยแพร่

- Found that plotting EPS line on another scale was not very usefull
So I decided to replace them by Arrow on the chart showing EPS date and EPS % variation as you can see on MarketSmith graph
I have no solution to plot them at the bottom of the graph, if you know how, don't hesitate to tell me in comment
(I can't reply to personal messages for now)

เอกสารเผยแพร่

- Corrected the case in which EPS display is negative to avoid +-50%

เอกสารเผยแพร่

- Now the color of positive or negative variations also affects the color of the text under the arrows
- You can select arrow colors
- You can select the 'EPS' text color

เอกสารเผยแพร่

- You can now adjust the size of the table.

เอกสารเผยแพร่

- Corrected the case where arrow displayed the wrong balue between EPS reported or standard

เอกสารเผยแพร่

- Modified the case in which when both reported and standard EPS are negative, but the closer to 0 is > than -0.01, is not taken into account.
(Corrected the #+999% in APA which was #+712%)

เอกสารเผยแพร่

- Added comparison regarding sales too
- Renamed all the variables in the code that were confusing
(+ some comments here and there to facilitate understanding)
- Integrated the calculation of QoQ EPS without changing the general appearance of the script
(This way I hope I won't be HARASSED anymore :p)
- Added the viewing of 3 additional quarters
And finally...
- I really hope that, like me, you'll love the new look ! (If not you can still save it to your taste)

เอกสารเผยแพร่

(forgot to remove drawings on the chart...!)

เอกสารเผยแพร่

- Corrected the display of QoQ Eps when equals to YoY (could have and unforced # in front of result)

เอกสารเผยแพร่


- Finally managed to display the quarters in MMM-yy format:-)

เอกสารเผยแพร่


- And corrected size of the text of the date that I forgot !

เอกสารเผยแพร่


- Arranged the settings to allow an easier and more intuitive customization of the interface

เอกสารเผยแพร่


Added :
- Now possible to see Sales on the graph under EPS information
- Changed the QoQ visual
- Added Sales QoQ
- Reorganised Input
- Now possible to change text Color on the graph independently

เอกสารเผยแพร่


- Reduced the number of label to allow more historical data on the graph (regarding arrow part)

เอกสารเผยแพร่

- Replaced 'NaN%' by 'N/A' and change color from red to black.

เอกสารเผยแพร่

- Added the correct display of N/A vs N/A instead of NaN vs NaN on the table and on the arrows
- Changed color of the case where variation% = 0% in black color. (Both EPS & Sales)
- Corrected the display of +/-∞% by N/A.

เอกสารเผยแพร่

- Now the script correctly displays EPS and % when the EPS value is the same twice in a row.
- Corrected the synchronization between the EPS and Sales rows in the table
LYTS and WING were not correct, now they are.

เอกสารเผยแพร่

Arrow part:
- Modified NaN% value to N/A
- Modifier N/A color
- Corrected the 0% color

Table part:
- Changed GROSS MARGIN into GM
- Corrected the case where eps1 was negative and eps4 was 0 -∞% -> N/A
- NaN vs NaN -> N/A vs N/A on QQQ
- Recorrected the 0% color
(I think TV displayed me an old previous version of the script so I had to re-write the two last points)

เอกสารเผยแพร่

- Now +0% in blue is turned to 0% in black :3

เอกสารเผยแพร่

- On the EPS day, TradingView provides the same sales number than the previous one instead of seeking for the new one. This cause a wrong data display on the last line and it can bring confusion.
I decided to identifiy this time and replace the sales and variation number by N/A. I will remove this if TradingView correct this bug.

เอกสารเผยแพร่

- Same change than above but for the text under arrows on graph.

เอกสารเผยแพร่

- In the case of a sales display changed to N/A on the EPS day, the script now displays the sales value as soon as it is available. Here in the post-market of the earning day.

เอกสารเผยแพร่

- Added the case where Sales are the same the day after the earning event

เอกสารเผยแพร่

- Correction of a bug with the last update

เอกสารเผยแพร่

- Corrected -10000% bug
- Now displays Sales in MIL or BIL

เอกสารเผยแพร่

- Corrected the display of x,x Bil$ to xxxx,x Mil like MarketSmith
- Corrected the case where sales are the same number at day+1 after eanring event

เอกสารเผยแพร่

- Added a black Frame arround the table

เอกสารเผยแพร่

- Changed the size of the column to have the same ratio than MarketSmith's table
- Changed the Graph for better presentation

เอกสารเผยแพร่

- Adjusted Colors
- Input have been reorganised and simplified

เอกสารเผยแพร่

- Arrow size is now adjustable
- We can now display the %variation anyway even if the actual/reported EPS is negative
- Limitation added to -999%
- We can now display surprises on the table
- Input reorganised

เอกสารเผยแพร่

- Little mistake on inputs, my bad! Corrected

เอกสารเผยแพร่

- Corrected the display that was broken when "Surprise" and "Less Quarters" were checked.
- Changed to Presentation Graph

เอกสารเผยแพร่

-Now possible to display the Daily Table of EPS & Sales.
(I did it because I was asked many times, I am not very satisfied with the result, the table functions of tradingview are not flexible enough to do everything I would like to do.
There are now inputs that manage the appearance of both tables.)
-Data alignment

เอกสารเผยแพร่

- Added a delimitation on the table type Daily

เอกสารเผยแพร่

- Corrected a display in the Daily table

เอกสารเผยแพร่

- Corrected a wrong color in the Daily table

เอกสารเผยแพร่

- The space between the title and the result is as close as possible to the one of MarketSmith
- Changed the presentation graphique

เอกสารเผยแพร่

- Arranged the | on the Daily Table not to appear when Table Border is set to 1

เอกสารเผยแพร่

- Added max_albels_count = 500 to display more historical arrows on the graph
- Organized the alignment of the column (Surprise, ROE, GM)
- Used another method for sales and EPS to have as much historical data as possible, currently 3 variations in % on NYSE:IOT against only one before

เอกสารเผยแพร่

- Modified the Sales Growth YOY method calculation to display more data on IPO.
Impressive results for example on IOT where we can display 4 additional lines compared to the previous method

เอกสารเผยแพร่

- Corrected the way to detect a duplicate in the recent sales announcement

เอกสารเผยแพร่

- Corrected the case where sales number where the new sales figure was updated and not the % change for recent earning

เอกสารเผยแพร่

- Corrected a minor bug that occured when two earnings where close one to another and we had the same % variation. Now the code detects it and recalculate the variation.

เอกสารเผยแพร่

- Modified the order of the table Size selection in the input

เอกสารเผยแพร่

- Added customisable table border and frame
- Corrected the Gross Margin and Return on Equity offset

เอกสารเผยแพร่

- The oppocity of the weekly table is now working. Thank you @bognog for pointing the issue.

เอกสารเผยแพร่

- Corrected shifting color to transparant of the daily table
- Now the script runs if don't find fundamental data

เอกสารเผยแพร่

- Added Estimates for the very next Earning to come
- YoY and QoQ can be viewed separately
- We can now view the QoQ %Change on arrows
- EPS Due date has been added on HeadBand type table
- Default setting now show the Surprise variation
- Reorganised inputs
- Changed the look of the table toward new 'MarketSurge' type look

เอกสารเผยแพร่

- Corrected wrong digit on the 'versus' display on sales after @B_Kaminski pointed it out

เอกสารเผยแพร่

- Corrected the display of # and N/A for estimates
- Simplified the # and N/A System detection
- Added # system as an input option
- Added Quick pre-designed looks based on MarketSmith and MarketSurge Tables
- Corrected GM and ROE estimations values from 0% towards -
- Made the display of variation% of EPS & Sales without arrows as an option

เอกสารเผยแพร่

- Corrected the MarketSurge Type Table Look
- Added the variation when negative EPS by default
ความคิดเห็น
B_Kaminski
Thank you for your great work Fred! The est. percent change is right for the eps and sales. Only the old number for sales YoY is false. Thx!
Fred6724
@B_Kaminski, Thank you very much! :)
Sometimes 'TOTAL_REVENUE' differs from 'actual revenue' yes, but it is not 'wrong'. What do you suggest for me to improve the code?
B_Kaminski
@Fred6724, it is only the wrong vs number in the YoY overview estimates. Estimates YoY 2024 in sales take not the old number vs in sales from march 2023 - there stands the vs. number sales from december 2023. Percent est. sales YoY 2024 vs 2023 is right. So it takes the right number march 2023 and not december 2023. It would be great if you can correct it. Greetz Boris
Fred6724
@B_Kaminski, Oh sorry! You're right! I'll correct this.
Henkeh91
Awesome script mate! Are there any possibility to show both YoY and QoQ change at the same time in the table?
Fred6724
@Henkeh91, I'm not planning to do it right now but someday why not :)
GrahamGAZ
@Fred6724, YES PLEASE!! YoY and QoQ in the table.
mrbrown81k
@GrahamGAZ, agree that yoy would be amazing just the way marketsmith displays it, awesome work!
Fred6724
@mrbrown81k, Updated with what you asked!
mrbrown81k
@Fred6724, Thank you!!! Now last requests to make this absolutely perfect. First of all having the option to choose gross margin and net margin(Ive already programmed it myself) and on table view to be able to show YOY stats only rather than QoQ. So 2021 , 2022 , 2023, 2024 , 2025 est. Not Dec 22, Mar 23, Jun 23 etc.. You are the best thank you so much !
เพิ่มเติม