Skip to content

Commit acef307

Browse files
committed
DOC: Amend "sell() doesn't close buy()" warning with note re exclusive_orders=True
1 parent b35bced commit acef307

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

backtesting/backtesting.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,13 @@ def sell(self, *,
250250
251251
.. caution::
252252
Keep in mind that `self.sell(size=.1)` doesn't close existing `self.buy(size=.1)`
253-
trade unless the underlying asset price hasn't changed yet.
254-
Use `Trade.close()` or `Position.close()` to exit trades.
253+
trade unless:
254+
255+
* the backtest was run with `exclusive_orders=True`,
256+
* the underlying asset price is equal in both cases and
257+
the backtest was run with `spread = commission = 0`.
258+
259+
Use `Trade.close()` or `Position.close()` to explicitly exit trades.
255260
256261
See also `Strategy.buy()`.
257262

0 commit comments

Comments
 (0)