karlwancl/Trady

RSI indicator returns null for this sequence

vjcapron opened this issue · 3 comments

I was running through a loop to calculate RSI(5) for about 800 stock tickers in my historical database. All but one resulted in the correct value.

The stock data for ticker ALB (Albermarle) returns a null RSI and I cannot figure out why. Can someone help me debug this?

Here is the OHLC data for the candles list. I was trying to calculate RSI(5) for September 20, 2018 candle.

image

@vjcapron could you give us the whole csv so we can use that csv to test?

The problem does not occur if I pass the function one more candle of OHLCV data. I'm not sure why I would need 11 candles to calculate RSI(5) but I was able to find a work-around.

@lppkarl I ran into this as well, I was calculating RSI with a length of 14 across 20 candles. What is the candle count requirement to calculate RSI? I thought it would just be the input length plus a small buffer.

For example, does it require 3x the input length?