New functions to get splits, dividends, and earnings data in Pine

Mar 31, 2021

More good news — we’ve added dividends, splits, and earnings functions to our Pine Script language, which will help you get information about splits, profits, and dividends for the symbols you are interested in.

All three functions have the same set of arguments — ticker, field, gaps, lookahead.

The ticker parameter is a symbol with prefix, such as NASDAQ:AAPL.

The gaps and lookahead parameters are similar to those in the security function.

However, the field parameter takes on different values.

For the dividends function, the field parameter allows you to specify the type of dividends you want to receive: dividends.net or dividends.gross.

For the splits function, the field parameter allows you to specify the numerator or denominator of the split: splits.numerator or splits.denominator.

For the earnings function, the field parameter allows you to specify the type of profit you want to receive: earnings.actual or earnings.estimate.

Let’s take an example. With the earnings function, say you want to know the reported and estimated earnings of Microsoft (NASDAQ:MSFT). Your script might look like this:

//@version=4
study("My Script")
earnings_actual=earnings("NASDAQ:MSFT", earnings.actual)
earnings_estimate=earnings("NASDAQ:MSFT", earnings.estimate)

plot(earnings_actual, color=color.blue)
plot(earnings_estimate, color=color.red)

Read about all Pine updates in the Release Notes section in the User Manual.

We hope you find the new features useful. And please do keep giving us feedback and suggestions — we’re building TradingView for you, and we’re always keen to know what you think about our platform updates.

Look first Then leap

TradingView is built for you, so make sure you're getting the most of our awesome features
Launch Chart