Load protections as part of backtest()

this enables different values in hyperopt per epoch
This commit is contained in:
Matthias 2021-08-03 06:38:15 +02:00
parent 74a5cb3c21
commit 800b2eeaf0
1 changed files with 3 additions and 0 deletions

View File

@ -146,6 +146,8 @@ class Backtesting:
# since a "perfect" stoploss-sell is assumed anyway
# And the regular "stoploss" function would not apply to that case
self.strategy.order_types['stoploss_on_exchange'] = False
def _load_protections(self, strategy: IStrategy):
if self.config.get('enable_protections', False):
conf = self.config
if hasattr(strategy, 'protections'):
@ -194,6 +196,7 @@ class Backtesting:
Trade.reset_trades()
self.rejected_trades = 0
self.dataprovider.clear_cache()
self._load_protections(self.strategy)
def check_abort(self):
"""