Message409433
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. |
|
Date |
User |
Action |
Args |
2021-12-31 20:34:19 | mark.dickinson | set | recipients:
+ mark.dickinson, paul.moore, eric.smith, tim.golden, steven.daprano, zach.ware, steve.dower, wby78826 |
2021-12-31 20:34:19 | mark.dickinson | set | messageid: <1640982859.79.0.392333481182.issue46199@roundup.psfhosted.org> |
2021-12-31 20:34:19 | mark.dickinson | link | issue46199 messages |
2021-12-31 20:34:19 | mark.dickinson | create | |
|