TAlib.Indicators.UltimateOsc (TAlib v0.13.0)

Copy Markdown View Source

Ultimate Oscillator Wikipedia.

With the buying pressure BP = close - min(low, prev_close) and the true range TR = max(high, prev_close) - min(low, prev_close), the oscillator blends three averages:

100 * (4 * A(short) + 2 * A(middle) + A(long)) / 7

where A(p) = SMA(BP, p) / SMA(TR, p). Bars are maps with at least :high, :low and :close. See TAlib for the conventions; values are defined once the longest window fills.

Summary

Functions

Calculate the latest Ultimate Oscillator value.

Calculate the full Ultimate Oscillator series, defined from index long - 1 on.

Functions

ultimate_osc(bars, short \\ 7, middle \\ 14, long \\ 28)

@spec ultimate_osc([map()], pos_integer(), pos_integer(), pos_integer()) ::
  float() | nil

Calculate the latest Ultimate Oscillator value.

Parameters

  • bars: list of bars, oldest first.
  • short: short window, a positive integer (default 7).
  • middle: middle window, a positive integer (default 14).
  • long: long window, a positive integer (default 28).

Examples

iex> bars = Enum.map(1..5, fn i ->
...>   %{high: i + 1.0, low: i - 1.0, close: i * 1.0}
...> end)
iex> TAlib.Indicators.UltimateOsc.ultimate_osc(bars, 2, 3, 4)
50.0

ultimate_osc_list(bars, short \\ 7, middle \\ 14, long \\ 28)

@spec ultimate_osc_list([map()], pos_integer(), pos_integer(), pos_integer()) :: [
  float() | nil
]

Calculate the full Ultimate Oscillator series, defined from index long - 1 on.

Parameters

  • bars: list of bars, oldest first.
  • short: short window, a positive integer (default 7).
  • middle: middle window, a positive integer (default 14).
  • long: long window, a positive integer (default 28).