The period is what the indicators use as loo
Hi @backtrader ,
Thank you for your answer.
First of all, this is my understanding of timeframe and period:
timeframe is an attribute of the data feed; period is the "bar".
If the data's timeframe is 1 minute, then 1 period is 1 minute's data (OCHLV); if data's timeframe is 5 minutes, then 1 bar is 5 minutes' data.
I use bt.timeframe.Minutes all the time, so why bt.indicators.SMA(data, period=5) is not giving me the 5 minutes SMA value? I directly use the data, not a resampled one.
I guess to get SMA of 5 minutes, I have to use 5 minutes timeframe data, seems clearer to me now. Thank you.
And I used the Minutes data to resample to a 5 minutes timeframe using cerebro.resampledata(data, timeframe=bt.TimeFrame.Minutes, compression=5). Am I doing it right?
And you're right, I'm confused when it comes to MACD.
MACD=12-Period EMA − 26-Period EMA
So, if the data's timeframe is 5 minutes, we'll get EMA(12) and EMA(26) of 5 minutes' timeframe, after calculation, it's the 5m MACD value, is that right?
From the MACD equation, I see only period calculations, whether this period stands for 1 minute or 5 minutes, it's decided by the data's timeframe, which lead me to the conclusion that to get macd of 5m, the only way is to resample original 1m timeframe data to 5m timeframe data using compression=5. is that right?
I'm stuck here, and forgive me if my expression confuses you.
Thank you very much for your time.