Creating buy order with trailing stop and take profit. All in one
Hi, I have searched forum and found few relevant discussions. Specifically I have read
What I want do is following:
- Create a Buy order, let's say at price = 100, trailingstop = 10, takeprofit =20
I see there are new order types like StopTrail, but they are still separate orders?
Is there a way to create one order which has parameters to define buying price, trailiningstop and takeprofit (all in one) ?
If yes, please share code snippet, that would really help.
If not, how backtrader ties up a Buy order to another corresponding StopTrail order created for it?
Thanks for your answer. It works and allows to specify all in one. However, I noticed, if I am issuing a buy bracket order and skip mentioning the
limitprice parameter, it still submits a limit order with same price as the buy order.
I am sure this is the norm, which means if using bracket orders, we will always have 3 orders in action ?
What if I only want to place a buy order with a trailing stop. What's the most elegant way to achieve this in backtrader ?
Make sure to use the appropriate stop. In a volatile market, a
StopTrail(Market) can cost you a lot of money.