Retrieving Reference Information for Discounted_Cash_Flow

All the "0" in the script are values that need to be referenced for each stock, but I dont know how to retrieve the information automatically via the code. This code is designed to identify under valued stocks.

Can someone help me automate this process?

The most important ones are the FCF inputs could automatically populate and "Shares_Outstanding". If those are correct the code should function


Code:
#DCF_Discounted_Cash_Flow

#__________________________________________
#Cash Flow for each year recorded(currently only 5 years of inputs included)

input year1FCF = 0;

input year2FCF = 0;

input year3FCF = 0;

input year4FCF = 0;

input year5FCF = 0;

#input year6FCF = 0;

#input year7FCF = 0;

#input year8FCF = 0;

#input year9FCF = 0;

#input year10FCF = 0;

input Perpetual_Growth_Rate = .025; #Growth Rate of the Economy
input Discout_Growth_Rate = .08;


#FCF = FreeCashFlow

def CF1 = (year2FCF - year1FCF) / year1FCF;
def CF2 = (year3FCF - year2FCF) / year2FCF;
def CF3 = (year4FCF - year3FCF) / year3FCF;
def CF4 = (year5FCF - year4FCF) / year4FCF;

#def CF5 = (year6FCF - year5FCF)/ year5FCF;
#def CF6 = (year7FCF - year6FCF)/ year6FCF;
#def CF7 = (year8FCF - year7FCF)/ year7FCF;
#def CF8 = (year9FCF - year8FCF)/ year8FCF;
#def CF9 = (year10FCF - year9FCF)/ year9FCF;
#def CF10 = (year11FCF - year10FCF)/ year10FCF;

Input GrowthAVG_Number = 4; # number of calculations included

Def Avg_GrowthRate = (CF1 + CF2 + CF3 + CF4) / GrowthAVG_Number;

Def FutureCashFlow = (year5FCF * (1 + Avg_GrowthRate));

Def Terminal_Value = FutureCashFlow * (1 + Perpetual_Growth_Rate) / (Discout_Growth_Rate - Perpetual_Growth_Rate );

Def SumofFCF = FutureCashFlow; #would normally be multiple furture projected years of cash flow

Input Cash_or_Cash_Equivelants = 0;
Input Total_Debt = 0;

Def Equity_Value = SumofFcf - Total_Debt;
Input Shares_Outstanding = 0;
Def Price_Per_Share = Equity_Value/Shares_Outstanding;

Def current_Price = Close;
Def Difference =  (Price_Per_Share - current_Price)/current_price;

AddLabel(yes, "% Difference from current price: " +  Difference, Color.WHITE);
AddLabel(yes, "Value_Per_Share: " + Price_Per_Share, If price_per_Share <= close then color.light_green else Color.light_red);
 

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
466 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