GetDividend

GetDividend ();

Description

Returns a dividend amount for the current symbol.

Example 1

declare lower;
def DCont = if IsNaN(GetDividend()) then DCont[1] else GetDividend();
plot Dividend = if DCont <> 0 then DCont else Double.NaN;

The example plots dividends for the current symbol on a separate subgraph. Values between different Ex-Dividend dates are saved using the DCont variable.

Example 2

declare lower;
def DCont = if IsNaN(GetDividend()) then DCont[1] else GetDividend();
plot DivA = if DCont <> 0 then DCont * 4 else Double.NaN;
def yield = DivA / close * 100;
AddLabel(yes, yield + "% Yield", DivA.TakeValueColor());

The example draws the annual dividend plot (considering that dividends are quarterly and they remain on the same level through the year). Also the code in this example defines a chart label that indicates the calculated dividend yield value in percentage and draws it using the same color as the main plot.