fix(docs/strategy-customization): add "hyperopt" to runmode check for custom_info in custom_stoploss example

This commit is contained in:
Joe Schr 2021-03-04 14:50:04 +01:00
parent b52698197b
commit 4064f856d1
1 changed files with 2 additions and 2 deletions

View File

@ -249,8 +249,8 @@ class AwesomeStrategy(IStrategy):
result = 1
if self.custom_info[pair] is not None and trade is not None:
# using current_time directly (like below) will only work in backtesting.
# so check "runmode" to make sure that it's only used in backtesting
if(self.dp.runmode == RunMode.BACKTEST):
# so check "runmode" to make sure that it's only used in backtesting/hyperopt
if self.dp and self.dp.runmode.value in ('backtest', 'hyperopt'):
relative_sl = self.custom_info[pair].loc[current_time]['atr]
# in live / dry-run, it'll be really the current time
else: