Skip to content

next function in Strategy not taking steps #266

Answered by kernc
jjphung asked this question in Q&A
Discussion options

You must be logged in to vote

You are assigning:

self.tenkansens = self.I(self.tenkansen, h, l).s     # type: pd.Series

that is, the indicator but transformed into pd.Series, which makes it invisible to Backtest for iterative lengthening.

If you instead do it like this, it should work:

def init(self):
    self.tenkansens = self.I(self.tenkansen, h, l)   # type: _Indicator

def next(self):
    print(self.tenkansens.s.iloc[-1])

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@jjphung
Comment options

@kernc
Comment options

@jjphung
Comment options

@kernc
Comment options

Answer selected by jjphung
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants