Open nameless0704 opened 2 years ago
the same with function BBANDS...I don't think there is NaN interfering because the last 3 values are non-NaN but still getting NaN returns.
You will find NaN at the beginning due to the lookback period not having enough values to calculate, and then you can find NaN later if your data set has NaN in it in the middle.
On Sep 5, 2022, at 1:38 AM, nameless0704 @.***> wrote:
the same with function BBANDS...I don't think there is NaN interfering because the last 3 values are non-NaN but still getting NaN returns.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.
Added a note about NaN handling b0439e6e0565647e21b1ceee245bad4fac55aad6
Why is the last MA a NaN here?
The timeperiod is 3. And clearly the last 5 values of the input are not NaNs.
default MA is SMA, but TA-Lib calculates it in a most efficient way: by adding the next bar, removing the bar[-period] and deviding by timeperiod. So it has a rolling sum of bars in a middle of period. Any NaN that hits this rolling sum will spoil the sum and all values after it will be NaNs. TA-Lib doesn't expect any appearance of NaN values in input data.