[TIP] for people getting wrong values
marcusmota opened this issue · 0 comments
marcusmota commented
Hi guys I noticed a lot of people are complaining about having wrong values.
my RSI has the correct values, keep in mind the indicator values and the candle close values have different array lengths
let's say you have
const arrClose = [1,2,3,4,5];
const rsi = [...someValues];
keep in mind rsi.length !== arrClose.length
so if you add a loop to iterate through arrClose and use the index to access the rsi[i] you will get the wrong value for your RSI, you need to kind of adjust your "i" to access the correct value, something like
const diff = arrClose.length - rsi.length; //usually is 14 but you need to check on the code
for (let i=0;i<arrClose.length;i++) {
const rsiValue = rsi[i-diff] //rather than rsi[i];
//do whatever you need
}
Good luck!