Don't surprise people with "after_fill" calls
This commit is contained in:
@@ -218,6 +218,11 @@ class StrategyResolver(IResolver):
|
|||||||
"Please update your strategy to implement "
|
"Please update your strategy to implement "
|
||||||
"`populate_indicators`, `populate_entry_trend` and `populate_exit_trend` "
|
"`populate_indicators`, `populate_entry_trend` and `populate_exit_trend` "
|
||||||
"with the metadata argument. ")
|
"with the metadata argument. ")
|
||||||
|
|
||||||
|
after_fill = 'after_fill' in getfullargspec(strategy.custom_stoploss).args
|
||||||
|
if after_fill:
|
||||||
|
strategy._ft_stop_uses_after_fill = True
|
||||||
|
|
||||||
return strategy
|
return strategy
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|||||||
@@ -720,6 +720,8 @@ class IStrategy(ABC, HyperStrategyMixin):
|
|||||||
# END - Intended to be overridden by strategy
|
# END - Intended to be overridden by strategy
|
||||||
###
|
###
|
||||||
|
|
||||||
|
_ft_stop_uses_after_fill = False
|
||||||
|
|
||||||
def __informative_pairs_freqai(self) -> ListPairsWithTimeframes:
|
def __informative_pairs_freqai(self) -> ListPairsWithTimeframes:
|
||||||
"""
|
"""
|
||||||
Create informative-pairs needed for FreqAI
|
Create informative-pairs needed for FreqAI
|
||||||
@@ -1168,6 +1170,10 @@ class IStrategy(ABC, HyperStrategyMixin):
|
|||||||
:param low: Low value of this candle, only set in backtesting
|
:param low: Low value of this candle, only set in backtesting
|
||||||
:param high: High value of this candle, only set in backtesting
|
:param high: High value of this candle, only set in backtesting
|
||||||
"""
|
"""
|
||||||
|
if after_fill and not self._ft_stop_uses_after_fill:
|
||||||
|
# Skip if the strategy doesn't support after fill.
|
||||||
|
return
|
||||||
|
|
||||||
stop_loss_value = force_stoploss if force_stoploss else self.stoploss
|
stop_loss_value = force_stoploss if force_stoploss else self.stoploss
|
||||||
|
|
||||||
# Initiate stoploss with open_rate. Does nothing if stoploss is already set.
|
# Initiate stoploss with open_rate. Does nothing if stoploss is already set.
|
||||||
|
|||||||
Reference in New Issue
Block a user