creating indicator if condition is met in next()
-
Hello everyone, anyone can provide me with a hint:
My intention is to create "indicator" based on the sum of the values only in case a condition is met in the next().
Specifically: I'd like to use the SumN if self.position.
When I run it, I get this error:
TypeError: must be real number, not SumN.
The question is how to get value out of:
<class 'backtrader.indicators.basicops.SumN'>
(The index [0] doesn't work for me as "TypeError: 'float' object is not subscriptable") -
Hello everyone, if anyone interested I solved this out with self.feed.get() and numpy.sum().
-
@vaclavku said in creating indicator if condition is met in next():
When I run it, I get this error:
When you run what?
@vaclavku said in creating indicator if condition is met in next():
if anyone interested I solved this out with self.feed.get() and numpy.sum().
What did you actually solve? Because there was nothing showing what you were attempting.
@vaclavku said in creating indicator if condition is met in next():
if self.position.
That won't work inside an indicator because an indicator per se has no notion of a position.