relative_strength_index

relative_strength_index(x, w=14)[source]

Relative Strength Index

Parameters
  • x (Series) – time series of prices

  • w (Union[Window, int]) – Window or int: size of window and ramp up to use. e.g. Window(22, 10) where 22 is the window size and 10 the ramp up value. Window size defaults to length of series.

Return type

DataFrame

Returns

date-based time series of RSI

Usage

The RSI computes momentum as the ratio of higher closes to lower closes: stocks which have had more or stronger positive changes have a higher RSI than stocks which have had more or stronger negative changes.

See RSI for more information

Examples

Compute relative strength index over a \(14\) day window:

>>> prices = generate_series(100)
>>> relative_strength_index(prices, 14)

See also

moving_average() std() smoothed_moving_average()