When a position is entered, the strategy places a "protective" stop-limit exit order for the whole position.
At the same time it places a "profit target" limit exit order for part of the position.
The code employs IOrder objects and the ExitLongStopLimit, ExitShortStopLimit, ExitLongLimit, and ExitShortLimit methods.
The two orders have differing "Name" parameters, but the same "FromEntrySignal" parameter.
The code does not attempt to specify or modify OCO parameters.
If the "profit target" exit order fills, the strategy places another "profit target" exit limit order, using the same method and IOrder object, but a different limit price, quantity, and "Name" parameter.
These exit quantities remain less than the whole position until a certain number of exits have transpired, when it will exit the entire position.
If I use four profit targets and four exits (exit all on the last), a couple of things happen which I can't explain:
The second exit fill cancels the "protective stop" order, but the first and third exit fills do not. I can easily regenerate the cancelled order, but this inconsistency is unexplained and may be implicated in the second problem.
The first three exits work correctly, but the last exit order, placed for the entire remaining position, is processed by the platform with a different quantity than I specified. It is smaller by exactly the amount of the previous exit fill.
Have tried using a completely separate IOrder object and exit order "Name" parameter for the last exit, but the same thing happens.
I could work around this, but I can't nail down why these exits work inconsistently.
The 'OnOrderUpdate' method does not provide enough information.
Is there some detailed documentation somewhere regarding how the platform makes decisions about tying orders together with the "FromEntrySignal" parameter, as well as the rejecting, ignoring, canceling, and in this case, changing of orders ?
( using NT v7.0.0.20)

Comment