Oneliner in "def init(self)". #754
Answered
by
kernc
traderblakeq
asked this question in
Q&A
-
Dear Community, I was wondering what I can do to make this "oneliner" work. Im trying to make a bool variable "self.rsi14" The issue is the ">" than 50 calculation. I assume it is something with the datastructure I dont fully understand. (Line 15): Gives me this output in terminal. (I know I can do the > 50 in next(self) def, but I would like to do that calculation in init if possible) Thank you for any input :). NB: Im a noob, so this might be a dumb question. |
Beta Was this translation helpful? Give feedback.
Answered by
kernc
Sep 29, 2022
Replies: 1 comment 1 reply
-
I'd do it like: self.rsi14 = self.I(lambda: ta.rsi(close.s), 14) > 50)
# or
self.rsi14 = self.I(lambda *args: ta.rsi(*args) > 50, self.data.Close.s, 14) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
traderblakeq
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'd do it like: