enter_tag can be checked in exit signal
This commit is contained in:
parent
0310d1cdf2
commit
5133faae6d
@ -922,18 +922,19 @@ class FreqtradeBot(LoggingMixin):
|
||||
analyzed_df, _ = self.dataprovider.get_analyzed_dataframe(trade.pair,
|
||||
self.strategy.timeframe)
|
||||
|
||||
|
||||
(enter, exit_, exit_tag) = self.strategy.get_exit_signal(
|
||||
trade.pair,
|
||||
self.strategy.timeframe,
|
||||
analyzed_df,
|
||||
is_short=trade.is_short
|
||||
is_short=trade.is_short,
|
||||
)
|
||||
|
||||
logger.debug('checking exit')
|
||||
exit_rate = self.exchange.get_rate(
|
||||
trade.pair, side='exit', is_short=trade.is_short, refresh=True)
|
||||
|
||||
enter_tag = # TODO
|
||||
enter_tag = '' # TODO
|
||||
if self._check_and_execute_exit(
|
||||
trade=trade,
|
||||
exit_rate=exit_rate,
|
||||
@ -1118,6 +1119,7 @@ class FreqtradeBot(LoggingMixin):
|
||||
exit_=exit_,
|
||||
force_stoploss=self.edge.stoploss(trade.pair) if self.edge else 0,
|
||||
enter_tag=enter_tag,
|
||||
exit_tag=exit_tag,
|
||||
)
|
||||
|
||||
if should_exit.exit_flag:
|
||||
|
@ -120,6 +120,8 @@ class IStrategy(ABC, HyperStrategyMixin):
|
||||
# Definition of plot_config. See plotting documentation for more details.
|
||||
plot_config: Dict = {}
|
||||
|
||||
tags: Dict[str, List[str]] = {}
|
||||
|
||||
def __init__(self, config: dict) -> None:
|
||||
self.config = config
|
||||
# Dict to determine if analysis is necessary
|
||||
@ -843,7 +845,8 @@ class IStrategy(ABC, HyperStrategyMixin):
|
||||
def should_exit(self, trade: Trade, rate: float, current_time: datetime, *,
|
||||
enter: bool, exit_: bool,
|
||||
low: float = None, high: float = None,
|
||||
force_stoploss: float = 0, enter_tag: Optional[str] = None) -> ExitCheckTuple:
|
||||
force_stoploss: float = 0, enter_tag: Optional[str] = None,
|
||||
exit_tag: Optional[str]) -> ExitCheckTuple:
|
||||
"""
|
||||
This function evaluates if one of the conditions required to trigger an exit order
|
||||
has been reached, which can either be a stop-loss, ROI or exit-signal.
|
||||
@ -884,7 +887,10 @@ class IStrategy(ABC, HyperStrategyMixin):
|
||||
current_rate = rate
|
||||
current_profit = trade.calc_profit_ratio(current_rate)
|
||||
|
||||
if self.use_exit_signal:
|
||||
if ((enter_tag in self.tags and exit_tag not in self.tags[enter_tag])):
|
||||
# sell_profit_only and profit doesn't reach the offset - ignore sell signal
|
||||
pass
|
||||
elif self.use_exit_signal:
|
||||
if exit_ and not enter:
|
||||
exit_signal = ExitType.EXIT_SIGNAL
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user