Indicator on monthly data, trading on daily data
-
I am looking for advice with respect ot the following scenario:
I would like to compute an indicator, let's say SMA, on monthly data. The actual trading will take place at the first day of the month. I could use the monthly OHLC data for the strategy as well, however, I would like to use daily data in order to get a realistic analysis of daily returns/drawdowns etc.So, my question is how to tackle this problem? Should I use two different time series (daily and monthly)?
-
Cant you simply load daily candles and resample to monthly Timeframe.. trade can be done in daily timeframe while signal comes from monthly timeframe.
-
@rajanprabu I am not totally sure how to proceed from here.
Am I supposed to add the same data twice, first the regular daily data, and secondly the resampled monthly data?
cerebro.adddata(data) cerebro.resampledata( data, timeframe=bt.TimeFrame.Months, compression=1 )
Can I then access the data via
datas[0]
anddatas[1]
?Would it also be possible to resample the daily data in the strategy's init method when defining the indicator?
sma_monthly = bt.SimpleMovingAverage(self.data.close) # How to resample here?
-
simply use datas[1] for monthly sma.
sma_monthly = bt.SimpleMovingAverage(self.datas[1].close)