I am a Backtrader noob, so forgive me if this is dumb question.
It is my understanding that a Strategy won't actually start trading until all of its indicators periods have elapsed.
For a simple example say I have a 252 day sma. My question is, if I set the start date to1/1/2015, will no trades actually occur until and after approximately 1/1/2016? If this is the case, is there a way to "warmup" the indicators, so they are ready to go at the specified start date, and not have the waiting period? Say start calculating them on 1/1/2014, or something to that effect?
run-out last edited by
@calebsandfort Sure just input earlier data, and then in your
nextcheck the date before starting to trade. So for example, you would start your data 2015,1,1 and then in your strategy:
def __init__(self): self.trade_start = datetime.datetime(2016, 1, 1, 0, 0) def next(self): dt = self.data.datetime.datetime() if dt < self.trade_start: return
Or enter trade_start as a parameter.