support smaller timeframes

This commit is contained in:
Matthias 2020-09-07 09:06:43 +02:00
parent 71af64af94
commit 7852feab05
2 changed files with 7 additions and 2 deletions

View File

@ -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)

View File

@ -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: