@DrHari Heya, excuse slow response. I only just noticed your reply for some reason. RE resources, any standard Python resources will be fine. So Datacamp I believe are good. Also Udacity offer free versions of their courses. Also edx.org are very good and coursera offer many courses. To be honest, prob doesn't matter which ones you do. They will all teach the basics, key thing is to complete a couple, just be consistent, code a bit everyday, even if you don't feel like it. Also start with some very simple BT examples, e.g. write the simplest code to load some data for eg 10 days of SPY, and buy at open and sell at close same day. Don't worry if you don't understand everything, just try and get something working. Play with this e.g. add Analyzers (like TradeAnalyzer to see number of trades, how many lost and won.. ) See if you can plot the output etc.. How are you getting on so far?
@ab_trader - I am doing my best. I have already submitted pull requests for new Fisher Transform indicator and Simulated Order. And I am sharing all my code snippets here along with explanations whenever relevant.
When I say the framework should have this or that, I dont mean that someone should implement them but that we shall implement it for everybody's benefit.
Cerebro doesn't know that you are looping and cannot know it. The runs inside the optimization re-use the file which has already been loaded, but the runs doesn't know that you had another set of runs before with the same file.
You could try to keep the data feed outside of the loop and execute a data.home() after the cerebro.run(...) is done to reset the pointer.
Completely untested and may absolutely not work.
The platform is not meant to deliver bid/ask prices. Those only make sense when you are working with ticks or else you have to implement a resampling model and decide whats theaskandbid` prices you return with higher timeframes.
See: Docs - Automating BackTesting
The notation is:
You provide module and kwargs, but neither a strategy nor an empty separator to simply load the 1st one available in the module.
@gindeleo thanks for your answer. I am not using Oanda data feed. I want to use an internal data feed that I have. Will try to understand the one implemented with Oanda (in the link I sent) and see if I can adapt for my case.
Yup, that's it. That did it. I thought the second "order" was to keep track of the order, not to create another one. Lesson learned! Thanks.
By the way, thanks creating backtrader, I am sure everyone in the community is very thankful for you guys' great work.
Ahh.. that makes total sense.. surprised I missed in the docs, I was looking in different places for e.g. 'get_strategy()'.. e.t.c.
Your quick replies are really appreciated and help with speedy development.
That's not resampling, that's replaying, because you replay your target until you get to the final target.
If you are using the live stream you have to:
resample to 1 minute
replay the resampled data to 5 minutes
See Docs - Data Replay
Something like this
data = oandastore.getdata(...)
data1 = cerebro.resampledata(data, timeframe=bt.TimeFrame.Minutes, compression=1)
data2 = cerebro.replaydata(data1, timeframe=bt.TimeFrame.Minutes, compression=5)
This of course adds automatically 2 data feeds to the system: the resampled and the replayed. Take it into account when addressing the data.
Note: probably never tried before.
@hexcrafter said in How to debug orders that are not executed:
What would be the best way to start debugging a problem like this?
Check all the states in notify_order. The order is probably not being accepted by the system.
The different states are listed in: Docs - Orders
What are some common causes?
Lack of cash.