kernc
kernc
Calling [`self.position.close()`](https://kernc.github.io/backtesting.py/doc/backtesting/backtesting.html#backtesting.backtesting.Position.close) should close _all_ active trades on the next bar.
Unfortunately, I really have no idea what you're doing. Construct a [reproducible minimal working example](https://en.wikipedia.org/wiki/Minimal_working_example) that shows off the issue, and I can investigate.
Most simply, until #20 is properly addressed, you could prepare the `data` beforehand. Assuming you always enter trades on the two instruments in parallel (buy one, sell the other), this...
Besides always entering trades on the two instruments simultaneously (buying one–selling the other, or vice versa), how does it restrict it?
Note, the passed in `data` can contain [additional columns](https://kernc.github.io/backtesting.py/doc/examples/Quick%20Start%20User%20Guide.html#Data) you require (e.g. `instrument1_Close`, `instrument2_Close`, ...), and they can be referred to by your strategy in any way you need them...
You're trying to buy low and sell high just like usual. I think the stats will be fine as-is? :thinking: Maybe account for _double the spread/commission_ as you're simulating entering...
Can you provide sample code in order for someone to be able to reproduce the issue?
Multiple positions/instruments aren't yet supported. Welcome a discussion if someone would have a look. > does the back tester has some sort of default maximum holding time where it closes...
> does the back tester has some sort of default maximum holding time where it closes the position after n amount of time has passed Sounds like a good idea...
@nicoloridulfo Can't one backtest arbitrage opportunities by providing the strategy with [extra data](https://github.com/kernc/backtesting.py/issues/39)?