Let’s assume I’m using 1m timeframe and 5m informative timeframe. Before I start, the
timestamp that the exchanges gives are the open time of each candles. So if you have a candle with timestamp 00:00, that means that candle opens at 00:00 UTC. When it closes will depend on the timeframe used. Now I have this 1m candles’ data
And this is my 5m informative candles’ data
And this is how it would looks like in your dataframe after you merged them
Now, what if at 00:10 UTC, I want to know the average close value of the latest 3 candles? The correct way is to do it inside informative function, like this
@informative('5m') def populate_indicators_5m(self, dataframe: DataFrame, metadata: dict) -> DataFrame: dataframe['avg_close_3'] = dataframe['close'].rolling(3).mean() return dataframe
It will correctly use data from table 2 above, which will give you the latest value avg_close_3_5m of 4. But if you do the calculation inside any main populate functions, for example inside populate_indicators like this
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: dataframe['avg_close_3_5m'] = dataframe['close_5m'].rolling(3).mean() return dataframe
It would use data from table 3, which means the avg_close_3_5m value calculated would be 4.666667, which is wrong.
That’s why, if you want to any calculation using informative data, it’s better to do it inside the each respective informative functions. Hopefully this article helps.