anandanand84 / technicalindicators

A javascript technical indicators written in typescript with pattern recognition right in the browser
MIT License
2.14k stars 557 forks source link

Why RSI indicator show different values then in TradingView #208

Closed ruslankonev closed 4 years ago

ruslankonev commented 4 years ago

Why the same timeframe and period calculation show the different values on TradingView chart and calculated, especially when price is speed down or grow?

The first start with fetched candles show the correct value, but when price moving fast, Tradingview chart slowly increase or decrease indicator, but calculated RSI is totally wrong.

As example when on TV value is 34, calculated value can be 70..

I will be glad if someone explains to me how to calculate it correctly. I'm using an example way of RSI calculation

var RSI = require('technicalindicators').RSI;

var inputRSI = {
  values : [127.75,129.02,132.75,145.40,148.98,137.52,147.38,139.05,137.23,149.30,162.45,178.95,200.35,221.90,243.23,243.52,286.42,280.27,277.35,269.02,263.23,214.90],
  period : 14
};

RSI.calculate(inputRSI)
ruslankonev commented 4 years ago

I was wrong with the calculations