首页 > 解决方案 > 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()

标签: ta-lib

解决方案


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.


推荐阅读