This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients eric.smith, mark.dickinson, paul.moore, steve.dower, steven.daprano, tim.golden, wby78826, zach.ware
Date 2021-12-31.20:34:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1640982859.79.0.392333481182.issue46199@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2021-12-31 20:34:19mark.dickinsonsetrecipients: + mark.dickinson, paul.moore, eric.smith, tim.golden, steven.daprano, zach.ware, steve.dower, wby78826
2021-12-31 20:34:19mark.dickinsonsetmessageid: <1640982859.79.0.392333481182.issue46199@roundup.psfhosted.org>
2021-12-31 20:34:19mark.dickinsonlinkissue46199 messages
2021-12-31 20:34:19mark.dickinsoncreate