I got "ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()"

This means you are doing a comparsion with an (nd)array and a single value.

# This doesn't work
array < single_value

# This works
array[-1] < single_value

In case of self.candles, self.get_candles and indicators returning named tuples. You have a multi-dimensional array and need to also select the dimension:

# 2nd element on 1st dim 
array[0, 1]

More info: https://www.w3schools.com/python/numpy/numpy_array_indexing.asp

Last updated: 3 years ago