Ben Lockhart
Ben Lockhart
thank you for replying - I appreciate it.. I have found a way to do it also, but not using barssince.. here's one you might like: import backtesting from backtesting...
you need to add a date time column in and set that as the index prior to running your backtest: df['datetime'] = pd.to_datetime(df['datetime']) df.set_index('datetime', inplace=True)
its easier to set a percentage based stop/target: def next(self): super().next() price = self.data.Close[-1] if self.signal == 1: if not self.position: self.buy(size=0.99, tp=1.06*price, sl=0.98*price) maybe divide your capital by the...