Conditional If statement not executing under the next(self)
I can't seem to get my conditional if statement to work!
It works properly with ONE condition (both seem to work), however nothing happens once I introduce TWO comparisons with the AND operator.
def next(self): if not self.position: if self.data.close >= self.mov and self.data.close >= self.boll.lines.top: print(self.data.close, self.datetime.date(ago=0), self.datetime.time(ago=0)) else: print('nothing to print! ')
I don't get an error, but nothing seems to output. Not even the else statement.
elsestatement is in different
ifcondition, so if you have no position it will not come up doesn't matter if your
and... string works or not.
It can be a case that your conditions under
andoperator never come together, so
andnever returns true. You may want to plot the indicators and prices, or print them for each bar, and verify if the pattern you are looking for happens.