TAlib.Indicators.StochRSI (TAlib v0.13.0)

Copy Markdown View Source

Stochastic RSI: the fast stochastic of the RSI series.

%K = (RSI - lowest RSI) / (highest RSI - lowest RSI) * 100 over the stochastic window. 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 or the RSI window has no range.

Summary

Functions

Calculate the latest Stochastic RSI (fast %K).

Calculate the full Stochastic RSI series, defined from index rsi_period + stoch_period - 1 on.

Functions

stoch_rsi(prices, rsi_period \\ 14, stoch_period \\ 5)

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

Calculate the latest Stochastic RSI (fast %K).

Parameters

  • prices: list of prices, oldest first.
  • rsi_period: RSI lookback window, a positive integer (default 14).
  • stoch_period: stochastic window over the RSI series (default 5).

Examples

iex> TAlib.Indicators.StochRSI.stoch_rsi([3, 5, 2, 6, 1, 4, 5, 3, 6, 2], 3, 3)
0.0

stoch_rsi_list(prices, rsi_period \\ 14, stoch_period \\ 5)

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

Calculate the full Stochastic RSI series, defined from index rsi_period + stoch_period - 1 on.

Parameters

  • prices: list of prices, oldest first.
  • rsi_period: RSI lookback window, a positive integer (default 14).
  • stoch_period: stochastic window over the RSI series (default 5).

Examples

iex> TAlib.Indicators.StochRSI.stoch_rsi_list([3, 5, 2, 6, 1, 4, 5, 3, 6, 2], 3, 3) |> Enum.map(fn
...>   nil -> nil
...>   x -> Float.round(x, 4)
...> end)
[nil, nil, nil, nil, nil, 60.9677, 100.0, 0.0, 100.0, 0.0]