fix(docs/strategy-advanced/custom_info-storage/example): only add to "custom_info" in backtesting and hyperopt
This commit is contained in:
parent
900deb663a
commit
1304918a29
@ -55,6 +55,7 @@ class AwesomeStrategy(IStrategy):
|
||||
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
# using "ATR" here as example
|
||||
dataframe['atr'] = ta.ATR(dataframe)
|
||||
if self.dp.runmode.value in ('backtest', 'hyperopt'):
|
||||
# add indicator mapped to correct DatetimeIndex to custom_info
|
||||
self.custom_info[metadata['pair']] = dataframe[['date', 'atr']].copy().set_index('date')
|
||||
return dataframe
|
||||
|
Loading…
Reference in New Issue
Block a user