I am trying to sell at the open with a market order then close out my short with a market order at market close. If possible I would like to submit these orders the previous day (after 7:00pm EST). I am getting the ‘cannot open a long buy while a short order is open’. Is there a trigger that can be used for the buy order or a way to have both of them placed the night before?
Hey @Peck - I answered a similar question yesterday and will post my answer here as well:
Looks like you’re going to want to make use of Bracket Orders, which are defined in this doc: Understand Orders - Documentation | Alpaca
Without a bracket order, you would not be able to submit both entry and exit orders simultaneously since Alpaca’s system only accepts exit orders for existing positions. Additionally, even if you had an open position, you would not be able to submit two conditional closing orders since Alpaca’s system would view one of the two orders as exceeding the available position quantity. Bracket orders address both of these issues, as Alpaca’s system recognizes the entry and exit orders as a group and queues them for execution appropriately.
I was looking at the Bracket orders, Is it possible to use a market order, as a stop loss and take profit both require a limit?
This is the problem of Alpaca, they need to fix this soon, restriction is not good for api algo order to deal with, which is Alpaca is built for. Please fix it soon.