Mark Dickinson <dicki...@gmail.com> added the comment:

When you do:

    FINUB = np.empty(len(close))
    FINLB = np.empty(len(close))

you're creating two *uninitialised* arrays of values. (See the NumPy 
documentation at 
https://numpy.org/doc/stable/reference/generated/numpy.empty.html.)

When you then do 

    FINUB[i] = UB[i] if UB[i] < FINUB[i-1] \
                and close[i-1] > FINUB[i] else FINUB[i-1]

on the first iteration of the loop (i = 1), you make use of the (undefined) 
value in FINUB[0] to compute FINUB[1].

In other words, this is a bug in your code, rather than in Python or NumPy.

----------
nosy: +mark.dickinson
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46199>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to