# `TAlib.Indicators.UltimateOsc`
[🔗](https://github.com/benyblack/talib/blob/main/lib/indicators/ultimate_osc.ex#L1)

Ultimate Oscillator [Wikipedia](https://en.wikipedia.org/wiki/Ultimate_oscillator).

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.

# `ultimate_osc`

```elixir
@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`

```elixir
@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).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
