From 7852feab0566ecdda19e705cd88c7c7bd61cd52b Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 7 Sep 2020 09:06:43 +0200 Subject: [PATCH] support smaller timeframes --- docs/strategy-customization.md | 6 +++++- freqtrade/strategy/strategy_helper.py | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/strategy-customization.md b/docs/strategy-customization.md index 7396f2a89..a1de1044c 100644 --- a/docs/strategy-customization.md +++ b/docs/strategy-customization.md @@ -521,7 +521,7 @@ class SampleStrategy(IStrategy): # use ffill to have the 1d value available in every row throughout the day. # Without this, comparisons between columns of the original and the informative pair would only work once per day. # Full documentation of this method, see below - dataframe = merge_informative_pair(dataframe, informative_pairs, self.timeframe, inf_tf, ffill=True) + dataframe = merge_informative_pair(dataframe, informative, self.timeframe, inf_tf, ffill=True) # Calculate rsi of the original dataframe (5m timeframe) dataframe['rsi'] = ta.RSI(dataframe, timeperiod=14) @@ -601,6 +601,10 @@ All columns of the informative dataframe will be available on the returning data ``` +!!! Warning "Informative timeframe < timeframe" + Using informative timeframes smaller than the dataframe timeframe is not recommended with this method, as it will not use any of the additional information this would provide. + To use the more detailed information properly, more advanced methods should be applied (which are out of scope for freqtrade documentation, as it'll depend on the respective need). + *** ## Additional data (Wallets) diff --git a/freqtrade/strategy/strategy_helper.py b/freqtrade/strategy/strategy_helper.py index 1fbf618bd..1a5b2d0f8 100644 --- a/freqtrade/strategy/strategy_helper.py +++ b/freqtrade/strategy/strategy_helper.py @@ -26,7 +26,8 @@ def merge_informative_pair(dataframe: pd.DataFrame, informative: pd.DataFrame, """ minutes_inf = timeframe_to_minutes(timeframe_inf) - if timeframe == timeframe_inf: + minutes = timeframe_to_minutes(timeframe) + if minutes >= minutes_inf: # No need to forwardshift if the timeframes are identical informative['date_merge'] = informative["date"] else: