OPEN-SOURCE SCRIPT
Forward P/E Rolling Z-Score

The Forward P/E Rolling Z-Score is an advanced fundamental-technical hybrid indicator designed to evaluate equity valuation extremes. By standardizing forward price-to-earnings (P/E) ratios into a rolling statistical Z-score, this tool helps investors identify when a stock or index is statistically overvalued or undervalued relative to its own historical baseline. Unlike traditional static P/E multiples that fail to account for shifting market regimes, this indicator dynamically measures standard deviation shifts over a rolling lookback period. Furthermore, it features a built-in historical performance tracker that automatically measures forward returns, win rates, and trigger counts across multiple time horizons (1-Month, 3-Month, 6-Month, and 1-Year) based on user-defined threshold crossings.
Key Features
Inputs & Customization
How to Use
Valuation Assessment: Monitor the lower pane oscillator. Values above +/- 2 indicate statistically expensive conditions, while values below your set threshold indicate attractive, cheap valuations.
Strategy Optimization: Use the on-chart performance table to inspect how historical signals have performed over various forward horizons to gauge the predictive edge of your chosen threshold.Disclaimer: This indicator is for educational and informational purposes only and does not constitute financial advice.
Key Features
- Dynamic Valuation Z-Score: Calculates a rolling mean and standard deviation of forward P/E ratios to measure statistical deviation from the norm.
- Optional Smoothing: Apply a moving average (SMA or EMA) to the raw Z-score to filter out high-frequency noise and reduce false signal whipsaws.
- Automated Performance Table: Displays a real-time analytics matrix on the chart tracking historical forward returns, win percentages, and total sample triggers since a customizable start date.
- Multi-Horizon Tracking: Evaluates signal efficacy across 4 distinct forward windows: 1 Month (21 bars), 3 Months (63 bars), 6 Months (126 bars), and 1 Year (252 bars).
[*]Visual Extremes Shading: Automatically highlights expensive and cheap valuation zones on the chart background for quick visual identification. - Flexible Signal Triggers: Customize your directional bias with selectable cross modes (Cross Over or Cross Under) and adjustable standard deviation thresholds.
Inputs & Customization
- Performance Tracking Start Date: Set the historical anchor date to begin tracking backtested signal performance.
- Z-Score Settings: Lookback Period (Bars) defines the historical window for mean and standard deviation calculations (default: 60); Signal Threshold & Direction defines the standard deviation trigger levels and whether to track crosses above or below the threshold; Annualize EPS automatically projects quarterly estimates into annualized figures.
- Moving Average Smoothing: Allows you to select between EMA or SMA, and adjust the length.
- Visuals: Toggle extreme zone background shading and select whether shading/signals rely on raw or smoothed Z-scores.
- Performance Table: Customize table placement (Top Right, Top Left, Bottom Right, Bottom Left) or toggle it entirely.
How to Use
Valuation Assessment: Monitor the lower pane oscillator. Values above +/- 2 indicate statistically expensive conditions, while values below your set threshold indicate attractive, cheap valuations.
Strategy Optimization: Use the on-chart performance table to inspect how historical signals have performed over various forward horizons to gauge the predictive edge of your chosen threshold.Disclaimer: This indicator is for educational and informational purposes only and does not constitute financial advice.
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。