TAlib.Indicators.ChaikinAD (TAlib v0.13.0)

Copy Markdown View Source

Chaikin Accumulation/Distribution line and oscillator.

With the Close Location Value CLV = ((close - low) - (high - close)) / (high - low):

  • AD accumulates CLV * volume across bars (zero-range bars contribute nothing)
  • ADOSC = EMA(CLV * volume, fast) - EMA(CLV * volume, slow)

Bars are maps with at least :high, :low, :close and :volume. See TAlib for the conventions.

Summary

Functions

The latest value of the Chaikin A/D line.

The Chaikin A/D line for every bar.

The Chaikin A/D oscillator: EMA(flow, fast) - EMA(flow, slow), defined from index slow - 1 on.

Functions

ad(bars)

@spec ad([map()]) :: float() | nil

The latest value of the Chaikin A/D line.

Parameters

  • bars: list of bars, oldest first.

Examples

iex> TAlib.Indicators.ChaikinAD.ad([
...>   %{high: 11, low: 9, close: 10, volume: 100},
...>   %{high: 12, low: 8, close: 11, volume: 200}
...> ])
100.0

ad_list(bars)

@spec ad_list([map()]) :: [float()]

The Chaikin A/D line for every bar.

iex> TAlib.Indicators.ChaikinAD.ad_list([
...>   %{high: 11, low: 9, close: 10, volume: 100},
...>   %{high: 12, low: 8, close: 11, volume: 200}
...> ])
[0.0, 100.0]

adosc(bars, fast \\ 3, slow \\ 10)

@spec adosc([map()], pos_integer(), pos_integer()) :: float() | nil

The Chaikin A/D oscillator: EMA(flow, fast) - EMA(flow, slow), defined from index slow - 1 on.

Parameters

  • bars: list of bars, oldest first.
  • fast: fast EMA period, a positive integer (default 3).
  • slow: slow EMA period, a positive integer (default 10).

Examples

iex> TAlib.Indicators.ChaikinAD.adosc(
...>   [
...>     %{high: 11, low: 9, close: 10, volume: 100},
...>     %{high: 12, low: 8, close: 11, volume: 200}
...>   ],
...>   2,
...>   2
...> )
0.0