TAlib v0.3.6 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
Calculate RSI for a list of items
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
gain(list)
Link to this function
loss(list)
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
Link to this function
rsi_list(data, period \\ 14, top_is_first \\ false)
Calculate RSI for a list of items
Parameters
- data: List of prices
- period: Period of calculation. Default is 14.
- top_is_first: This one show if the list is ascending or descending based on dates. Regularly for OHLC data it needs to be false, because the older data comes first.
Example
iex> data = [1,2,3 ... ,100]
iex> TAlib.Indicators.RSI.rsi_list(data)
[nil, nil, nil ... ,100,100,100]