TAlib v0.3.3 TAlib.Indicators.RSI

RSI indicator Wikipedia Calculate RSI based on price history

Link to this section Summary

Functions

Sum of Gains over the past x periods

Sum of Losses over the past x periods

RSI calculation

Link to this section Functions

Link to this function

average_gain(prices, period \\ 14)

Sum of Gains over the past x periods

Parameters

  • prices: List of prices, lates price is the first one in the list.
  • period: Period of calculation. Default is 14.

Example

  iex> prices = [1330.95, 1334.65, 1340, 1338.7, ...]
  iex> TAlib.Indicators.RSI.average_gain(prices)
  2.9571428571428475
Link to this function

average_loss(prices, period \\ 14)

Sum of Losses over the past x periods

Parameters

  • prices: List of prices, lates price is the first one in the list.
  • period: Period of calculation. Default is 14.

Example

  iex> prices = [1330.95, 1334.65, 1340, 1338.7, ...]
  iex> TAlib.Indicators.RSI.average_loss(prices)
  12.564285714285704
Link to this function

rsi(prices, period \\ 14)

RSI calculation

Parameters

  • prices: List of prices, lates price is the first one in the list.
  • period: Period of calculation. Default is 14.

Example

  iex> prices = [1330.95, 1334.65, 1340, 1338.7, ...]
  iex> TAlib.Indicators.RSI.rsi(prices)
  19.052001840773087