It’s possible to use freqtrade with multiple timeframes or timeframes that are not normally supported by the given exchange, say 6hr timeframes on Huobi.
We need to import a few functions and we need to install custom technical indicators.
from technical.util import resample_to_interval, resampled_merge
The idea is simple, freqtrade will construct the candles we want to use by using a smaller candle, so we always go from lower to higher, for example, from 1h to 6hr. We’ll need to create these on def populate_indicators function:
dataframe_6h = resample_to_interval(dataframe, 360) dataframe_6h['ema150']=ta.EMA(dataframe_6h, timeperiod=150)
We created a 6hr candle and the ema150 for it, its important to note that the ticker you use will be converted to 6hr, in this case, you’ll need to use anything below 6hr that is multiple of 6h and its provided by the exchange.
Now we need to merge it back into the dataframe, in the same function, we’ll add:
dataframe = resampeld_merge(dataframe, dataframe_6h, fill_na=True)
That’s it, now we have created a 6hr interval and have OHLC of the 6hr in the regular dataframe, along with the ema150. Below we’ll show an example of how to use it inside def populate_buy_trend:
dataframe.loc[ ( (dataframe['resample_360_ema150']>dataframe['resample_360_close']) & (dataframe['resample_360_ema150'].shift(1)<dataframe['resample_360_close']) ), 'buy'] = 1
In this case we want to buy when the price of current candle closes above ema150 of the 6hr candle AND close of last candle was below on the candle before last one (crossover from qtpylib can be used as well).