2019-10-02: The community is currently in read-only mode
Optstrategy, preload and runonce relation
momentum last edited by momentum
I wonder why when runonce is False, then the data are not preloaded in optimization. I also wonder what happens when someone is using
_nextforce = Trueinstead. It seems to me that preloading will take place as the indicators that will call _disable_runonce are added afterwards.
iterstrats = itertools.product(*self.strats) if not self._dooptimize or self.p.maxcpus == 1: # If no optimmization is wished ... or 1 core is to be used # let's skip process "spawning" for iterstrat in iterstrats: runstrat = self.runstrategies(iterstrat) self.runstrats.append(runstrat) if self._dooptimize: for cb in self.optcbs: cb(runstrat) # callback receives finished strategy else: if self.p.optdatas and self._dopreload and self._dorunonce: for data in self.datas: data.reset() if self._exactbars < 1: # datas can be full length data.extend(size=self.params.lookahead) data._start() if self._dopreload: data.preload() pool = multiprocessing.Pool(self.p.maxcpus or None) for r in pool.imap(self, iterstrats): self.runstrats.append(r) for cb in self.optcbs: cb(r) # callback receives finished strategy pool.close()