RSI calculator

버전 1.0.0.0 (2.28 KB) 작성자: Josiah Renfree
Calculate the RSI for a stock over any time range for any given period
다운로드 수: 4.5K
업데이트 날짜: 2008/4/16

라이선스 보기

This program is used to calculate the Relative Strength Index (RSI) technical indicator for a user-provided vector giving stock prices. The user may also specify the number of samples to use for each period. The default period is 14 samples.

RSI = calc_RSI(data,N) calculates the RSI over the stock price values found in data using a period of N samples.

RSI = calc_RSI(data) calculates the RSI using the default period of 14 samples.

The vector 'data' must be formatted so that the value corresponding to the most recent date is at the end of the vector, while the oldest price value is found at the beginning of the vector. The vector RSI is formatted in the same way.

The vector 'RSI' will not be the same length as the vector 'data', since the first N samples of 'data' need to be used to calculate the first 'RSI' sample.

NOTE: I commonly use my other program, "Historical Stock Data Downloader," to retrieve the stock data that I pass to this RSI function for RSI calculation. If you use my other program, be aware that the stock data downloader returns data with the most recent date first, and the oldest date at the end of the array. The "calc_RSI" function must take data in the reverse order, with the most recent date at the end of the array. To flip the data, you will need to use the flipud command in Matlab. Just be aware of how the data needs to be formatted.

인용 양식

Josiah Renfree (2024). RSI calculator (https://www.mathworks.com/matlabcentral/fileexchange/18675-rsi-calculator), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R14
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Financial Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0.0

Fernando graciously pointed out that in the old code, lines 90 and 91 were hard-coded using a trading period of 14 days. The file is now updated to change accordingly with a period of N days.