TA-Lib / ta-lib-python

Python wrapper for TA-Lib (http://ta-lib.org/).
http://ta-lib.github.io/ta-lib-python
Other
9.78k stars 1.77k forks source link

SMA producing NaNs #601

Open Jark5455 opened 1 year ago

Jark5455 commented 1 year ago

Hello, it appears that with SMA, even if only a few input values are NaNs, ta-libs entire output comes out as NaN. I don't believe this is intended behavior, because even where there is a valid series of values where the SMA can be calculated, NaN values are being returned.

mrjbq7 commented 1 year ago

Intended behavior that’s how the underlying library works. Maybe not desired but many libraries like pandas provide a fillna() method that you can determine how to deal with NaNs in your data set. On Jun 27, 2023, at 2:37 PM, Jark @.***> wrote: Hello, it appears that with SMA, even if only a few input values are NaNs, ta-libs entire output comes out as NaN. I don't believe this is intended behavior, because even where there is a valid series of values where the SMA can be calculated, NaN values are being returned.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

Jark5455 commented 1 year ago

Is it possible to have TA-Lib just ignore NaNs in calculations? For example, if a period was [Nan, 0, 1, 2, 3] it would just remove Nan from the calculation and return 6 / 5. Or is there some sort of SIMD / Vectorization limitation that is preventing this?