Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can you use df column instead of indicator class to trigger buy and sell? #64

Closed
leeu3581 opened this issue May 9, 2020 · 1 comment
Labels
question Not a bug, but a FAQ entry

Comments

@leeu3581
Copy link

leeu3581 commented May 9, 2020

If I have a df column of True and False values, is there a way for this to trigger buy and sell instead of using indicators?

I would like to do something along the lines of the following:

def next(self):
  if df['Entry'] == True:
   self.buy()
  elif df['Exit'] == True:
   self.sell()

How can I convert a df column to your customized numpy arrays? I tried df.Entry.to_numpy() but this doesn't seem to be the correct format to do the iterative comparisons.

Thank you!

@kernc
Copy link
Owner

kernc commented May 9, 2020

See #39. You can pass extra precomputed columns in the Backtest(..., data=). They will be accessible likewise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Not a bug, but a FAQ entry
Projects
None yet
Development

No branches or pull requests

2 participants