The strategy doesn't execute #574
Unanswered
analyticray
asked this question in
Q&A
Replies: 1 comment
-
If you Therefore, either of these should work: def init(self):
# Make it an indicator. Indicators' lengths are auto-incremented
self.starTrade = self.I(lambda: self.data.starTrade) or: def next(self):
# Strategy.data is auto-incremented
if self.data.starTrade[-1] > 0:
... And the same for the other one. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have sample data as follows:

I would like to execute the buy when StartTrade is > 0 and close the position (sell) when endTrade >0. However, the strategy doesn't execute all (no trades) when I execute the following code:
class SmaCross(Strategy):
Can you please advise on what went wrong?
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions