For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
CrossOver value for boll.lines.top (lines object) always returns 0
-
Running into an error where bt.ind.CrossOver(self.data.close, self.boll.lines.top) will always return 0, despite multiple crosses, however,
bt.ind.CrossOver(self.data.close, self.boll) returns -1, 0, and 1 values properly. It doesn't seem to return any values from the 'lines' object?def __init__(self): self.boll = bt.ind.BollingerBands(period=3, devfactor=2) self.tcrx = bt.ind.CrossOver(self.data.close, self.boll.lines.top) def next(self): print(self.tcrx[0])
-
@tx_562 said in CrossOver value for boll.lines.top (lines object) always returns 0:
bt.ind.CrossOver(self.data.close, self.boll.lines.top)
I think you want mid. The close won't go over the top.
-
If you reduce the devfactor or increase the period you'll start to get hits on the top and bottom.
-
@run-out Thank you! Looks like 'high' is giving me the proper values. Would the 'self.data.close' price be the 'current price' if I'm running replaydata?