Limit On Open (LOO) orders

Hi, Jay:



Good question, bad answer – there is no way to see via the UI (or the API for that matter) that a cancelsat is in force… until the signal actually gets canceled at the scheduled time.



I’ll definitely add this to the list of API improvements we need to make. For now, I think you just need to assume that if you request a cancelsat time, it will be respected by C2.

Hi, Jay:



Good question, bad answer – there is no way to see via the UI (or the API for that matter) that a cancelsat is in force… until the signal actually gets canceled at the scheduled time.



I’ll definitely add this to the list of API improvements we need to make. For now, I think you just need to assume that if you request a cancelsat time, it will be respected by C2.

Jay:



I am not sure you can do what you want to do as an all-in-one command. Is there a reason that you cannot do the following instead:



Issue an all-in-one order with a relative profit target and stop-loss (relative to the market open price, as you suggested in your post above) - Call this OCA Group A



Then create a market order to exit the position, parked until time T. (Call this Order C)



Then use the API command addtoocagroup (found here: http://www.collective2.com/content/automation.htm#addtoocagroup ) to add order C to oca group A?



Am I misunderstanding your question? If not, this seems like it would work.



Let me know.



Matthew

Thanks for the bump.



Each time I read one of your forum posts, asking how to use the API to do something, I exclaim to myself, "Surely there is a way to do what Jay wants to do!"



Then I sit down and think about for a few minutes, and I see that there isn’t. Not exactly, anyway.



There are really two possibilities (excluding the possibility that C2 massively adds to API functionality, which I can’t commit to at this moment).



1) Your software can be in charge of checking state via the data services API and acting accordingly. That is, your program can effectively run its own OCA management system, placing trades, polling for signal status, and canceling signals when required. Obviously this is not a particularly easy solution, but in theory it “solves” the problem (essentially by asking you to write software instead of me :slight_smile:



2) There may be a hacky solution which is an alternative. Before I suggest the hacky solution, let me re-state the problem:



The problem essentially boils down to that you want to attach a “let’s-get-out-of-this-position-at-market” closing order, to be released into the market at some time in the future, but only if the position is still open (and hasn’t been closed by your profit target or stop loss). You intend to use the &parkuntil parameter to tell C2 to hold this closing order until a specific time.



The reason, ultimately, for you forum posts is that you want to attach this market order as a member of a one-cancels-another group, which doesn’t seem possible. Your thinking is: I only want this order to get filled if the position is still open, and I don’t want it to fill the order if the position has already been closed; that’s why I need to make it part of an OCA group, along with the stop-loss and profit-target orders.



But, while I agree that using an OCA group would be ideal, I think (but am not sure, to be honest, and thus must ask you to volunteer to test this theory) there is an alternative. The alternative is to simply submit a market order to close the position in question, using parkuntil, as you propose – and not worry if the position still exists.



The way it will actually work (I think) is that, at the park-until time, the closing market order will be “released” by C2. However, if there is no position in the instrument you submit the closing order for, then the order will just be canceled by C2 (since it is a xTC order). It’s similar to the effect you want to achieve with OCA groups. The only catch is that if you submit more than one set of orders for the symbol in question, it’s possible to imagine a scenario where the very first parked-until closing order may close your second position opened for that symbol.



But then again, perhaps that is not even a possibility, given the way you intend to trade?



If this idea doesn’t work, I’m really at a loss, and we would have to schedule some time for API enhancements. Since that could take some time, I’d prefer to hear your reaction to the suggestion above. (Or let me know if I am still missing something.) And if you could give it a whirl and let me know if it works as I suggest, that would be most welcome.



- Matthew



I believe (but - again - some real world tests would be most useful!) that the stop/limit in the OCA group will expire when C2 sees there is no longer any position left to close.