TAlib.Indicators.PPO (TAlib v0.13.0)

Copy Markdown View Source

Percentage Price Oscillator: (EMA(fast) - EMA(slow)) / EMA(slow) * 100.

See TAlib for the 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. For the absolute variant see TAlib.Indicators.APO.

Summary

Functions

Calculate the latest Percentage Price Oscillator value, in percent.

Calculate the full PPO series, defined once the slow EMA exists (index slow - 1 on).

Functions

ppo(prices, fast \\ 12, slow \\ 26)

@spec ppo([number()], pos_integer(), pos_integer()) :: float() | nil

Calculate the latest Percentage Price Oscillator value, in percent.

Parameters

  • prices: list of prices, oldest first.
  • fast: fast EMA period, a positive integer (default 12).
  • slow: slow EMA period, a positive integer (default 26).

Examples

iex> TAlib.Indicators.PPO.ppo([1, 2, 3, 4, 5, 6, 7, 8], 2, 4) |> Float.round(4)
15.3846

ppo_list(prices, fast \\ 12, slow \\ 26)

@spec ppo_list([number()], pos_integer(), pos_integer()) :: [float() | nil]

Calculate the full PPO series, defined once the slow EMA exists (index slow - 1 on).

Parameters

  • prices: list of prices, oldest first.
  • fast: fast EMA period, a positive integer (default 12).
  • slow: slow EMA period, a positive integer (default 26).

Examples

iex> TAlib.Indicators.PPO.ppo_list([1, 2, 3, 4, 5, 6, 7, 8], 2, 4) |> Enum.map(fn
...>   nil -> nil
...>   x -> Float.round(x, 4)
...> end)
[nil, nil, nil, 40.0, 28.5714, 22.2222, 18.1818, 15.3846]