Momentum Wikipedia.
MOM = price - price_period_bars_ago
See TAlib for the input conventions: prices are always given in
chronological order, oldest first, and the series is returned aligned
with the input. nil is returned when there is not enough data.
Summary
Functions
@spec momentum([number()], pos_integer()) :: number() | nil
Calculate the latest Momentum.
Parameters
- prices: list of prices, oldest first.
- period: how many bars back to compare against, a positive integer (default 14).
Examples
iex> TAlib.Indicators.Momentum.momentum([1, 2, 4, 8], 2)
6
@spec momentum_list([number()], pos_integer()) :: [number() | nil]
Calculate the full Momentum series in a single pass.
Returns a list aligned with prices: the first period entries are
nil, and every later entry is the price change over period bars.
Parameters
- prices: list of prices, oldest first.
- period: how many bars back to compare against, a positive integer (default 14).
Examples
iex> TAlib.Indicators.Momentum.momentum_list([1, 2, 4, 8], 2)
[nil, nil, 3, 6]