Closed YASHGUPTA2611 closed 2 years ago
Hi! Could you share more of the code? I can't fully analyze the issue.
Looking at the error message, it is mainly due to you using floats instead of integer which is what the value expects. It isn't due to stop loss or floating params.
I have applied a range function(the circled one) on af params for optimizing my strategy but it is giving some error.
If you see the error below it says TypeError: float object cannot be interpreted as an integer
. If you run range(0.02, 0.1, 0.02)
it actually gives an error.
>>> range(0.02, 0.1, 0.02)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'float' object cannot be interpreted as an integer
This is an error in the range function. You can also manually add an array instead.
giving the values as an array and now it is giving the error : - ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
This is the same issue as what you raised previously in this issue https://github.com/enzoampil/fastquant/issues/393#issuecomment-993367593
When you are backtesting with a range, you need to make the value of plot=False. That ValueError means that there are too many values to plot (given that you are backtesting over a range) and it is ambiguous. Thus plot=False
is the solution
Thanks @mikeejazmines , it worked