Indicado.ADI (Indicado v0.0.4) View Source

This is the ADI module used for calculating Accumulation Distribution Line.

Link to this section Summary

Types

The argument passed to eval functions should be a list of adi_data_map type.

Functions

Calculates ADI for the list. The list argument passed to eval function should be list of adi_data_map type.

Calculates ADI for the list. The list argument passed to eval function should be list of adi_data_map type spec. Raises exceptions when arguments does not satisfy needed conditions.

Link to this section Types

Specs

adi_data_map() :: %{
  low: float(),
  high: float(),
  close: float(),
  volume: float()
}

The argument passed to eval functions should be a list of adi_data_map type.

Link to this section Functions

Specs

eval([adi_data_map(), ...]) :: {:ok, [float(), ...]} | {:error, atom()}

Calculates ADI for the list. The list argument passed to eval function should be list of adi_data_map type.

Returns {:ok, adi_ist} or {:error, reason}

Examples

iex> Indicado.ADI.eval([%{low: 1.0, high: 11.0, close: 10.0, volume: 5.7}, %{low: 2.0, high: 6.0, close: 3.0, volume: 11.5}, %{low: 3.0, high: 7.0, close: 4.0, volume: 2.0}, %{low: 4.0, high: 20.3, close: 18.0, volume: 20.2}])
{:ok, [4.5600000000000005, -1.1899999999999995, -2.1899999999999995, 12.309386503067484]}


iex> Indicado.ADI.eval([%{low: 1.0, high: 4.0, close: 3.0, volume: 2.0}])
{:ok, [0.6666666666666666]}

iex> Indicado.ADI.eval([])
{:error, :not_enough_data}

Specs

eval!([adi_data_map(), ...]) :: [float(), ...] | no_return()

Calculates ADI for the list. The list argument passed to eval function should be list of adi_data_map type spec. Raises exceptions when arguments does not satisfy needed conditions.

Returns adi_ist or, Raises NotEnoughDataError if the given list lenght is zero.

Examples

iex> Indicado.ADI.eval!([%{low: 1.0, high: 4.0, close: 3.0, volume: 2.0}])
[0.6666666666666666]

iex> Indicado.ADI.eval!([])
** (NotEnoughDataError) not enough data