Is this a valid way of analyzing multiple timeframes?
-
I am adding data, then resampling data to get multiple time frame trend analysis.. but it's the same data feed. Source code:
'''
df = csv_to_pandas(args.data, timeframe="1Min") cerebro_data = bt.feeds.PandasData(dataname=df) logging.info("Adding pandas dataframe to cerebro") cerebro.adddata(cerebro_data) logging.info("Adding resampled pandas dataframe for higher timeframe to cerebro") cerebro.resampledata(cerebro_data, timeframe=bt.TimeFrame.Minutes, compression=60) # 1 hour
'''
Is this correct? For some reason the resulting graph doesn't look right -
@Taewoo-Kim said in Is this a valid way of analyzing multiple timeframes?:
cerebro_data = bt.feeds.PandasData(dataname=df)
Missing
timeframe/compression
? The default istimeframe=bt.TimeFrame.Days
-
@backtrader I already resampled in pandas... is this "un-kosher"? Should I be letting backtrader doing this?
-
You can resample 1000 times in
pandas
if you wish, there is nothing against it. It will actually probably save you time (more if you save it to disk/database/something-else) and read it from there each time.But you are simply not telling the platform to what you actually resampled to and therefore the default settings
bt.TimeFrame.Days/1
are applied.