ta-lib-python icon indicating copy to clipboard operation
ta-lib-python copied to clipboard

Why does it become all zeros after flattening in NATR, while this doesn't happen in other APIs?

Open gucasbrg opened this issue 1 month ago • 2 comments

import numpy as np
import talib

def _ta_natr_14(x1, x2, x3):
    t = 14
    x1 = x1.flatten()
    x2 = x2.flatten()
    x3 = x3.flatten()
    print(np.nan_to_num(talib.NATR(x1, x2, x3, timeperiod=t))[:100])

def _ta_natr_14_qs(x1, x2, x3):
    t = 14
    print(np.nan_to_num(talib.NATR(x1, x2, x3, timeperiod=t))[:100])


x1 = np.load('x1.npy')
x2 = np.load('x2.npy')
x3 = np.load('x3.npy')
_ta_natr_14(x1, x2, x3)
_ta_natr_14_qs(x1, x2, x3)

data.zip

gucasbrg avatar Jun 04 '24 08:06 gucasbrg