matlab rsi,matlab实现RSI计算器

RSI calculator

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值