align max_entry_position_adjustment
behavior of backtesting to live
closes #7293
This commit is contained in:
parent
1fd223c815
commit
53d46a0385
@ -534,7 +534,11 @@ class Backtesting:
|
||||
|
||||
# Check if we should increase our position
|
||||
if stake_amount is not None and stake_amount > 0.0:
|
||||
|
||||
check_adjust_entry = True
|
||||
if self.strategy.max_entry_position_adjustment > -1:
|
||||
entry_count = trade.nr_of_successful_entries
|
||||
check_adjust_entry = (entry_count <= self.strategy.max_entry_position_adjustment)
|
||||
if check_adjust_entry:
|
||||
pos_trade = self._enter_trade(
|
||||
trade.pair, row, 'short' if trade.is_short else 'long', stake_amount, trade)
|
||||
if pos_trade is not None:
|
||||
@ -570,11 +574,6 @@ class Backtesting:
|
||||
|
||||
# Check if we need to adjust our current positions
|
||||
if self.strategy.position_adjustment_enable:
|
||||
check_adjust_entry = True
|
||||
if self.strategy.max_entry_position_adjustment > -1:
|
||||
entry_count = trade.nr_of_successful_entries
|
||||
check_adjust_entry = (entry_count <= self.strategy.max_entry_position_adjustment)
|
||||
if check_adjust_entry:
|
||||
trade = self._get_adjust_trade_entry_for_candle(trade, row)
|
||||
|
||||
enter = row[SHORT_IDX] if trade.is_short else row[LONG_IDX]
|
||||
|
Loading…
Reference in New Issue
Block a user