For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

Optstrategy, preload and runonce relation



  • Hi,

    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 = True instead. It seems to me that preloading will take place as the indicators that will call _disable_runonce are added afterwards.

    Thanks

            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()
    

Log in to reply
 

});