Replies: 2 comments
-
I'm still not sure why this was doing this, but I seemed to have worked around the problem. I change the condition on my buys and sells from checking self.position.is_long/short to self.position.size == 0. I only wanted one trade at a time anyway so this seems better, but I still don't get how it could have created multiple trades in the same direction previously. |
Beta Was this translation helpful? Give feedback.
-
Just to confirm, were you maybe initializing it with lots of data? Plotting does some downsampling if more than 10_000 candles: backtesting.py/backtesting/_plotting.py Line 89 in 73e1534 Multiple trades per bar have been confirmed with trade data? |
Beta Was this translation helpful? Give feedback.
-
When I inherit from TrailingStrategy I am seeing multiple trades per bar created. Is there something simple I am doing wrong? Is there an example of this base class that shows it's correct usage? I've seen the one that uses TrailingStrategy and SignalStrategy together but I just want to use TrailingStrategy.
Beta Was this translation helpful? Give feedback.
All reactions