entry exit check condition problem
Avalanchecoder opened this issue · comments
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
- Include attached strategy.
- 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
- OS: Linux