Indicado.SMA.eval

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

Specs

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

Calculates SMA for the list.

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

Examples

iex> Indicado.SMA.eval([1, 3, 5, 7], 2)
{:ok, [2.0, 4.0, 6.0]}

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

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