Great, this makes so much sense now! Thank you so much for your help!
Best posts made by Ron Aw
-
RE: Slicing fails upon inputting signal generation logic
-
RE: Position vs Order
@ab_trader Does Backtrader assume that the timeframe is "D" by default? If so, How do I set the timeframe to "H1"? The documentation on the
GenericCSVData()
did not mention the existence of a "timeframe" parameter.
Latest posts made by Ron Aw
-
RE: Position vs Order
@run-out Yes, it is correct and my backtest seems to be firing orders and entering positions correctly but I still have some confusion and am curious on how
compression
works despite me not using any form of resampling and the fact that my CSV file already containing "H1" candles. -
RE: Position vs Order
@vladisld Thank you. What's the interpretation of
compression
though? The documentation states: "Number of actual bars per bar. Informative. Only effective in Data Resampling/Replaying." but thing is, my CSV data is already in the form of H1 bars hence I'm unable to comprehend howcompression
works for my use case -
RE: Position vs Order
@run-out I see it now but since it goes by
TimeFrame.Minutes
, how does one configure it for "H1"? There doesn't seem to be an option to set it as something likeTimeFrame.Minutes60
-
RE: Position vs Order
@ab_trader Does Backtrader assume that the timeframe is "D" by default? If so, How do I set the timeframe to "H1"? The documentation on the
GenericCSVData()
did not mention the existence of a "timeframe" parameter. -
RE: Position vs Order
@ab_trader I don't think so. I'm using the
GenericCSVData()
feed. There doesn't seem to be a parameter for "timeframe". -
RE: Position vs Order
Correction* The structure within the
next()
method is:self.buy(data = self.datas[0], size = self.params.Size, price = self.datas[0].close[0]) self.buy(data = self.datas[1], size = self.params.Size), price = self.datas[1].close[0]) self.log("Creating Long Order")
-
RE: Position vs Order
I seem to be experiencing something else now. I'm using H1 candles and when I fire orders for my assets, the logs are telling me that my orders only get filled the next day. My
notify_orders()
method is as such:def notify_order(self, Order): if Order.status in [Order.Submitted, Order.Accepted]: return if Order.status in [Order.Completed]: if Order.isbuy(): self.log("BUY EXECUTED, {}".format(Order.executed.price)) elif Order.issell(): self.log("SELL EXECUTED, {}".format(Order.executed.price)) elif Order.status in [Order.Margin, Order.Canceled, Order.Rejected]: self.log("Order Canceled/Margin/Rejected")
Within my
next()
method, the structure is:self.buy(data = self.datas[0], size = self.params.Size, price = self.datas[0].close[0]) self.buy(data = self.datas[0], size = self.params.Size), price = self.datas[0].close[0]) self.log("Creating Long Order")
And in my logs, it frequently prints:
Date: 2019-01-22, Creating Long Order
Followed by:
Date: 2019-01-23, BUY EXECUTED, 118.56 Date: 2019-01-23, BUY EXECUTED, 219.25
Is this happening due to
cheat_on_close = False
? -
RE: Position vs Order
@run-out I see. I want to ensure that my strategy does not create new orders are when there are existing unfilled orders present and to be able to do that, my strategy has to be aware of the presence of existing unfilled orders. If what you've mentioned if the case, my questions are now:
-
Unfilled orders would have their status as Submitted/accepted and if the order's status is Completed, that means that the order has been filled right?
-
Is there a way to access the record of issued orders?
-