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

entry exit check condition problem #1110

Open
Avalanchecoder opened this issue Jan 23, 2024 · 0 comments
Open

entry exit check condition problem #1110

Avalanchecoder opened this issue Jan 23, 2024 · 0 comments

Comments

@Avalanchecoder
Copy link

Expected Behavior

when supertrend is greater than open and no position present it should take trade

Actual Behavior

random trade are being taken.

Steps to Reproduce

  1. Include attached strategy.
  2. run on data
class Supertrend(Strategy):
    def init(self):
        self.sup = self.I(Z.closefn,self.data.df.ST)
        self.ope = self.I(Z.closefn,self.data.Open)


    def next(self):
        if ((self.ope > self.sup)  and ((self.position.is_long) or (self.position.is_short)))  :
            self.position.close()
        elif ((self.sup > self.ope) and ((self.position.is_long!=True) or (self.position.is_short!=True)) ) :
            self.sell(size=50)

Additional info

I'm new to backtesting.py if i am mistaking anything let me know

image

  • OS: Linux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant