OPEN-SOURCE SCRIPT

Forward P/E

Mis à jour
The Forward P/E indicator calculates and visualizes the forward price-to-earnings (P/E) ratio of a stock based on its most recent quarterly earnings per share (EPS) and the current market price.

Key Features:
  • Quarterly EPS Data: The script retrieves the diluted EPS for the most recent fiscal quarter (FQ) of the selected stock using financial data.
  • Annualized EPS: The quarterly EPS is multiplied by four to estimate the annualized EPS, assuming consistent earnings throughout the year.
  • Forward P/E Calculation: The forward P/E is derived by dividing the stock's current closing price by its annualized EPS.
  • Visualization: The calculated forward P/E ratio is plotted for easy interpretation.
  • Reference Line: An optional horizontal reference line at 0 helps quickly identify when the P/E ratio becomes invalid or potentially negative due to anomalies in EPS data.


This tool is useful for investors and traders seeking to evaluate a stock's valuation relative to its projected earnings, helping identify potentially overvalued or undervalued opportunities.
Notes de version
The Forward P/E with Median indicator calculates and visualizes the forward price-to-earnings (P/E) ratio of a stock and includes a rolling median to help identify trends or central tendencies in valuation over time.

Key Features:
  • Quarterly EPS Data: Retrieves the diluted EPS for the most recent fiscal quarter (FQ) of the selected stock using financial data.
  • Annualized EPS: Quarterly EPS is multiplied by four to estimate annualized EPS, assuming consistent earnings throughout the year.
  • Forward P/E Calculation: The forward P/E is derived by dividing the stock's current closing price by its annualized EPS.
  • Median Forward P/E: A rolling median of the forward P/E ratio is calculated over a user-defined window (default: 14 periods) and plotted for trend analysis.
  • Visualization:
  • The Forward P/E ratio is plotted in blue.
  • The Median Forward P/E is plotted in orange for comparison and trend analysis.


Reference Line: An optional horizontal line at 0 helps identify anomalies, such as negative or invalid P/E values.

This enhanced tool is useful for investors and traders aiming to assess a stock's valuation trends and stability relative to its projected earnings, helping identify consistent overvaluation or undervaluation opportunities.
forecastingstatisticsValue

Script open-source

Dans le plus pur esprit TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par nos Règles. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Vous voulez utiliser ce script sur un graphique ?

Clause de non-responsabilité