One of the commonly used technical indicators: Understanding the RSI indicator

What is the RSI indicator?

  • RSI (Relative Strength Index), also known as Relative Strength Index in Chinese, was first created by Welles Wilder and published in his book "New Ideas in Technical Trading Systems" (1978 edition)

  • Basic principle of RSI indicator: Evaluate the strength of long and short forces by measuring the percentage of the total increase in stock price over a period of time to the average of the total change in stock price. It can reflect the prosperity of the market in a certain period.

The picture below is Tesla’s recent K-line and RSI indicator charts.

In the picture above, RSI has three curves, namely RSI1, RSI2, and RSI3, which correspond to the 6-day, 12-day, and 24-day line RSI respectively. The shorter the period of RSI, the higher the sensitivity; the longer the period, the lower the sensitivity, but the more stable the trend.

RSI formula explanation

Formula 1: RSI (N days) = 100% * (sum of closing increases and decreases within N days)/(sum of absolute values ​​of closing increases and decreases within N days)

Official 2:

  • It can be seen that Formula 2 is a variation of Formula 1, because the sum of closing increases + the sum of closing decreases = the sum of closing increases and decreases

  • From the above formula, we can know the technical meaning of the RSI indicator, that is, comparing the upward power with the downward power (the comparison of the power of buyers and sellers). If the upward power is greater, the calculated indicator will rise; if the downward power is greater, , the indicator drops, and the strength of the market trend can be calculated from this.

RSI formula calculation

  1. Using RSI indicator in talib

import talib
 
rsi = talib.RSI(np.array(close), timeperiod=6)     #RSI的天数一般是6、12、24
  1. Using RSI indicator in backtrader

import backtrader as b

bt.ind.RSI(self.data, period=14)
bt.ind.RSI_SMA(self.data, period=14)

illustrate:

  • The RelativeStrengthIndex class uses SmoothedMovingAverage by default, corresponding to the MovAv.Smoothed class, and the safediv parameter is set to False.

  • RSI_Safe class: Inherited from RelativeStrengthIndex class, but the safediv parameter is set to True

  • RSI_SMA class: Use SimpleMovingAverage as moving average movav = Sum(data, period) / period

  • RSI_EMA class: Use ExponentialMovingAverage as moving average

RSI indicator application

The RSI indicator is mainly used to determine whether the market is overbought or oversold. The RSI value is between 0 and 100, 50 is the equilibrium point, 30 to 70 is the normal trading state, there are fewer opportunities to exceed 80 or below 20, and there are even fewer opportunities to be above 90 and below 10. The more commonly used are the 6-day, 12-day and 24-day RSI lines, which are used to judge short-term, medium-term and long-term market trends respectively.

  • When RSI>80, it is an overbought state, and the subsequent market may experience a correction or a turn, especially at this time, forming an M-head or head-and-shoulders top pattern; when RSI>90, it is a severely overbought state.

  • When RSI <20, it is an oversold state, and the probability of a short-term rebound is high, especially when a W-bottom or head-and-shoulders bottom pattern is formed at this time; when RSI <10, it is a severely oversold state, and the stock price may stop falling and rebound at any time. Opportunity

  • RSI value can be used as an indicator to judge the strength of long and short positions to determine the direction of the trend. Taking the RSI value of 50 as the equilibrium point of the long-short battle, when the RSI value is above 50 for a long time, the bulls are strong; when the RSI value is below 50 for a long time, the shorts are strong. The rising or falling direction of the RSI line represents the change in the power of the long and short parties.

  • When the short-term RSI crosses the long-term RSI from bottom to top, a golden cross is formed, which is a buy signal; when the short-term RSI crosses the long-term RSI from top to bottom, a dead cross is formed, which is a sell signal.

  • The divergence between the RSI line trend and the stock trend indicates that the price is about to reverse

  • RSI is in the overbought and oversold zone, which is prone to passivation and the price is delayed in reversing

Conclusion & Communication

Follow the WeChat public account: Zhuge Shuo Talk for more content. At the same time, you can also get invitations to join investment exchange groups and quantitative investment seminar groups, where you can communicate and discuss with many investment enthusiasts, quantitative practitioners, and technology experts, and quickly improve your investment level.

Writing articles is not easy. If you think this article is helpful to you, please give it a like.

reference

Guess you like

Origin blog.csdn.net/richardzhutalk/article/details/125348446