Sorry, I didn't have access to a computer at the time I was writing. Here is what I was trying to do. Assuming I was running the sample code given by backtrader front page:
from datetime import datetime
import backtrader as bt
params = (('pfast', 10), ('pslow', 30),)
sma1, sma2 = bt.ind.SMA(period=self.p.pfast), bt.ind.SMA(period=self.p.pslow)
self.signal_add(bt.SIGNAL_LONG, bt.ind.CrossOver(sma1, sma2))
cerebro = bt.Cerebro()
data = bt.feeds.YahooFinanceData(dataname='YHOO', fromdate=datetime(2011, 1, 1), todate=datetime(2012, 12, 31))
Now, assuming that I want to adjust various
pslow value using the optstrategy function.
When I replace
cerebro.optstrategy(SmaCross, pfast=(10,20,30), pslow=(60, 80, 100))
the code just keeps running for a long time without printing out anything. I'm just wondering if I'm missing something. Thanks.