Indicado.RSI.eval

You're seeing just the function eval, go back to Indicado.RSI module for more information.

Specs

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

Calculates RSI for the list. It needs list of numbers and the length of list argument should at least be 1 more than period.

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

Examples

iex> Indicado.RSI.eval([1, 2, 3, 4, 5, 6], 2)
{:ok, [100.0, 100.0, 100.0, 100.0]}

iex> Indicado.RSI.eval([5, 4, 3, 2, 1, 0], 4)
{:ok, [0.0, 0.0]}

iex> Indicado.RSI.eval([2, 4, 6, 7, 2, 1, 5, 10], 3)
{:ok, [100.0, 37.5, 14.285714285714292, 39.99999999999999, 90.0]}

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

iex> Indicado.RSI.eval([1, 5, 10], 3)
{:error, :not_enough_data}

iex> Indicado.RSI.eval([1, 4], 0)
{:error, :bad_period}