Hello David,
This is a case where using the in-IDE debugger is a great tool.
I cloned your algo and ran it. The error you get is pretty explicit:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
...
USER ALGORITHM:69, in myfunc
if RSIvalue > RSIbuy and context.portfolio.positions[context.xiv].amount == 0 and len(get_open_orders()) == 0:
The error tells us the problem is in line 69. So I click on the number '69' in the left-hand margin of the IDE and the debugger is enabled. I press "build" and wait for it to get to 69. When it gets there, I type in the variable names:
RSIvalue
> RSIvalue: ndarray
RSIbuy
> 30
So what you've got there is you're trying to evaluate if an array is larger than an integer - and that isn't something that Python is going to do for you. You need to specific which term in that array is the one you want to compare to "30". RSIvalue[0]
gets your code to run, but I doubt that's exactly what you want. (I note that all of the values of that array are NaN, so I think you're going to have another problem to figure out pretty soon!)
P.S. It's generally better to ask a new question than re-open one that is old - lots has changed on the platform. In this case, it's just a generic Python error, so it's not a big deal.
Disclaimer
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.