chore: improve statement sequence for improved short circuiting
Some checks failed
Build Documentation / Deploy Docs through mike (push) Waiting to run
Devcontainer Pre-Build / build-and-push (push) Has been cancelled

This commit is contained in:
Matthias 2024-10-12 11:44:29 +02:00
parent 883122a98b
commit 2756a1f1a0

View File

@ -1353,9 +1353,9 @@ class Backtesting:
# don't open on the last row # don't open on the last row
# We only open trades on the main candle, not on detail candles # We only open trades on the main candle, not on detail candles
if ( if (
(self._position_stacking or len(LocalTrade.bt_trades_open_pp[pair]) == 0) can_enter
and can_enter
and trade_dir is not None and trade_dir is not None
and (self._position_stacking or len(LocalTrade.bt_trades_open_pp[pair]) == 0)
and not PairLocks.is_pair_locked(pair, row[DATE_IDX], trade_dir) and not PairLocks.is_pair_locked(pair, row[DATE_IDX], trade_dir)
): ):
if self.trade_slot_available(LocalTrade.bt_open_open_trade_count): if self.trade_slot_available(LocalTrade.bt_open_open_trade_count):