为什么 ta-lib 的 RSI 输出因输入数组大小而异,而周期始终为 14?

问题描述

我在我的项目中使用节点的 talib-binding 来计算基于 Binance 的 websocket 烛台馈送的 RSI。

我想尽可能多地将我的 RSI 输出与 Binance 的 RSI 指标显示的内容同步,但有趣的是,对于默认的 14 周期,我为不同大小的输入数组获得了不同的 RSI 输出。例如:

//Chart interval 1 min in both cases

console.log(`records length: ${this.records.length}`); // length: 14
const outReal = talib.RSI(this.records,'Close');

console.log(outReal) // ouputs: 56

------

console.log(`records length: ${this.records.length}`); // length: 70
const outReal = talib.RSI(this.records,'Close');

console.log(outReal) // ouputs: 21

我很困惑,如果周期设置为 14(默认),RSI 不应该只考虑最后 14 根蜡烛(图表间隔 1 分钟)?

至于将我的输出与 Binance 的 RSI 同步。我可以同步两者的唯一方法是将输入数组截断为 14 个项目,现在这两个输出非常接近但不一致。

谢谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)