# RelativeStrengthIndex data

I would like to extract the RSI data of a certain stock, let just say the SPX index. How to do that? Or, alternatively, how to calculate the RSI from FinancialData?

FinancialData["^SPX", "OHLCV", {DateList[{2016, 12}], Today}]

• Have you seen RelativeStrengthIndex and FinancialIndicator ? It appears they're only for the trading charts though. You'll probably need to use MovingMap to compute it yourself from the prices given by FinancialData Apr 6 '21 at 9:42
• indeed, I can visualize RelativeStrengthIndex in a chart. But I would like to work on the data too. Apr 6 '21 at 10:22

You can use FinancialIndicator["RelativeStrengthIndex", n] @ data to get a time series of "the ratio of n-period exponential moving averages for gains and losses rescaled to be between 0 and 100" or FinancialIndicator["RelativeStrengthIndex"] to get the same with default n = 14:

data = FinancialData["^SPX", "OHLCV", {DateList[{2016, 12}], Today}]

rsi = FinancialIndicator["RelativeStrengthIndex"]@ data;

rsi["Path"] // Short[#, 5] &


DateListPlot[rsi]


Alternatively, you use FinancialIndicator["RelativeStrengthIndex"] with the "Close" series as input:

closes = data[[All, 2, 4]];

rsib = FinancialIndicator["RelativeStrengthIndex"] @ closes;

ListLinePlot[rsib]


Using n = 60:

rsi60 = FinancialIndicator["RelativeStrengthIndex", 60]@ data;

DateListPlot[rsi60]