You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, Author, thank you for your good work. I have a problem, please see below. I have two datas: 1minute and 5minute bar. But in he next, only a 5miniute bar completes, the next method of the strategy is triggered. I expect that when a 1minute bar completes, the next method should be triggered. Any idea?
The text was updated successfully, but these errors were encountered:
quantcn
changed the title
only a lagger bar completes, the next method of the strategy is triggered
only a larger bar completes, the next method of the strategy is triggered
Feb 17, 2021
Hi, Author, thank you for your good work. I have a problem, please see below. I have two datas: 1minute and 5minute bar. But in he next, only a 5miniute bar completes, the next method of the strategy is triggered. I expect that when a 1minute bar completes, the next method should be triggered. Any idea?
`cerebro = bt.Cerebro()
cerebro.addstrategy(SmaCross)
store = MTraderStore(debug=True)
broker = store.getbroker() # use_positions=True
cerebro.setbroker(broker)
start_date = datetime.now() - timedelta(minutes=52460)
start_date2 = datetime.now() - timedelta(minutes=52460)
data = store.getdata(dataname='EURUSD', timeframe=bt.TimeFrame.Minutes, compression=1, backfill = True,
fromdate=start_date , tz=pytz.timezone('Asia/Shanghai'))
data2 = store.getdata(dataname='EURUSD',timeframe=bt.TimeFrame.Minutes, compression=5, backfill = True,
fromdate=start_date2 , tz=pytz.timezone('Asia/Shanghai'))
cerebro.adddata(data, name='EURUSD')
cerebro.adddata(data2, name='EURUSD2')
cerebro.run(stdstats=False)`
The text was updated successfully, but these errors were encountered: