Financial Fundamentals Labels for ThinkorSwim

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

@bboyapollo ...I'm not MerryDay and didn't write the code here but will attempt to help answer your questions.

Not every function returns the value you expect or any value. In this case, the function 'IsNaN' is being used to test if there is a numeric value being returned by the function 'EarningsPerShareTTM()' ...this results a 'True' test if there is Not a Number or a 'False' test if a numeric value is returned by 'EarningsPerShareTTM()' ...IsNaN is being used as in-flight error control or a trigger to advance to another event (or function) you want to happen. So, if no number is returned (the IF statement is True), then EarnPerShare[1] variable is engaged as the True action in the IF THEN statement. If a number were returned (the IF statement is False), then the 'else EarningsPerShareTTM()' function would kick in as the False action in the IF THEN statement. IsNaN tripped me up quite a bit when I started, because of the reverse logic, but try to use IsNaN a few times in your own code, and it will come clear.

[1] is (what I refer to) an index value or a position in line that tells the function or variable to refer to the next index value after [0]. For example, the first person in a ticket line would be [0], second person [1], etc. Assume the function 'Today[0]' returns the date for the current day...[0] being the current day or the date associated with the index value of 0. In the case of functions, the current index value [0] is almost always implied, so you don't need to write it. You just write 'Today' or Today() ...If you wanted yesterday' date, the function 'Today[1]' would return yesterday's date, and 'Today[2]' would return the day-before-yesterday's date, to infinity or when there are no more index values (no more people in the ticket line). Don't be surprised when you run across index value [-1]...which Today[-1] would refer to tomorrow's date :) ...such as Open[-1], which means the stock price on tomorrow's open where Open[1] means yesterday's open price.

The best way to learn this stuff is to learn it line-by-line as you noted, read the Learning Center pages, test, re-write, test, re-write...just keep banging out the code and researching until you figure it out... The way I learned Thinkscript was to create a new indicator and copy/paste the built-in code into my own Indicators, then comment out (#) the built-in code and re-wrote it my own style until I got it right. Try copy/pasting the native MACD indicator code into your indicator are then rewriting MACD in your style. Then alter it to add/learn new stuff. Learn it to the point that you can explain it to someone else :) Some of my rambling above may be incorrect, but this is how I understand it, and I get along with it quite well...but always still learning.

https://tlc.thinkorswim.com/center/reference/thinkScript/Functions/Math---Trig/IsNaN

All the best.
Thanks for taking the time and explaining this to me. I finally understood it when I practiced using the code in various ways, though I found a big flaw. When I expected last quarter's EPS it instead gave me the current one. FOR EXAMPLE:

Using Addlabel to test what number I get, if I tested Earnpershare[1] I got the current Q EPS (I was like WHAT!?? NO! Thats not what I'm asking !!!). What I eventually found out was that it was giving me ONE Bar Ago EPS value, NOT the previous Q, which is what I want. Somehow it works only when plotted and using the function itself. It's almost as if there's magic in the code that when no one actually looks inside using the Addlabel to test LOL :LOL:

Anyways thanks again. I totally agree practicing writing it my way is literally the only way I understand the code, haha.
 
This indicator displays fundamental data of a stock, including financial info such as Free Cash Flow, Profit Margin, etc., on your chart.
An overall weighted Score is calculated to gauge the overall financial health.

Use on a Daily Chart. Useful for anyone interested in fundamental stock research.
AiGdPyb.png

Ruby:
#Fundamental Data Labels _Mobius 4/26/20 (found on OneNote)
#
# @MerryDay revised 4/21:
# my interpretation of positive/negative values; should be modified to meet your strategy
# then calculated an overall weighted score based on:
# https://tradestation.tradingappstore.com/products/FundamentalScore/document/Fundamental_Score.pdf
# and other information found on the web
declare lower;
DefineGlobalColor("Pre_Cyan", CreateColor(50, 200, 255)) ;
DefineGlobalColor("LabelGreen",  CreateColor(0, 165, 0)) ;
DefineGlobalColor("LabelRed",  CreateColor(225, 0, 0)) ;
DefineGlobalColor("Violet", CreateColor (200, 125, 255)) ;
DefineGlobalColor("GrayGreen",  CreateColor(155, 167, 76)) ;
DefineGlobalColor("LitePink", CreateColor (220, 180, 180)) ;
DefineGlobalColor("neutral",  color.light_gray) ;
def fp = FiscalPeriod.YEAR;
def EPS = EarningsPerShareTTM(fiscalPeriod = fp);
def PE = round(close / EPS,1);
AddLabel(PE, "P/E ratio = " + Round(PE, 2),
                      if PE < 0 then GlobalColor("LitePink") else
                      if PE < 20 then GlobalColor("LabelGreen") else
                      if PE < 40 then GlobalColor("GrayGreen") else GlobalColor("Pre_Cyan"));

def EarnPerShare = if IsNaN(EarningsPerShareTTM())
                   then EarnPerShare[1]
                   else EarningsPerShareTTM();
AddLabel(EarnPerShare, "EPS-TTM = " + AsDollars(EarnPerShare),
                      if EarnPerShare > 0 then GlobalColor("LabelGreen") else GlobalColor("LitePink"));

def FreeCashFlowPerSh = if isNaN(FreeCashFlowPerShare())
                        then FreeCashFlowPerSh[1]
                        else FreeCashFlowPerShare();
AddLabel(FreeCashFlowPerSh, "Free Cash Flow Per Share = " + AsDollars(FreeCashFlowPerSh),
                  if FreeCashFlowPerSh > 0 then GlobalColor("LabelGreen") else GlobalColor("LitePink"));
def score_EarnCash = if PE <0 and FreeCashFlowPerSh < 0 and EarnPerShare < 0 then 0 else 5;

def Gross_Profit_Margin = if IsNaN(GrossProfitMargin())
                          then Gross_Profit_Margin[1]
                          else GrossProfitMargin();
AddLabel(Gross_Profit_Margin, "Gross Profit Margin = " + Round(Gross_Profit_Margin, 2),
               if Gross_Profit_Margin > 0 then GlobalColor("LabelGreen") else GlobalColor("LitePink"));

def Operating_Profit_Margin = if IsNaN(OperatingProfitMargin())
                              then Operating_Profit_Margin[1]
                              else OperatingProfitMargin();
AddLabel(Operating_Profit_Margin, "Operating Profit Margin = " + Round(Operating_Profit_Margin, 2),           
              if Operating_Profit_Margin > 0 then GlobalColor("LabelGreen") else GlobalColor("LitePink"));


def Net_Profit_Margin = if IsNaN(NetProfitMargin())
                        then Net_Profit_Margin[1]
                        else NetProfitMargin();
AddLabel(Net_Profit_Margin, "Net Profit Margin = " + Round(Net_Profit_Margin, 2),
               if Net_Profit_Margin > 0 then GlobalColor("LabelGreen") else GlobalColor("LitePink"));
def score_Profits = if Gross_Profit_Margin>0 or Net_Profit_Margin>0 or Operating_Profit_Margin > 0 then 3 else 0 ;

def CurRatio = if IsNaN(CurrentRatio())
               then CurRatio[1]
               else CurrentRatio();
AddLabel(CurRatio, "Current Ratio = " + Round(CurRatio, 2),
               if CurRatio > 2  then GlobalColor("GrayGreen") else
               if CurRatio >= 1 then GlobalColor("LabelGreen") else GlobalColor("LitePink"));

def Quick_Ratio = if IsNaN(QuickRatio())
                  then Quick_Ratio[1]
                  else QuickRatio();
AddLabel(Quick_Ratio, "Quick Ratio = " + Round(Quick_Ratio, 2),
               if Quick_Ratio > 2  then GlobalColor("GrayGreen") else
               if Quick_Ratio >= 1 then GlobalColor("LabelGreen") else GlobalColor("LitePink"));
def score_Ratios = if Quick_Ratio >= 1 or CurRatio >= 1 then 3 else 0;

def Return_On_Assets = if IsNaN(ReturnOnAssets())
                       then Return_On_Assets[1]
                       else ReturnOnAssets();
AddLabel(Return_On_Assets, "Return On Assets = " + Round(Return_On_Assets),
              if Return_On_Assets >= 15 then GlobalColor("Pre_Cyan") else
              if Return_On_Assets >= 10 then GlobalColor("LabelGreen") else
              if Return_On_Assets > 0 then GlobalColor("GrayGreen") else GlobalColor("LitePink"));


def Return_On_Equity = if IsNaN(ReturnOnEquity())
                       then Return_On_Equity[1]
                       else ReturnOnEquity();
AddLabel(Return_On_Equity, "Return On Equity = " + Round(Return_On_Equity),
              if Return_On_Equity >= 15 then GlobalColor("Pre_Cyan") else
              if Return_On_Equity >= 10 then GlobalColor("LabelGreen") else
              if Return_On_Equity > 0 then GlobalColor("GrayGreen") else GlobalColor("LitePink"));
def score_Returns = if Return_On_Equity >= 10 or Return_On_Assets >=10 then 1 else 0 ;


def Sales_Per_Share = if IsNaN(SalesPerShare())
                      then Sales_Per_Share[1]
                      else SalesPerShare();
AddLabel(Sales_Per_Share, "Sales Per Share = " + Round(Sales_Per_Share, 2),
                      if Sales_Per_Share > 0 then GlobalColor("LabelGreen") else GlobalColor("LitePink"));
def score_Sales_Per_Share = if Sales_Per_Share > 0 then 1 else 0;

def FixChgCovRatio = if IsNaN(FixedChargeCoverageRatio())
                     then FixChgCovRatio[1]
                     else FixedChargeCoverageRatio();
AddLabel(FixChgCovRatio, "Fixed Charge Coverage Ratio = " + Round(FixChgCovRatio, 2),
                     if FixChgCovRatio >= 1 then GlobalColor("LabelGreen") else GlobalColor("LitePink"));

def Total_Asset_Turnover = if IsNaN(TotalAssetTurnover())
                           then Total_Asset_Turnover[1]
                           else TotalAssetTurnover();
AddLabel(Total_Asset_Turnover, "Total Asset Turnover = " + Round(Total_Asset_Turnover, 2),
               if Total_Asset_Turnover > 1 then GlobalColor("LabelGreen") else  GlobalColor("neutral"));

def FinLev = if IsNaN(FinancialLeverage())
             then FinLev[1]
             else FinancialLeverage();
AddLabel(FinLev, "Financial Leverage = " + Round(FinLev, 2),
                      if FinLev > 0 and FinLev < 2 then GlobalColor("LabelGreen") else GlobalColor("LitePink"));
def score_FinLev = if FinLev < 2 then 1 else 0;

def BookValue = if IsNaN(BookValuePerShare())
                then BookValue[1]
                else BookValuePerShare();
AddLabel(BookValue, "Book Value Per Share = " + Round(BookValue),
                if BookValue < 2 then GlobalColor("Pre_Cyan") else
                if BookValue < 3 then GlobalColor("LabelGreen") else GlobalColor("neutral"));

def Long_Term_Debt_To_Capital = if IsNaN(LongTermDebtToCapital())
                                then Long_Term_Debt_To_Capital[1]
                                else LongTermDebtToCapital();
AddLabel(Long_Term_Debt_To_Capital, "Long Term Debt To Capital = " + Round(Long_Term_Debt_To_Capital, 2),
 if Long_Term_Debt_To_Capital < 5 then GlobalColor("LabelGreen") else GlobalColor("LitePink"));
def score_Long_Term_Debt_To_Capital = if Long_Term_Debt_To_Capital < 5 then 1 else 0;

def Inventory_Turnover = if IsNaN(InventoryTurnover())
                         then Inventory_Turnover[1]
                         else InventoryTurnover();
AddLabel(Inventory_Turnover, "Inventory Turnover = " + Round(Inventory_Turnover, 2),
               if Inventory_Turnover < 5  then GlobalColor("LitePink") else
               if Inventory_Turnover < 10 then GlobalColor("Pre_Cyan") else
               if Inventory_Turnover < 15 then GlobalColor("GrayGreen") else GlobalColor("LitePink"));

def DivPayout = if IsNaN(DividendPayout())
                then DivPayout[1]
                else DividendPayout();
AddLabel(DivPayout, "Dividend Payout = " + round(DivPayout,2) + "%", GlobalColor("neutral"));

def DivPerShare = if IsNaN(DividendsPerShareTTM())
                  then DivPerShare[1]
                  else DividendsPerShareTTM();
AddLabel(DivPerShare, "Dividend Per Share = " + AsDollars(DivPerShare), GlobalColor("neutral"));

def DivYield = if IsNaN(DividendsPerShareTTM())
                  then DivPerShare[1]
                  else DividendsPerShareTTM()/Close;
AddLabel(DivPerShare, "Dividend Yield = " + AsPercent(DivYield), GlobalColor("neutral"));

def Interest_Rate = if IsNaN(InterestRate())
                    then Interest_Rate[1]
                    else InterestRate();
AddLabel(Interest_Rate, "Interest Rate = " + Round(Interest_Rate, 2), GlobalColor("neutral"));

def Tax_Rate = if IsNaN(TaxRate())
               then Tax_Rate[1]
               else TaxRate();
AddLabel(Tax_Rate, "Tax Rate = " + Round(Tax_Rate, 2), GlobalColor("neutral"));

plot score = score_Returns + score_EarnCash + score_ratios + score_Profits
           + score_FinLev + score_Sales_Per_Share + score_Long_Term_Debt_To_Capital;
AddLabel(yes, "SCORE: " + score,
if score >= 12 then GlobalColor("Pre_Cyan") else
if score >= 10 then GlobalColor("LabelGreen") else
if score >= 8 then GlobalColor("GrayGreen") else GlobalColor("LitePink"));
Are we wanting a high score or low or is there a sweet spot? Also, is there a way to do a scan on the calculated Score?
 
Are we wanting a high score or low or is there a sweet spot? Also, is there a way to do a scan on the calculated Score?
Fundamentals in isolation do not guarantee a profitable trade.
However, if your strategy is providing excess signals, and you are looking to narrow down the choices;
choosing a stock with a stronger (higher) fundamental score will stack the deck in your favor.

Read here about the issues with attempting to scan for the score and/or any fundamental value:
https://usethinkscript.com/threads/...labels-for-thinkorswim.5308/page-4#post-88803
 
Hi,
Learning about fundamentals here... So when u say CRM stock has great fundamentals in #1, what exactly are u looking at? Score? Margins?
 
Last edited by a moderator:
There was a time when reading a company's fundamentals was straight-forward.
We could look for 3 positive factors: low P/E ratio, healthy operating margin, positive book value and automatically know it was a financially strong stock.

P/E ratio was / is the gold standard of determining if a stock is over / under valued.
We looked for P/E ratios under 20-30 .
But that guideline no longer applies across the board.
There are whole sectors that trade at 3 or 4 times that ratio.
To read P/E ratio, it is imperative that you compare to the ratios of its competitors to determine what that sector is trading at.

Additionally, solid growth stocks can be trading at P/E ratios over 100. For those stocks, the totality of the financial statement must be reviewed.


The other important ratios are also no longer black or white.
There was a time, when companies that were unprofitable were not considered financially strong stocks.
They were so shunned, they had to create their own stock exchange to be traded.
Thus, the NASDAQ was born.


ToS platform does not have access to all the information necessary for us to do a true analysis of financial strength.
This indicator was created to give a weighted score to all the fundamentals to provide us SOME guidance.

Generally a score in the teens, means that you don't have to question if this is a strong stock.
A score below 7, has issues that may or may not make it a financial weak equity.
 
Last edited:
Label for P/E (Price/Earnings) and P/B (Price/Book Value)

I know that fundamentals information is available under the Analyze tab. I'd like to be able to get the price/earnings and price/book values as labels at the top of my charts.

Update:
I'm sorry I wasn't more clear. If you go to GE's numbers and scroll down you will find "Price/Earnings Ratio" = 13.96 and "Price/Book Value" = 3.83 (two digits after the whole number would be preferable). Thanks
 
Last edited by a moderator:
I know that fundamentals information is available under the Analyze tab. I'd like to be able to get the price/earnings and price/book values as labels at the top of my charts.

Ruby:
DefineGlobalColor("Pre_Cyan", CreateColor(50, 200, 255)) ;
DefineGlobalColor("LabelGreen", CreateColor(0, 165, 0)) ;
DefineGlobalColor("GrayGreen",  CreateColor(155, 167, 76)) ;
DefineGlobalColor("LitePink", CreateColor (220, 180, 180)) ;
DefineGlobalColor("neutral",  color.light_gray) ;

def fp = FiscalPeriod.YEAR;
def EPS = EarningsPerShareTTM(fiscalPeriod = fp);
def PE = round(close / EPS,1);
AddLabel(PE, "P/E ratio = " + Round(PE, 2),
                      if PE < 0 then GlobalColor("LitePink") else
                      if PE < 20 then GlobalColor("LabelGreen") else
                      if PE < 40 then GlobalColor("GrayGreen") else GlobalColor("Pre_Cyan"));

def EarnPerShare = if IsNaN(EarningsPerShareTTM())
then EarnPerShare[1]
else EarningsPerShareTTM();
AddLabel(EarnPerShare, "EPS-TTM = " + AsDollars(EarnPerShare),
if EarnPerShare > 0 then GlobalColor("LabelGreen") else GlobalColor("LitePink"));

def BookValue = if IsNaN(BookValuePerShare())
then BookValue[1]
else BookValuePerShare();
AddLabel(BookValue, "Book Value Per Share = " + Round(BookValue),
if BookValue < 2 then GlobalColor("Pre_Cyan") else
if BookValue < 3 then GlobalColor("LabelGreen") else GlobalColor("neutral"));

How P/E Ratio is Calculated:
The P/E ratio shown in this script is: Basic Trailing 12mth Earnings / Price.
The label in this study displays what is available: the basic ttm w/o convertible securities.
The Analyze Tab displays the diluted EPS which includes convertible securities. And the formula used to calculate the ratio is pulling after-hours data. Both of these are not available to this script.
 
Last edited:
Can you please add code so that I have the option of which fundamental labels I'd like to see on my chart? On some charts I just want to see PE to minimize the labels. On others I want to see the group of fundamentals. Thanks
 
Can you please add code so that I have the option of which fundamental labels I'd like to see on my chart? On some charts I just want to see PE to minimize the labels. On others I want to see the group of fundamentals. Thanks

The ability to choose which labels to display is not available
Below find a standalone PE Label.
Ruby:
DefineGlobalColor("Pre_Cyan", CreateColor(50, 200, 255)) ;
DefineGlobalColor("LabelGreen", CreateColor(0, 165, 0)) ;
DefineGlobalColor("GrayGreen",  CreateColor(155, 167, 76)) ;
DefineGlobalColor("LitePink", CreateColor (220, 180, 180)) ;
DefineGlobalColor("neutral",  color.light_gray) ;

def fp = FiscalPeriod.YEAR;
def EPS = EarningsPerShareTTM(fiscalPeriod = fp);
def PE = round(close / EPS,1);
AddLabel(PE, "P/E ratio = " + Round(PE, 2),
                      if PE < 0 then GlobalColor("LitePink") else
                      if PE < 20 then GlobalColor("LabelGreen") else
                      if PE < 40 then GlobalColor("GrayGreen") else GlobalColor("Pre_Cyan"));
 
how much Score for the good stock ? thank you
Only you can decide what and which financial data is important for your analysis.
For my own analysis, the PE ratio against the industry average is important.
https://usethinkscript.com/threads/complimentary-tools-to-the-thinkorswim-app.17705/#:~:text=do your research, $-,NVDA,-leads its market

But even that is subjective. And not black and white.
Look at NVDIA, overvalued by all textbook standards, but it continues to generate more of my profit than any other stock.

You need to be able to take multiple factors into account, when doing financial analysis.
 
Last edited:
The ability to choose which labels to display is not available
Below find a standalone PE Label.
Ruby:
DefineGlobalColor("Pre_Cyan", CreateColor(50, 200, 255)) ;
DefineGlobalColor("LabelGreen", CreateColor(0, 165, 0)) ;
DefineGlobalColor("GrayGreen",  CreateColor(155, 167, 76)) ;
DefineGlobalColor("LitePink", CreateColor (220, 180, 180)) ;
DefineGlobalColor("neutral",  color.light_gray) ;

def fp = FiscalPeriod.YEAR;
def EPS = EarningsPerShareTTM(fiscalPeriod = fp);
def PE = round(close / EPS,1);
AddLabel(PE, "P/E ratio = " + Round(PE, 2),
                      if PE < 0 then GlobalColor("LitePink") else
                      if PE < 20 then GlobalColor("LabelGreen") else
                      if PE < 40 then GlobalColor("GrayGreen") else GlobalColor("Pre_Cyan"));
Can you please write the code so that I can see price/sales in my watchlist? Thinkorswim gives Sales per Share, and I added def Price_To_Sales = Close/Sales_Per_Share to my upper study, which gives a good ballpark figure. I'd really like to be able to see this number in my watchlist to get a sense of stocks that may be too expensive.
 
Can you please write the code so that I can see price/sales in my watchlist? Thinkorswim gives Sales per Share, and I added def Price_To_Sales = Close/Sales_Per_Share to my upper study, which gives a good ballpark figure. I'd really like to be able to see this number in my watchlist to get a sense of stocks that may be too expensive.
Unfortunately no, your request is not supported by the ToS app
read more:
https://usethinkscript.com/threads/...labels-for-thinkorswim.5308/page-4#post-87400
 
This indicator displays fundamental data of a stock, including financial info such as Free Cash Flow, Profit Margin, etc., on your chart.
An overall weighted Score is calculated to gauge the overall financial health.

Use on a Daily Chart. Useful for anyone interested in fundamental stock research.
View attachment 9186
Ruby:
#Fundamental Data Labels _Mobius 4/26/20 (found on OneNote)
#
# @MerryDay revised 4/21:
# my interpretation of positive/negative values; should be modified to meet your strategy
# then calculated an overall weighted score based on:
# https://tradestation.tradingappstore.com/products/FundamentalScore/document/Fundamental_Score.pdf
# and other information found on the web
declare lower;
DefineGlobalColor("Pre_Cyan", CreateColor(50, 200, 255)) ;
DefineGlobalColor("LabelGreen",  CreateColor(0, 165, 0)) ;
DefineGlobalColor("LabelRed",  CreateColor(225, 0, 0)) ;
DefineGlobalColor("Violet", CreateColor (200, 125, 255)) ;
DefineGlobalColor("GrayGreen",  CreateColor(155, 167, 76)) ;
DefineGlobalColor("LitePink", CreateColor (220, 180, 180)) ;
DefineGlobalColor("neutral",  color.light_gray) ;
def fp = FiscalPeriod.YEAR;
def EPS = EarningsPerShareTTM(fiscalPeriod = fp);
def PE = round(close / EPS,1);
AddLabel(PE, "P/E ratio = " + Round(PE, 2),
                      if PE < 0 then GlobalColor("LitePink") else
                      if PE < 20 then GlobalColor("LabelGreen") else
                      if PE < 40 then GlobalColor("GrayGreen") else GlobalColor("Pre_Cyan"));

def EarnPerShare = if IsNaN(EarningsPerShareTTM())
                   then EarnPerShare[1]
                   else EarningsPerShareTTM();
AddLabel(EarnPerShare, "EPS-TTM = " + AsDollars(EarnPerShare),
                      if EarnPerShare > 0 then GlobalColor("LabelGreen") else GlobalColor("LitePink"));

def FreeCashFlowPerSh = if isNaN(FreeCashFlowPerShare())
                        then FreeCashFlowPerSh[1]
                        else FreeCashFlowPerShare();
AddLabel(FreeCashFlowPerSh, "Free Cash Flow Per Share = " + AsDollars(FreeCashFlowPerSh),
                  if FreeCashFlowPerSh > 0 then GlobalColor("LabelGreen") else GlobalColor("LitePink"));
def score_EarnCash = if PE <0 and FreeCashFlowPerSh < 0 and EarnPerShare < 0 then 0 else 5;

def Gross_Profit_Margin = if IsNaN(GrossProfitMargin())
                          then Gross_Profit_Margin[1]
                          else GrossProfitMargin();
AddLabel(Gross_Profit_Margin, "Gross Profit Margin = " + Round(Gross_Profit_Margin, 2),
               if Gross_Profit_Margin > 0 then GlobalColor("LabelGreen") else GlobalColor("LitePink"));

def Operating_Profit_Margin = if IsNaN(OperatingProfitMargin())
                              then Operating_Profit_Margin[1]
                              else OperatingProfitMargin();
AddLabel(Operating_Profit_Margin, "Operating Profit Margin = " + Round(Operating_Profit_Margin, 2),           
              if Operating_Profit_Margin > 0 then GlobalColor("LabelGreen") else GlobalColor("LitePink"));


def Net_Profit_Margin = if IsNaN(NetProfitMargin())
                        then Net_Profit_Margin[1]
                        else NetProfitMargin();
AddLabel(Net_Profit_Margin, "Net Profit Margin = " + Round(Net_Profit_Margin, 2),
               if Net_Profit_Margin > 0 then GlobalColor("LabelGreen") else GlobalColor("LitePink"));
def score_Profits = if Gross_Profit_Margin>0 or Net_Profit_Margin>0 or Operating_Profit_Margin > 0 then 3 else 0 ;

def CurRatio = if IsNaN(CurrentRatio())
               then CurRatio[1]
               else CurrentRatio();
AddLabel(CurRatio, "Current Ratio = " + Round(CurRatio, 2),
               if CurRatio > 2  then GlobalColor("GrayGreen") else
               if CurRatio >= 1 then GlobalColor("LabelGreen") else GlobalColor("LitePink"));

def Quick_Ratio = if IsNaN(QuickRatio())
                  then Quick_Ratio[1]
                  else QuickRatio();
AddLabel(Quick_Ratio, "Quick Ratio = " + Round(Quick_Ratio, 2),
               if Quick_Ratio > 2  then GlobalColor("GrayGreen") else
               if Quick_Ratio >= 1 then GlobalColor("LabelGreen") else GlobalColor("LitePink"));
def score_Ratios = if Quick_Ratio >= 1 or CurRatio >= 1 then 3 else 0;

def Return_On_Assets = if IsNaN(ReturnOnAssets())
                       then Return_On_Assets[1]
                       else ReturnOnAssets();
AddLabel(Return_On_Assets, "Return On Assets = " + Round(Return_On_Assets),
              if Return_On_Assets >= 15 then GlobalColor("Pre_Cyan") else
              if Return_On_Assets >= 10 then GlobalColor("LabelGreen") else
              if Return_On_Assets > 0 then GlobalColor("GrayGreen") else GlobalColor("LitePink"));


def Return_On_Equity = if IsNaN(ReturnOnEquity())
                       then Return_On_Equity[1]
                       else ReturnOnEquity();
AddLabel(Return_On_Equity, "Return On Equity = " + Round(Return_On_Equity),
              if Return_On_Equity >= 15 then GlobalColor("Pre_Cyan") else
              if Return_On_Equity >= 10 then GlobalColor("LabelGreen") else
              if Return_On_Equity > 0 then GlobalColor("GrayGreen") else GlobalColor("LitePink"));
def score_Returns = if Return_On_Equity >= 10 or Return_On_Assets >=10 then 1 else 0 ;


def Sales_Per_Share = if IsNaN(SalesPerShare())
                      then Sales_Per_Share[1]
                      else SalesPerShare();
AddLabel(Sales_Per_Share, "Sales Per Share = " + Round(Sales_Per_Share, 2),
                      if Sales_Per_Share > 0 then GlobalColor("LabelGreen") else GlobalColor("LitePink"));
def score_Sales_Per_Share = if Sales_Per_Share > 0 then 1 else 0;

def FixChgCovRatio = if IsNaN(FixedChargeCoverageRatio())
                     then FixChgCovRatio[1]
                     else FixedChargeCoverageRatio();
AddLabel(FixChgCovRatio, "Fixed Charge Coverage Ratio = " + Round(FixChgCovRatio, 2),
                     if FixChgCovRatio >= 1 then GlobalColor("LabelGreen") else GlobalColor("LitePink"));

def Total_Asset_Turnover = if IsNaN(TotalAssetTurnover())
                           then Total_Asset_Turnover[1]
                           else TotalAssetTurnover();
AddLabel(Total_Asset_Turnover, "Total Asset Turnover = " + Round(Total_Asset_Turnover, 2),
               if Total_Asset_Turnover > 1 then GlobalColor("LabelGreen") else  GlobalColor("neutral"));

def FinLev = if IsNaN(FinancialLeverage())
             then FinLev[1]
             else FinancialLeverage();
AddLabel(FinLev, "Financial Leverage = " + Round(FinLev, 2),
                      if FinLev > 0 and FinLev < 2 then GlobalColor("LabelGreen") else GlobalColor("LitePink"));
def score_FinLev = if FinLev < 2 then 1 else 0;

def BookValue = if IsNaN(BookValuePerShare())
                then BookValue[1]
                else BookValuePerShare();
AddLabel(BookValue, "Book Value Per Share = " + Round(BookValue),
                if BookValue < 2 then GlobalColor("Pre_Cyan") else
                if BookValue < 3 then GlobalColor("LabelGreen") else GlobalColor("neutral"));

def Long_Term_Debt_To_Capital = if IsNaN(LongTermDebtToCapital())
                                then Long_Term_Debt_To_Capital[1]
                                else LongTermDebtToCapital();
AddLabel(Long_Term_Debt_To_Capital, "Long Term Debt To Capital = " + Round(Long_Term_Debt_To_Capital, 2),
 if Long_Term_Debt_To_Capital < 5 then GlobalColor("LabelGreen") else GlobalColor("LitePink"));
def score_Long_Term_Debt_To_Capital = if Long_Term_Debt_To_Capital < 5 then 1 else 0;

def Inventory_Turnover = if IsNaN(InventoryTurnover())
                         then Inventory_Turnover[1]
                         else InventoryTurnover();
AddLabel(Inventory_Turnover, "Inventory Turnover = " + Round(Inventory_Turnover, 2),
               if Inventory_Turnover < 5  then GlobalColor("LitePink") else
               if Inventory_Turnover < 10 then GlobalColor("Pre_Cyan") else
               if Inventory_Turnover < 15 then GlobalColor("GrayGreen") else GlobalColor("LitePink"));

def DivPayout = if IsNaN(DividendPayout())
                then DivPayout[1]
                else DividendPayout();
AddLabel(DivPayout, "Dividend Payout = " + round(DivPayout,2) + "%", GlobalColor("neutral"));

def DivPerShare = if IsNaN(DividendsPerShareTTM())
                  then DivPerShare[1]
                  else DividendsPerShareTTM();
AddLabel(DivPerShare, "Dividend Per Share = " + AsDollars(DivPerShare), GlobalColor("neutral"));

def DivYield = if IsNaN(DividendsPerShareTTM())
                  then DivPerShare[1]
                  else DividendsPerShareTTM()/Close;
AddLabel(DivPerShare, "Dividend Yield = " + AsPercent(DivYield), GlobalColor("neutral"));

def Interest_Rate = if IsNaN(InterestRate())
                    then Interest_Rate[1]
                    else InterestRate();
AddLabel(Interest_Rate, "Interest Rate = " + Round(Interest_Rate, 2), GlobalColor("neutral"));

def Tax_Rate = if IsNaN(TaxRate())
               then Tax_Rate[1]
               else TaxRate();
AddLabel(Tax_Rate, "Tax Rate = " + Round(Tax_Rate, 2), GlobalColor("neutral"));

plot score = score_Returns + score_EarnCash + score_ratios + score_Profits
           + score_FinLev + score_Sales_Per_Share + score_Long_Term_Debt_To_Capital;
AddLabel(yes, "SCORE: " + score,
if score >= 12 then GlobalColor("Pre_Cyan") else
if score >= 10 then GlobalColor("LabelGreen") else
if score >= 8 then GlobalColor("GrayGreen") else GlobalColor("LitePink"));
What do the colors signify? I assume Red and green (good/bad) but what about blue? Or is that just the color chosen?
 
What do the colors signify? I assume Red and green (good/bad) but what about blue? Or is that just the color chosen?

Yes, Red and green (good/bad), determined by making some VERY liberal assumptions.

With the fundamental factors highlighted in blue, liberal assumptions cannot be applied there is no good/bad standard that can be applied to ALL stocks for the blue financials; the standards for these differ widely by sector, by market cap, by index... So they cannot be scored.

Feel free to apply your own standards to these factors.
 
Labels must be on a daily chart.

A workaround is to detach a daily chart w/ the labels and overlay it on your 10 min chart or put it anywhere else on your screen.
In the top right of the chart, there is a pin symbol. If you pin the chart it won't keep falling behind whatever it is overlaid on.
View attachment 12364
Can you please guide on how to detach labels at the top of the chart? I don't see pin symbol?

1732833070862.png


Also, what does the score line (in cyan color) mean? Does it represent the fair value of the stock on the chart?
 
Last edited:
Can you please guide on how to detach labels at the top of the chart? I don't see pin symbol?

View attachment 23435

Also, what does the score line (in cyan color) mean? Does it represent the fair value of the stock on the chart?
Apologies.
The cyan line reflects the financial score. No has nothing to do with the charts.
It should not have plotted.

The script in the 1st post has been corrected.
Re-copy and paste the fixed script to remove the line.
 
Last edited by a moderator:
Apologies.
The cyan line reflects the financial score. No has nothing to do with the charts.
It should not have plotted.

The script in the 1st post has been corrected.
Re-copy and paste the fixed script to remove the line.
Where is the corrected code? Is it possible to supply a link to the chart to get one with the right codes?
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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