Indicator · Pine Script v4 · Own pane

Dividends per Share (DPS, Yearly)

by everget

Dividends per Share (DPS, Yearly) calculates and displays annual dividend payment totals retrieved from FactSet fundamental data feeds.

View on GitHub

Repaints

GitHub stars948on the repository
Pine versionv4older, still runs
Lines of code164
Settings2inputs
LicenceGPL-3.0
Last update10 days ago18 Oct 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

164 lines of Pine Script v4 from statistics/dividends_per_share_dps_yearly.pine, published under GPL-3.0. Keep the author's credit and licence lines when you reuse it.

dividends_per_share_dps_yearly.pine
//@version=4
// Copyright (c) 2019-present, Alex Orekhov (everget)
// Dividends per Share (DPS, Yearly) script may be freely distributed under the terms of GPL-3.0 license.
study("Dividends per Share (DPS, Yearly)")

width = input(title="Columns Width", defval=12)
space = input(title="Space Between Columns", defval=8)

esdColor = #ffb74d
estimateColor = color.new(color.blue, 85)
labelColor = #1e90ff
whiteColor = color.white

_id(type) =>
    out = "ESD_FACTSET:" + syminfo.prefix + ";" + syminfo.ticker + ";" + type
    out

id = _id("DIVIDENDS")
estimate = security(id, "D", open, true, lookahead=true)
esd = security(id, "D", close, true, lookahead=true)

_count(src, yearTarget) =>
    var float counter = na
    counter := year != year[1] and year == yearTarget ? 0 : counter[1]
    counter := year == yearTarget ? counter + (na(src) ? 0 : src) : counter

_countESD(yearTarget) =>
    esdCount = _count(esd, yearTarget)
    estimateCount = _count(estimate, yearTarget)
    [esdCount, estimateCount]

[esd1990, est1990] = _countESD(1990)
[esd1991, est1991] = _countESD(1991)
[esd1992, est1992] = _countESD(1992)
[esd1993, est1993] = _countESD(1993)
[esd1994, est1994] = _countESD(1994)
[esd1995, est1995] = _countESD(1995)
[esd1996, est1996] = _countESD(1996)
[esd1997, est1997] = _countESD(1997)
[esd1998, est1998] = _countESD(1998)
[esd1999, est1999] = _countESD(1999)
[esd2000, est2000] = _countESD(2000)
[esd2001, est2001] = _countESD(2001)
[esd2002, est2002] = _countESD(2002)
[esd2003, est2003] = _countESD(2003)
[esd2004, est2004] = _countESD(2004)
[esd2005, est2005] = _countESD(2005)
[esd2006, est2006] = _countESD(2006)
[esd2007, est2007] = _countESD(2007)
[esd2008, est2008] = _countESD(2008)
[esd2009, est2009] = _countESD(2009)
[esd2010, est2010] = _countESD(2010)
[esd2011, est2011] = _countESD(2011)
[esd2012, est2012] = _countESD(2012)
[esd2013, est2013] = _countESD(2013)
[esd2014, est2014] = _countESD(2014)
[esd2015, est2015] = _countESD(2015)
[esd2016, est2016] = _countESD(2016)
[esd2017, est2017] = _countESD(2017)
[esd2018, est2018] = _countESD(2018)
[esd2019, est2019] = _countESD(2019)
[esd2020, est2020] = _countESD(2020)
[esd2021, est2021] = _countESD(2021)
[esd2022, est2022] = _countESD(2022)
[esd2023, est2023] = _countESD(2023)
[esd2024, est2024] = _countESD(2024)
[esd2025, est2025] = _countESD(2025)
[esd2026, est2026] = _countESD(2026)
[esd2027, est2027] = _countESD(2027)
[esd2028, est2028] = _countESD(2028)
[esd2029, est2029] = _countESD(2029)
[esd2030, est2030] = _countESD(2030)

_getCounter(mode, yearTarget) =>
    out = mode == "esd" ? esd2019 : est2019
    out := yearTarget == 2030 ? (mode == "esd" ? esd2030 : est2030) : out
    out := yearTarget == 2029 ? (mode == "esd" ? esd2029 : est2029) : out
    out := yearTarget == 2028 ? (mode == "esd" ? esd2028 : est2028) : out
    out := yearTarget == 2027 ? (mode == "esd" ? esd2027 : est2027) : out
    out := yearTarget == 2026 ? (mode == "esd" ? esd2026 : est2026) : out
    out := yearTarget == 2025 ? (mode == "esd" ? esd2025 : est2025) : out
    out := yearTarget == 2024 ? (mode == "esd" ? esd2024 : est2024) : out
    out := yearTarget == 2023 ? (mode == "esd" ? esd2023 : est2023) : out
    out := yearTarget == 2022 ? (mode == "esd" ? esd2022 : est2022) : out
    out := yearTarget == 2021 ? (mode == "esd" ? esd2021 : est2021) : out
    out := yearTarget == 2020 ? (mode == "esd" ? esd2020 : est2020) : out
    out := yearTarget == 2019 ? (mode == "esd" ? esd2019 : est2019) : out
    out := yearTarget == 2018 ? (mode == "esd" ? esd2018 : est2018) : out
    out := yearTarget == 2017 ? (mode == "esd" ? esd2017 : est2017) : out
    out := yearTarget == 2016 ? (mode == "esd" ? esd2016 : est2016) : out
    out := yearTarget == 2015 ? (mode == "esd" ? esd2015 : est2015) : out
    out := yearTarget == 2014 ? (mode == "esd" ? esd2014 : est2014) : out
    out := yearTarget == 2013 ? (mode == "esd" ? esd2013 : est2013) : out
    out := yearTarget == 2012 ? (mode == "esd" ? esd2012 : est2012) : out
    out := yearTarget == 2011 ? (mode == "esd" ? esd2011 : est2011) : out
    out := yearTarget == 2010 ? (mode == "esd" ? esd2010 : est2010) : out
    out := yearTarget == 2009 ? (mode == "esd" ? esd2009 : est2009) : out
    out := yearTarget == 2008 ? (mode == "esd" ? esd2008 : est2008) : out
    out := yearTarget == 2007 ? (mode == "esd" ? esd2007 : est2007) : out
    out := yearTarget == 2006 ? (mode == "esd" ? esd2006 : est2006) : out
    out := yearTarget == 2005 ? (mode == "esd" ? esd2005 : est2005) : out
    out := yearTarget == 2004 ? (mode == "esd" ? esd2004 : est2004) : out
    out := yearTarget == 2003 ? (mode == "esd" ? esd2003 : est2003) : out
    out := yearTarget == 2002 ? (mode == "esd" ? esd2002 : est2002) : out
    out := yearTarget == 2001 ? (mode == "esd" ? esd2001 : est2001) : out
    out := yearTarget == 2000 ? (mode == "esd" ? esd2000 : est2000) : out
    out := yearTarget == 1999 ? (mode == "esd" ? esd1999 : est1999) : out
    out := yearTarget == 1998 ? (mode == "esd" ? esd1998 : est1998) : out
    out := yearTarget == 1997 ? (mode == "esd" ? esd1997 : est1997) : out
    out := yearTarget == 1996 ? (mode == "esd" ? esd1996 : est1996) : out
    out := yearTarget == 1995 ? (mode == "esd" ? esd1995 : est1995) : out
    out := yearTarget == 1994 ? (mode == "esd" ? esd1994 : est1994) : out
    out := yearTarget == 1993 ? (mode == "esd" ? esd1993 : est1993) : out
    out := yearTarget == 1992 ? (mode == "esd" ? esd1992 : est1992) : out
    out := yearTarget == 1991 ? (mode == "esd" ? esd1991 : est1991) : out
    out := yearTarget == 1990 ? (mode == "esd" ? esd1990 : est1990) : out
    out

// var end = 20
// var res = '';
// var shapePos = [0, 3, 5, 10, 15, 20];

// for (var i = 0; i <= end; i++) {
//     var title = i == 0 ? 'Current' : `${ i }Y ago`;
//     res = res.concat(`plot(_getCounter("esd", year - ${ i }), offset=(-${ i } * space), title="${ title }", style=plot.style_histogram, linewidth=width, color=esdColor, show_last=1, transp=0, editable=false)\n`);
//     res = res.concat(`plot(_getCounter("estimate", year - ${ i }), offset=(-${ i } * space), title="", style=plot.style_histogram, linewidth=width, color=estimateColor, show_last=1, transp=0, editable=false)\n\n`);

//     if (shapePos.includes(i)) {
//         res = res.concat(`plotshape(0, offset=(-${ i } * space), title="${ title }", text=" ${ i == 0 ? title : title.slice(0, -4) } ", color=labelColor, textcolor=whiteColor, style=shape.labelup, location=location.absolute, size=size.small, show_last=1, transp=0, editable=false)\n`)
//     }
// }

plot(_getCounter("esd", year - 0), offset=(-0 * space), title="Current", style=plot.style_histogram, linewidth=width, color=esdColor, show_last=1, transp=0, editable=false)
plotshape(0, offset=(-0 * space), title="Current", text=" Current ", color=labelColor, textcolor=whiteColor, style=shape.labelup, location=location.absolute, size=size.small, show_last=1, transp=0, editable=false)

plot(_getCounter("esd", year - 1), offset=(-1 * space), title="1Y ago", style=plot.style_histogram, linewidth=width, color=esdColor, show_last=1, transp=0, editable=false)
plot(_getCounter("esd", year - 2), offset=(-2 * space), title="2Y ago", style=plot.style_histogram, linewidth=width, color=esdColor, show_last=1, transp=0, editable=false)
plot(_getCounter("esd", year - 3), offset=(-3 * space), title="3Y ago", style=plot.style_histogram, linewidth=width, color=esdColor, show_last=1, transp=0, editable=false)
plotshape(0, offset=(-3 * space), title="3Y ago", text=" 3Y ", color=labelColor, textcolor=whiteColor, style=shape.labelup, location=location.absolute, size=size.small, show_last=1, transp=0, editable=false)

plot(_getCounter("esd", year - 4), offset=(-4 * space), title="4Y ago", style=plot.style_histogram, linewidth=width, color=esdColor, show_last=1, transp=0, editable=false)
plot(_getCounter("esd", year - 5), offset=(-5 * space), title="5Y ago", style=plot.style_histogram, linewidth=width, color=esdColor, show_last=1, transp=0, editable=false)
plotshape(0, offset=(-5 * space), title="5Y ago", text=" 5Y ", color=labelColor, textcolor=whiteColor, style=shape.labelup, location=location.absolute, size=size.small, show_last=1, transp=0, editable=false)

plot(_getCounter("esd", year - 6), offset=(-6 * space), title="6Y ago", style=plot.style_histogram, linewidth=width, color=esdColor, show_last=1, transp=0, editable=false)
plot(_getCounter("esd", year - 7), offset=(-7 * space), title="7Y ago", style=plot.style_histogram, linewidth=width, color=esdColor, show_last=1, transp=0, editable=false)
plot(_getCounter("esd", year - 8), offset=(-8 * space), title="8Y ago", style=plot.style_histogram, linewidth=width, color=esdColor, show_last=1, transp=0, editable=false)
plot(_getCounter("esd", year - 9), offset=(-9 * space), title="9Y ago", style=plot.style_histogram, linewidth=width, color=esdColor, show_last=1, transp=0, editable=false)
plot(_getCounter("esd", year - 10), offset=(-10 * space), title="10Y ago", style=plot.style_histogram, linewidth=width, color=esdColor, show_last=1, transp=0, editable=false)
plotshape(0, offset=(-10 * space), title="10Y ago", text=" 10Y ", color=labelColor, textcolor=whiteColor, style=shape.labelup, location=location.absolute, size=size.small, show_last=1, transp=0, editable=false)

plot(_getCounter("esd", year - 11), offset=(-11 * space), title="11Y ago", style=plot.style_histogram, linewidth=width, color=esdColor, show_last=1, transp=0, editable=false)
plot(_getCounter("esd", year - 12), offset=(-12 * space), title="12Y ago", style=plot.style_histogram, linewidth=width, color=esdColor, show_last=1, transp=0, editable=false)
plot(_getCounter("esd", year - 13), offset=(-13 * space), title="13Y ago", style=plot.style_histogram, linewidth=width, color=esdColor, show_last=1, transp=0, editable=false)
plot(_getCounter("esd", year - 14), offset=(-14 * space), title="14Y ago", style=plot.style_histogram, linewidth=width, color=esdColor, show_last=1, transp=0, editable=false)
plot(_getCounter("esd", year - 15), offset=(-15 * space), title="15Y ago", style=plot.style_histogram, linewidth=width, color=esdColor, show_last=1, transp=0, editable=false)
plotshape(0, offset=(-15 * space), title="15Y ago", text=" 15Y ", color=labelColor, textcolor=whiteColor, style=shape.labelup, location=location.absolute, size=size.small, show_last=1, transp=0, editable=false)

plot(_getCounter("esd", year - 16), offset=(-16 * space), title="16Y ago", style=plot.style_histogram, linewidth=width, color=esdColor, show_last=1, transp=0, editable=false)
plot(_getCounter("esd", year - 17), offset=(-17 * space), title="17Y ago", style=plot.style_histogram, linewidth=width, color=esdColor, show_last=1, transp=0, editable=false)
plot(_getCounter("esd", year - 18), offset=(-18 * space), title="18Y ago", style=plot.style_histogram, linewidth=width, color=esdColor, show_last=1, transp=0, editable=false)
plot(_getCounter("esd", year - 19), offset=(-19 * space), title="19Y ago", style=plot.style_histogram, linewidth=width, color=esdColor, show_last=1, transp=0, editable=false)
plot(_getCounter("esd", year - 20), offset=(-20 * space), title="20Y ago", style=plot.style_histogram, linewidth=width, color=esdColor, show_last=1, transp=0, editable=false)
plotshape(0, offset=(-20 * space), title="20Y ago", text=" 20Y ", color=labelColor, textcolor=whiteColor, style=shape.labelup, location=location.absolute, size=size.small, show_last=1, transp=0, editable=false)

Overview

Dividends per Share (DPS, Yearly) accumulates historical dividend payouts and estimates on a yearly basis, plotting them as styled columns in a separate indicator pane. Users can adjust the column width and spacing between rendered elements. The script uses security calls with lookahead enabled, accessing future fundamental data on historical bars.

Details

Published by

everget on GitHub

Type

Indicator, Pine Script v4

Draws

Separate pane below the chart

Markets

Stocks

Timeframes

Any timeframe

Risk Notes

  • Reads higher-timeframe data with lookahead on, so the history can show signals that were not there in real time

Topics

pinepinescripttechnical-indicatorsindicatorsoscillatorbandsaveragetradingviewindicatormoving-average

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Columns Widthint12width
Space Between Columnsint8space
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

This indicator calculates momentum setups based on the Relative Strength Index (RSI) and plots in a separate pane. It offers multiple scanning modes such as Continuous Break, Continuous Retracement, Flip Break, Flip Retracement, and both regular and hidden div

Indicator v6 Oscillators & momentumDivergence Repaints
Updated 1 year ago · MPL-2.0 GitHub repository of Momentum Setup - RSI Directional Momentum Indicator
549 stars

Range Volume Change compares volume inside a chosen session window with the same window on the previous day and plots that change as a percentage. It accumulates volume during the window and, when enabled, volume outside it, drawing growing columns in a separa

Indicator v5 VolumeSessions & time Repaints
Updated 10 months ago · None stated GitHub repository of Range Volume Change

Beep Boop

by magic8bot
409 stars

This indicator calculates a modified MACD oscillator and signal line alongside a trend EMA filter, plotting the output as a stylized column histogram in a separate pane. Instead of plotting true MACD distance, it quantifies positive and negative histogram mome

Indicator v4 Oscillators & momentumTrend
Updated 3 years ago · MIT GitHub repository of Beep Boop

Mojito v3 Strategy

by namuan
318 stars

The Mojito v3 Strategy indicator evaluates volatility term structure by calculating the ratio between front-month and second-month VIX futures contracts. It smooths this ratio using a configurable median filter and compares the result against user-defined uppe

Indicator v5 Volatility & bands
Updated 2 months ago · MIT GitHub repository of Mojito v3 Strategy

Color Triangular Gradient

by ricardosantos79
261 stars

This script defines a helper function to generate colors via triangular interpolation using TradingView's color.from_gradient. The function blends between minimum, mid, and maximum color points based on an input value. It applies the function to the RSI indica

Indicator v5 Support & resistance
Updated 4 years ago · None stated GitHub repository of Color Triangular Gradient

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers