For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
Stoploss not "working" on first day of trade
-
Re: Stoploss not "working" on first day of trade
I have the same problem as in the attached topic: I have a bracket order (buy and stoploss) and the "stoploss" is not executed on the same day as "buy" despite the fact that the lowest price is lower than the stoploss
-
the bracket orders:
buy_order = self.buy( data=self.datas[self.i], size=self.getsizing(self.datas[self.i]), exectype=bt.Order.Limit, price=price * buy_price_multiplier, transmit=False) self.stop_loss = self.sell( exectype=bt.Order.StopLimit, price=price * stop_price_multiplier, parent=buy_order, plimit=price*stop_limit_price_multiplier, size=self.getsizing(self.datas[self.i]), data=self.datas[self.i])
log:
2023-08-07, + BUY 19225 PTF @ 49.30 LIMIT ($934764) 2023-08-07, + STOP LOSS PTF @ 47.65 LIMIT 47.65 2023-08-08, Ticker: PTF Order Status: Submitted, Type: Buy, Execution Type: Limit 2023-08-08, Ticker: PTF Order Status: Submitted, Type: Sell, Execution Type: StopLimit 2023-08-08, Ticker: PTF Order Status: Accepted, Type: Buy, Execution Type: Limit 2023-08-08, Ticker: PTF Order Status: Accepted, Type: Sell, Execution Type: StopLimit 2023-08-08, Ticker: SPY Order Status: Completed, Type: Sell, Execution Type: Limit 2023-08-08, Ticker: PTF Order Status: Completed, Type: Buy, Execution Type: Limit 2023-08-08, BUY PTF EXECUTED at 48.37, cost 929957.63, com 65.10
prices of PTF on that day:
2023-08-08,48.369999,48.369999,47.480000,48.040001,48.040001,128800
-
@lampalork @ab_trader were you able to come up with some solution regarding this problem?
-
Jakub Jaśkowiec