Skip to content

Commit f264bb5

Browse files
committed
REF: Clarify warning message
Closes #184
1 parent 5d51caa commit f264bb5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

backtesting/backtesting.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -901,9 +901,10 @@ def _process_orders(self):
901901
elif (low <= (order.sl or -np.inf) <= high or
902902
low <= (order.tp or -np.inf) <= high):
903903
warnings.warn(
904-
"A SL/TP order would execute in the same bar as its contingent upon "
905-
"stop/limit order. Since we can't assert the precise intra-candle "
906-
"price movement, the affected SL/TP order will be executed on "
904+
f"({data.index[-1]}) A contingent SL/TP order would execute in the "
905+
"same bar its parent stop/limit order was turned into a trade. "
906+
"Since we can't assert the precise intra-candle "
907+
"price movement, the affected SL/TP order will instead be executed on "
907908
"the next (matching) price/bar, making the result (of this trade) "
908909
"somewhat dubious. "
909910
"See https://github.com/kernc/backtesting.py/issues/119",

0 commit comments

Comments
 (0)