ta-lib - talib 计算 rsi 和交换 rsi 看起来非常不同
问题描述
我发现了一些类似问题的提及,但没有具体内容,因为我是使用 python 进行数据科学的新手,这对我来说可能是一个错误。
我还尝试反转输入数据,但两个图看起来都不同,看起来与交易所显示的相似。
所有的想法都得到了赞赏 干杯
图片:tradingview.com vs talib RSI
import json
import coinbase
import numpy as np
import requests as req
price_hist = req.get("https://api.pro.coinbase.com/products/BTC-EUR/candles?granularity=3600")# [ time, low, high, open, close, volume ],
data = json.loads(price_hist.content.decode('utf-8'))
candles = np.array(data)
close_data = candles[:,4]
close_data_rev = np.flip(candles[:,4], 0)
rsi_graph = ta.RSI(close_data, timeperiod=14)
rsi_graph_rev = ta.RSI(close_data_rev, timeperiod=14)
plt.plot(x_data, rsi_graph)
plt.plot(x_data, rsi_graph_rev)
plt.xticks(rotation=45)
fig_size[0] = 12
fig_size[1] = 9
plt.show()
解决方案
Calculation of the RSI is dependent on data history. Both are correct for the context (data history) that is provided.
Disclaimer: I'm however stating this fact independent of reading your code or looking at your image as the question has appeared to me before when working with the indicator.
推荐阅读
- javascript - 创建良好的拖放功能
- python - 从另一个 python 脚本调用带有 args 的 python 脚本?
- reactjs - React SSR:我的组件如何在其渲染方法中获取 URL 搜索 URL 参数
- c# - Visual Studio 无法运行项目
- r - 如何在 R 中绘制岭图?
- python - 在 Django 视图中填写表单字段
- php - 陷入为 API 响应创建数组
- android - onActivityResult() 可以在 onCreate() 之前调用吗?
- sql - 使用 strftime 的 SQLite 自定义格式日期
- firebase - 使用 Flutter 从 Firestore 读取数据时收到 RangeError 消息