dividends - PineScript Variable
dividends
Section titled “dividends”Overview
Section titled “Overview”The dividends record provides forward-looking information about the next expected dividend for the chart’s symbol. Values are populated when TradingView has corporate action data for the instrument.
Fields
Section titled “Fields”| Field | Type | Description |
|---|---|---|
dividends.future_amount | series float | Projected dividend payout amount (in the instrument’s currency). |
dividends.future_ex_date | series int | UNIX timestamp (ms) of the upcoming ex-dividend date. |
dividends.future_pay_date | series int | UNIX timestamp (ms) of the expected payment date. |
Remarks
Section titled “Remarks”- Dividend values are fetched once during the script’s initial calculation. They remain unchanged until the script is reloaded, even after the event passes.
- Fields return
nawhen TradingView lacks data for the symbol (common for instruments without dividends). - Use
request.dividends()for historical series when you need more than the next scheduled payout.
Example
Section titled “Example”//@version=5indicator("Dividend countdown", overlay=false, max_labels_count=1)
nextAmount = dividends.future_amountexDate = dividends.future_ex_datedaysUntilEx = na(exDate) ? na : (exDate - timenow) / 1000 / 86400
plot(daysUntilEx, "Days until ex-date", color=color.orange)
if barstate.islast and not na(nextAmount) label.new(bar_index, daysUntilEx, text = "Next dividend: " + str.tostring(nextAmount, "#.##"), bgcolor = color.new(color.orange, 70), textcolor = color.white)