Indicado.MACD.eval-exclamation-mark

You're seeing just the function eval-exclamation-mark, go back to Indicado.MACD module for more information.
Link to this function

eval!(list, fast_period, slow_period, signal_period)

View Source

Specs

eval!(list(), pos_integer(), pos_integer(), pos_integer()) ::
  [map(), ...] | no_return()

Calculates MACD for the list.

Returns list of map [{macd: x, signal: y}] or {:error, reason}

  • macd represents macd calculation
  • signal represents signal line

Raises NotEnoughDataError if the given list is empty. Raises BadPeriodError if any period is an unacceptable number.

Examples

iex> Indicado.MACD.eval!([1, 2, 3, 4], 2, 4, 3)
[%{macd: 0.2666666666666666, signal: 0.1333333333333333},
  %{macd: 0.5155555555555553, signal: 0.3244444444444443},
  %{macd: 0.6945185185185183, signal: 0.5094814814814813}]

iex> Indicado.MACD.eval!([], 4, 8, 6)
** (NotEnoughDataError) not enough data

iex> Indicado.MACD.eval!([1, 2, 3, 4], 0, 4, 3)
** (BadPeriodError) bad period

iex> Indicado.MACD.eval!([1, 2, 3, 4], 2, 0, 3)
** (BadPeriodError) bad period

iex> Indicado.MACD.eval!([1, 2, 3, 4], 2, 4, 0)
** (BadPeriodError) bad period