Add position_adjustment_enable config keyword to enable it.
This commit is contained in:
@@ -173,6 +173,9 @@ class Configuration:
|
||||
if 'sd_notify' in self.args and self.args['sd_notify']:
|
||||
config['internals'].update({'sd_notify': True})
|
||||
|
||||
if config.get('position_adjustment_enable', False):
|
||||
logger.warning('`position_adjustment` has been enabled for strategy.')
|
||||
|
||||
def _process_datadir_options(self, config: Dict[str, Any]) -> None:
|
||||
"""
|
||||
Extract information for sys.argv and load directory configurations
|
||||
|
@@ -179,7 +179,8 @@ class FreqtradeBot(LoggingMixin):
|
||||
self.exit_positions(trades)
|
||||
|
||||
# Check if we need to adjust our current positions before attempting to buy new trades.
|
||||
self.process_open_trade_positions()
|
||||
if self.config.get('position_adjustment_enable', False):
|
||||
self.process_open_trade_positions()
|
||||
|
||||
# Then looking for buy opportunities
|
||||
if self.get_free_open_trades():
|
||||
@@ -521,7 +522,7 @@ class FreqtradeBot(LoggingMixin):
|
||||
if not stake_amount:
|
||||
logger.info(f'Additional order failed to get stake amount for pair {pair}, amount={amount}, price={enter_limit_requested}')
|
||||
return False
|
||||
|
||||
|
||||
logger.debug(f'Executing additional order: amount={amount}, stake={stake_amount}, price={enter_limit_requested}')
|
||||
|
||||
order_type = 'market'
|
||||
|
@@ -403,8 +403,10 @@ class Backtesting:
|
||||
|
||||
def _get_sell_trade_entry_for_candle(self, trade: LocalTrade,
|
||||
sell_row: Tuple) -> Optional[LocalTrade]:
|
||||
|
||||
trade = self._get_adjust_trade_entry_for_candle(trade, sell_row)
|
||||
|
||||
# Check if we need to adjust our current positions
|
||||
if self.config.get('position_adjustment_enable', False):
|
||||
trade = self._get_adjust_trade_entry_for_candle(trade, sell_row)
|
||||
|
||||
sell_candle_time = sell_row[DATE_IDX].to_pydatetime()
|
||||
sell = self.strategy.should_sell(trade, sell_row[OPEN_IDX], # type: ignore
|
||||
|
Reference in New Issue
Block a user