B_SendOrder will give you a regular order. (i.e. limit, market, or stop also)
The question is, weather Anvil is rejecting your order, or it is getting rejected further on in its travels.
Here is my experience:
- If Anvil rejects your order, you won't see it in your Anvil orders window. However, you will see an error message in the "position manager" window, and you also get a return code from B_SendOrder which is != SO_OK (sometimes it is SO_OK, but your order pointer will be NULL - that's an error too). You will also see the SO_.* error message in your log file just after the Level1 <Symbol> line and the print out of the current state of the box.
- If the order is rejected further down the chain, you do get a M_POOL_UPDATE_ORDER message for the reject. (you will also get a M_REQ_NEW_ORDER message before B_SendOrder returns. This will tell you the order has been created in Anvil) At this point isDead() should be true (provided all your shares have been rejected, I have seen the case where only some shares are rejected out of the total order size, and then your order is still [a]live.
I try not to hold onto the Order pointer returned, because I'm not sure that there is a guarantee/contract that this will be a valid pointer for the lifetime of the order (someone else may have experience with this though). If I need to find the order, I'll ask Anvil to re-find it via the B_ method. Most of the time I don't need it anyway, because the POOL_UPDATE_ORDER (and the other UPDATE messages) will give me a pointer to the order in question anyway.