Discounted Cash Flow values a company by projecting future cash flows and discounting them using WACC. The foundation of intrinsic value investing.
EV = Σ FCFₜ/(1+WACC)ᵗ + TV/(1+WACC)ⁿ
TV = FCFₙ(1+g)/(WACC-g)
function dcfValuation(fcf, growthRate, wacc, terminalGrowth, years) {
let presentValue = 0;
let cashFlow = fcf;
// Discount explicit forecast period
for (let t = 1; t <= years; t++) {
presentValue += cashFlow / Math.pow(1 + wacc, t);
cashFlow *= (1 + growthRate);
}
// Terminal value (perpetuity growth)
const terminalValue = cashFlow * (1 + terminalGrowth) / (wacc - terminalGrowth);
// Discount terminal value
const pvTerminal = terminalValue / Math.pow(1 + wacc, years);
return presentValue + pvTerminal;
}