For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
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[0] >= self.mov[0] and self.data.close[0] >= self.boll.lines.top[0]: print(self.data.close[0], 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.
-
Your
else
statement is in differentif
condition, so if you have no position it will not come up doesn't matter if yourif
...and
... string works or not.It can be a case that your conditions under
and
operator never come together, soand
never 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.