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

Parabolic SAR [Wikipedia](https://en.wikipedia.org/wiki/Parabolic_SAR).

The trend starts up when the second close is above the first, and the
acceleration factor starts at `af_start` (default 0.02), stepping by
`af_step` (default 0.02) on every new extreme, capped at `af_max`
(default 0.2). Bars are maps with at least `:high`, `:low` and
`:close`. See `TAlib` for the remaining conventions; values are defined
from the second bar on.

# `sar`

```elixir
@spec sar([map()], number(), number(), number()) :: number() | nil
```

Calculate the latest Parabolic SAR value.

## Parameters

  - bars: list of bars, oldest first.
  - af_start: initial acceleration factor (default 0.02).
  - af_step: acceleration factor increment (default 0.02).
  - af_max: acceleration factor cap (default 0.2).

## Examples

    iex> bars = [
    ...>   %{high: 10, low: 9, close: 9.5},
    ...>   %{high: 11, low: 9.5, close: 10.5},
    ...>   %{high: 12, low: 10, close: 11.5},
    ...>   %{high: 11.5, low: 9.5, close: 10.0},
    ...>   %{high: 12.5, low: 10.5, close: 12.0}
    ...> ]
    iex> TAlib.Indicators.SAR.sar(bars) |> Float.round(4)
    9.2352

# `sar_ext`

```elixir
@spec sar_ext([map()], number(), number(), number()) :: number() | nil
```

The extended Parabolic SAR (TA-Lib SAREXT) with the standard start,
step and maximum acceleration factors.

    iex> bars = [
    ...>   %{high: 10, low: 9, close: 9.5},
    ...>   %{high: 11, low: 9.5, close: 10.5},
    ...>   %{high: 12, low: 10, close: 11.5}
    ...> ]
    iex> TAlib.Indicators.SAR.sar_ext(bars)
    9

# `sar_ext_list`

# `sar_list`

```elixir
@spec sar_list([map()], number(), number(), number()) :: [number() | nil]
```

Calculate the full Parabolic SAR series.

Returns a list aligned with `bars`: the first entry is `nil` (the trend
needs two bars), every later entry is the SAR stop for that bar.

## Parameters

  - bars: list of bars, oldest first.
  - af_start: initial acceleration factor (default 0.02).
  - af_step: acceleration factor increment (default 0.02).
  - af_max: acceleration factor cap (default 0.2).

## Examples

    iex> bars = [
    ...>   %{high: 10, low: 9, close: 9.5},
    ...>   %{high: 11, low: 9.5, close: 10.5},
    ...>   %{high: 12, low: 10, close: 11.5}
    ...> ]
    iex> TAlib.Indicators.SAR.sar_list(bars)
    [nil, 9, 9]

---

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