Skip to content

only a larger bar completes, the next method of the strategy is triggered #6

Description

@quantcn

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions