Indicado.Bollinger.eval-exclamation-mark
You're seeing just the function
eval-exclamation-mark
, go back to Indicado.Bollinger module for more information.
Specs
eval!(list(), pos_integer(), pos_integer()) :: [map(), ...] | no_return()
Calculates BB for the list. Raises exceptions when argument does not satisfy needed conditions to calculate Bollinger Bands.
Returns list of map [{lower: x, mean: y, upper: z}]
or {:error, reason}
lower
represents low band of bollinger bandmean
represents mean valueupper
represents upper value of bollinger band
Raises NotEnoughDataError
if the given list is not longh enough for calculating SMA.
Raises BadPeriodError
if period is an unacceptable number.
Raises BadDeviationError
if deviation is an unacceptable number.
Examples
iex> Indicado.Bollinger.eval!([1, 2, 3, 4, 5], 2, 2)
[%{lower: 0.5, mean: 1.5, upper: 2.5},
%{lower: 1.5, mean: 2.5, upper: 3.5},
%{lower: 2.5, mean: 3.5, upper: 4.5},
%{lower: 3.5, mean: 4.5, upper: 5.5}]
iex> Indicado.Bollinger.eval!([1, 2, 3, 4, 5], 2, 3)
[%{lower: 0.0, mean: 1.5, upper: 3.0},
%{lower: 1.0, mean: 2.5, upper: 4.0},
%{lower: 2.0, mean: 3.5, upper: 5.0},
%{lower: 3.0, mean: 4.5, upper: 6.0}]
iex> Indicado.Bollinger.eval!([], 2, 3)
** (NotEnoughDataError) not enough data
iex> Indicado.Bollinger.eval!([1, 2, 3, 4, 5], 0, 3)
** (BadPeriodError) bad period
iex> Indicado.Bollinger.eval!([1, 2, 3, 4, 5], 5, 0)
** (BadDeviationError) bad deviation