Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
quantcn opened this issue Feb 17, 2021 · 0 comments

Comments

@quantcn
Copy link

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

@quantcn 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant