earnings - PineScript Variable
earnings
Section titled “earnings”Overview
Section titled “Overview”The earnings record provides forward-looking fundamentals for the next scheduled earnings report of the chart’s symbol. Fields populate when TradingView has data from corporate filings or analyst estimates.
Fields
Section titled “Fields”| Field | Type | Description |
|---|---|---|
earnings.future_eps | series float | Estimated earnings per share for the next report. |
earnings.future_revenue | series float | Estimated total revenue for the upcoming report. |
earnings.future_period_end_time | series int | UNIX timestamp (ms) marking the end of the financial period being reported. |
earnings.future_time | series int | UNIX timestamp (ms) of the expected earnings announcement. |
Remarks
Section titled “Remarks”- Values are fetched once when the script loads and remain unchanged until the script recalculates.
- Fields return
naif no projection is available for the instrument. - For historical analysis, use
request.earnings()to retrieve past values across time.
Example
Section titled “Example”//@version=5indicator("Earnings tracker", overlay=false, max_labels_count=1)
if not na(earnings.future_time) daysUntilReport = (earnings.future_time - timenow) / 1000 / 86400 plot(daysUntilReport, "Days until earnings", color=color.teal)
if barstate.islast label.new(bar_index, daysUntilReport, text = "Next EPS est: " + str.tostring(earnings.future_eps, "#.##"), bgcolor = color.new(color.teal, 70), textcolor = color.white)else plot(na, "Days until earnings")