ignore_roi_if_buy_signal -> ignore_roi_if_entry_signal

This commit is contained in:
Matthias
2022-04-05 20:20:51 +02:00
parent 5bafdb6108
commit b1378efdeb
17 changed files with 42 additions and 38 deletions

View File

@@ -320,3 +320,5 @@ def _strategy_settings(conf: Dict[str, Any]) -> None:
process_deprecated_setting(conf, None, 'use_sell_signal', None, 'use_exit_signal')
process_deprecated_setting(conf, None, 'sell_profit_only', None, 'exit_profit_only')
process_deprecated_setting(conf, None, 'sell_profit_offset', None, 'exit_profit_offset')
process_deprecated_setting(conf, None, 'ignore_roi_if_buy_signal',
None, 'ignore_roi_if_entry_signal')

View File

@@ -73,8 +73,6 @@ def process_temporary_deprecated_settings(config: Dict[str, Any]) -> None:
# check_conflicting_settings(config, 'ask_strategy', 'use_sell_signal',
# 'experimental', 'use_sell_signal')
process_deprecated_setting(config, 'ask_strategy', 'ignore_roi_if_buy_signal',
None, 'ignore_roi_if_buy_signal')
process_deprecated_setting(config, 'ask_strategy', 'ignore_buying_expired_candle_after',
None, 'ignore_buying_expired_candle_after')
# New settings
@@ -105,15 +103,17 @@ def process_temporary_deprecated_settings(config: Dict[str, Any]) -> None:
# Legacy way - having them in experimental ...
process_removed_setting(config, 'experimental', 'use_sell_signal', None, 'use_sell_signal')
process_removed_setting(config, 'experimental', 'sell_profit_only', None, 'sell_profit_only')
process_removed_setting(config, 'experimental', 'use_sell_signal', None, 'use_exit_signal')
process_removed_setting(config, 'experimental', 'sell_profit_only', None, 'exit_profit_only')
process_removed_setting(config, 'experimental', 'ignore_roi_if_buy_signal',
None, 'ignore_roi_if_buy_signal')
process_removed_setting(config, 'ask_strategy', 'use_sell_signal', None, 'use_sell_signal')
process_removed_setting(config, 'ask_strategy', 'sell_profit_only', None, 'sell_profit_only')
process_removed_setting(config, 'ask_strategy', 'sell_profit_offset',
None, 'sell_profit_offset')
None, 'ignore_roi_if_entry_signal')
process_removed_setting(config, 'ask_strategy', 'use_sell_signal', None, 'exit_sell_signal')
process_removed_setting(config, 'ask_strategy', 'sell_profit_only', None, 'exit_profit_only')
process_removed_setting(config, 'ask_strategy', 'sell_profit_offset',
None, 'exit_profit_offset')
process_removed_setting(config, 'ask_strategy', 'ignore_roi_if_buy_signal',
None, 'ignore_roi_if_entry_signal')
if (config.get('edge', {}).get('enabled', False)
and 'capital_available_percentage' in config.get('edge', {})):
raise OperationalException(

View File

@@ -152,7 +152,7 @@ CONF_SCHEMA = {
'use_exit_signal': {'type': 'boolean'},
'exit_profit_only': {'type': 'boolean'},
'exit_profit_offset': {'type': 'number'},
'ignore_roi_if_buy_signal': {'type': 'boolean'},
'ignore_roi_if_entry_signal': {'type': 'boolean'},
'ignore_buying_expired_candle_after': {'type': 'number'},
'trading_mode': {'type': 'string', 'enum': TRADING_MODES},
'margin_mode': {'type': 'string', 'enum': MARGIN_MODES},

View File

@@ -927,7 +927,7 @@ class FreqtradeBot(LoggingMixin):
exit_signal_type = "exit_short" if trade.is_short else "exit_long"
if (self.config.get('use_exit_signal', True) or
self.config.get('ignore_roi_if_buy_signal', False)):
self.config.get('ignore_roi_if_entry_signal', False)):
analyzed_df, _ = self.dataprovider.get_analyzed_dataframe(trade.pair,
self.strategy.timeframe)

View File

@@ -463,7 +463,7 @@ def generate_strategy_stats(pairlist: List[str],
'use_exit_signal': config['use_exit_signal'],
'exit_profit_only': config['exit_profit_only'],
'exit_profit_offset': config['exit_profit_offset'],
'ignore_roi_if_buy_signal': config['ignore_roi_if_buy_signal'],
'ignore_roi_if_entry_signal': config['ignore_roi_if_entry_signal'],
**daily_stats,
**trade_stats
}

View File

@@ -87,7 +87,7 @@ class StrategyResolver(IResolver):
("unfilledtimeout", None),
("use_exit_signal", True),
("exit_profit_only", False),
("ignore_roi_if_buy_signal", False),
("ignore_roi_if_entry_signal", False),
("exit_profit_offset", 0.0),
("disable_dataframe_checks", False),
("ignore_buying_expired_candle_after", 0),
@@ -190,12 +190,16 @@ class StrategyResolver(IResolver):
warn_deprecated_setting(strategy, 'sell_profit_only', 'exit_profit_only', True)
warn_deprecated_setting(strategy, 'sell_profit_offset', 'exit_profit_offset', True)
warn_deprecated_setting(strategy, 'use_sell_signal', 'use_exit_signal', True)
warn_deprecated_setting(strategy, 'ignore_roi_if_buy_signal',
'ignore_roi_if_entry_signal', True)
else:
# TODO: Implementing one of the following methods should show a deprecation warning
# buy_trend and sell_trend, custom_sell
warn_deprecated_setting(strategy, 'sell_profit_only', 'exit_profit_only')
warn_deprecated_setting(strategy, 'sell_profit_offset', 'exit_profit_offset')
warn_deprecated_setting(strategy, 'use_sell_signal', 'use_exit_signal')
warn_deprecated_setting(strategy, 'ignore_roi_if_buy_signal',
'ignore_roi_if_entry_signal')
if (
not check_override(strategy, IStrategy, 'populate_buy_trend')

View File

@@ -93,7 +93,7 @@ class IStrategy(ABC, HyperStrategyMixin):
use_exit_signal: bool
exit_profit_only: bool
exit_profit_offset: float
ignore_roi_if_buy_signal: bool
ignore_roi_if_entry_signal: bool
# Position adjustment is disabled by default
position_adjustment_enable: bool = False
@@ -871,7 +871,7 @@ class IStrategy(ABC, HyperStrategyMixin):
current_profit = trade.calc_profit_ratio(current_rate)
# if enter signal and ignore_roi is set, we don't need to evaluate min_roi.
roi_reached = (not (enter and self.ignore_roi_if_buy_signal)
roi_reached = (not (enter and self.ignore_roi_if_entry_signal)
and self.min_roi_reached(trade=trade, current_profit=current_profit,
current_time=current_time))

View File

@@ -67,7 +67,7 @@ class {{ strategy }}(IStrategy):
# These values can be overridden in the config.
use_exit_signal = True
exit_profit_only = False
ignore_roi_if_buy_signal = False
ignore_roi_if_entry_signal = False
# Number of candles the strategy requires before producing valid signals
startup_candle_count: int = 30

View File

@@ -67,7 +67,7 @@ class SampleStrategy(IStrategy):
# These values can be overridden in the config.
use_exit_signal = True
exit_profit_only = False
ignore_roi_if_buy_signal = False
ignore_roi_if_entry_signal = False
# Hyperoptable parameters
buy_rsi = IntParameter(low=1, high=50, default=30, space='buy', optimize=True, load=True)