OPEN-SOURCE SCRIPT
P/E Based Earnings Signals

P/E Based Earnings Signals
This script is an event-driven indicator that evaluates earnings releases through a valuation and share-structure lens. Instead of focusing only on price action, it uses reported earnings data, estimated earnings data, and shares outstanding to identify conditions that may be relevant after an earnings update.
The main idea is to filter earnings events using simple but specific fundamental rules, then display signals only when those conditions are met.
Concept:
Many earnings-based tools focus only on whether a company beat or missed expectations. This script takes a more structured approach by combining:
• Actual earnings-based P/E
• Estimated earnings-based P/E
• Share structure stability over time
The goal is to identify earnings events where valuation conditions and dilution stability align with the signal logic.
How It Works
The script requests:
• Actual EPS from earnings data
• Estimated EPS from earnings data
• Total shares outstanding from financial data
It then calculates:
• Actual P/E = Price / Actual EPS
• Estimated P/E = Price / Estimated EPS
Signals are only evaluated on bars where a new earnings value is detected.
Buy Signal Logic
A buy signal requires all of the following:
• A new earnings event is detected
• Actual P/E is above the selected buy threshold
• Actual P/E is greater than estimated P/E
• Shares outstanding have remained relatively stable over the selected lookback period
This is intended to isolate higher-P/E earnings events while excluding names with major recent changes in share structure.
Sell Signal Logic
A sell signal requires all of the following:
• A new earnings event is detected
• Actual P/E is below the selected sell threshold
• Estimated P/E is at or above the selected expected threshold
• Shares outstanding have remained relatively stable over the selected lookback period
This is intended to flag lower-P/E earnings conditions under a separate valuation filter.
Share Structure Filter
One part of the script is dedicated to filtering out companies with large recent changes in shares outstanding.
It compares current shares outstanding to a historical reference point over a configurable number of days and calculates the percentage change.
If the change exceeds the selected threshold, signals are blocked.
This helps reduce noise from companies with unstable share structures or significant dilution.
Visual Features
• Buy labels below price when buy conditions are met
• Sell labels above price when sell conditions are met
• Earnings bars highlighted in the background
• Summary table showing current P/E values, share change, and signal status
Dashboard Metrics
The built-in table displays:
• Reported P/E
• Estimated P/E
• 1-year share change percentage
• Current buy status
• Current sell status
This makes it easier to understand why a signal did or did not trigger.
Use Cases
This tool may be useful for:
• Earnings-focused traders
• Fundamental event screening
• Combining valuation filters with chart review
• Monitoring companies with more stable share structures
Notes
This script is a rules-based earnings filter, not a complete investment model.
It is best used alongside:
• Fundamental research
• Price action review
• Broader context around the earnings report
• Risk management
Because financial data can vary by symbol and reporting availability, users should verify that the required data fields are supported for the instrument being analyzed.
This script is an event-driven indicator that evaluates earnings releases through a valuation and share-structure lens. Instead of focusing only on price action, it uses reported earnings data, estimated earnings data, and shares outstanding to identify conditions that may be relevant after an earnings update.
The main idea is to filter earnings events using simple but specific fundamental rules, then display signals only when those conditions are met.
Concept:
Many earnings-based tools focus only on whether a company beat or missed expectations. This script takes a more structured approach by combining:
• Actual earnings-based P/E
• Estimated earnings-based P/E
• Share structure stability over time
The goal is to identify earnings events where valuation conditions and dilution stability align with the signal logic.
How It Works
The script requests:
• Actual EPS from earnings data
• Estimated EPS from earnings data
• Total shares outstanding from financial data
It then calculates:
• Actual P/E = Price / Actual EPS
• Estimated P/E = Price / Estimated EPS
Signals are only evaluated on bars where a new earnings value is detected.
Buy Signal Logic
A buy signal requires all of the following:
• A new earnings event is detected
• Actual P/E is above the selected buy threshold
• Actual P/E is greater than estimated P/E
• Shares outstanding have remained relatively stable over the selected lookback period
This is intended to isolate higher-P/E earnings events while excluding names with major recent changes in share structure.
Sell Signal Logic
A sell signal requires all of the following:
• A new earnings event is detected
• Actual P/E is below the selected sell threshold
• Estimated P/E is at or above the selected expected threshold
• Shares outstanding have remained relatively stable over the selected lookback period
This is intended to flag lower-P/E earnings conditions under a separate valuation filter.
Share Structure Filter
One part of the script is dedicated to filtering out companies with large recent changes in shares outstanding.
It compares current shares outstanding to a historical reference point over a configurable number of days and calculates the percentage change.
If the change exceeds the selected threshold, signals are blocked.
This helps reduce noise from companies with unstable share structures or significant dilution.
Visual Features
• Buy labels below price when buy conditions are met
• Sell labels above price when sell conditions are met
• Earnings bars highlighted in the background
• Summary table showing current P/E values, share change, and signal status
Dashboard Metrics
The built-in table displays:
• Reported P/E
• Estimated P/E
• 1-year share change percentage
• Current buy status
• Current sell status
This makes it easier to understand why a signal did or did not trigger.
Use Cases
This tool may be useful for:
• Earnings-focused traders
• Fundamental event screening
• Combining valuation filters with chart review
• Monitoring companies with more stable share structures
Notes
This script is a rules-based earnings filter, not a complete investment model.
It is best used alongside:
• Fundamental research
• Price action review
• Broader context around the earnings report
• Risk management
Because financial data can vary by symbol and reporting availability, users should verify that the required data fields are supported for the instrument being analyzed.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.