OPEN-SOURCE SCRIPT

Historical P/E Ratio with Average Line

354
**Description:**

This indicator plots a stock's price-to-earnings (P/E) ratio over time and adds an average line. It lets you see at a glance whether a company is currently valued more expensively or more cheaply than its historical norm.

**What the indicator shows**

The blue line shows the historical P/E ratio, calculated as the current price divided by earnings per share. The orange line represents the average — either as an overall average across the entire available history, or as a moving average over an adjustable number of bars. A small info box in the top right summarizes the current P/E value and the average.

**Settings**

The calculation period can be set to TTM (trailing twelve months), fiscal year (FY), or quarter (FQ). The average type can be switched between overall average and moving average, whose length is freely adjustable. An outlier filter hides extreme P/E spikes that occur during periods of very low earnings and would otherwise distort the scale.

**Usage notes**

The indicator only works with stocks that have available fundamental data and is most useful on the daily or weekly chart. During loss periods with negative earnings, the P/E ratio is undefined and is deliberately not displayed. The overall average is calculated across the history loaded in the chart — the more history is visible, the more meaningful the average line becomes.

**Disclaimer**

This indicator is provided for informational and educational purposes only and does not constitute investment advice or a buy/sell recommendation. A P/E ratio above or below its historical average is not a buy or sell signal in itself and should always be considered together with the business model, growth expectations, and industry context. Fundamental data is provided by TradingView; no guarantee is made as to its accuracy or completeness.

---

**Beschreibung:**

Dieser Indikator stellt das Kurs-Gewinn-Verhältnis (KGV) einer Aktie über die Zeit dar und ergänzt es um eine Durchschnittslinie. So lässt sich auf einen Blick erkennen, ob ein Unternehmen aktuell teurer oder günstiger bewertet ist als im historischen Mittel.

**Was der Indikator zeigt**

Die blaue Linie zeigt das historische KGV, berechnet aus dem aktuellen Kurs geteilt durch den Gewinn je Aktie. Die orange Linie stellt den Durchschnitt dar – wahlweise als Gesamtdurchschnitt über die gesamte verfügbare Historie oder als gleitender Durchschnitt über eine einstellbare Anzahl von Bars. Eine kleine Info-Box rechts oben fasst den aktuellen KGV-Wert und den Durchschnitt zusammen.

**Einstellmöglichkeiten**

Berechnungsperiode wählbar zwischen TTM (letzte zwölf Monate), Geschäftsjahr (FY) und Quartal (FQ). Der Durchschnittstyp lässt sich zwischen Gesamtdurchschnitt und gleitendem Durchschnitt umschalten, dessen Länge frei einstellbar ist. Ein Ausreißer-Filter blendet extreme KGV-Spitzen aus, die bei sehr niedrigen Gewinnen entstehen und die Skala sonst verzerren würden.

**Hinweise zur Nutzung**

Der Indikator funktioniert nur bei Aktien mit verfügbaren Fundamentaldaten und ist am sinnvollsten auf dem Tages- oder Wochenchart. In Verlustphasen mit negativem Gewinn ist das KGV nicht definiert und wird bewusst nicht dargestellt. Der Gesamtdurchschnitt wird über die im Chart geladene Historie gebildet – je mehr Historie sichtbar ist, desto aussagekräftiger ist die Durchschnittslinie.

**Wichtiger Hinweis**

Dieser Indikator dient ausschließlich Informations- und Bildungszwecken und stellt keine Anlageberatung oder Kauf-/Verkaufsempfehlung dar. Ein KGV über oder unter dem historischen Durchschnitt ist für sich genommen kein Kauf- oder Verkaufssignal, sondern sollte stets im Zusammenhang mit dem Geschäftsmodell, der Wachstumserwartung und dem Branchenumfeld betrachtet werden. Fundamentaldaten werden von TradingView bereitgestellt; für deren Richtigkeit und Vollständigkeit wird keine Gewähr übernommen.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.