we have to work with Quantopian for a seminar at university. Our next task was to rebuild a squeeze momentum indicator using Bollinger Bands and Keltner Channels. My goal was to combine this with the Directional Movement Indicator as a signal for the direction of the next trade. But unfortunately I stuck at the ordering part. I don't know how to implement the order correctly (order if BB are within KC; direction depends on DI+ and DI-). Maybe I just use a wrong intuition due to my limited experience with python (I only used R and Matlab so far).
I will attach the algo. For any help or comments I am very thankful.
If you run the code, you will see that the following runtime error occurs:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
USER ALGORITHM:46, in trend_signal
sqzOn = (lowerBB > lowerKC) and (upperBB < upperKC)