I am having some issues with the unmanaged orders. I am missing something.
Example:
My strategy sumbits a long order for let's say 100 contracts.
20 contracts get filled.
In onexecution I get a partfilled status and submit a stop loss and profit target order with 20 on each.
40 contracts get filled.
In onexecution I get a partfilled status and submit a stop loss and profit target order with 40 on each.
25 contracts get filled.
In onexecution I get a partfilled status and submit a stop loss and profit target order with 25 on each.
10 contracts get filled.
In onexecution I get a partfilled status and submit a stop loss and profit target order with 10 on each.
1 contracts get filled.
In onexecution I get a partfilled status and submit a stop loss and profit target order with 1 on each.
1 contracts get filled.
In onexecution I get a partfilled status and submit a stop loss and profit target order with 1 on each.
1 contracts get filled.
In onexecution I get a partfilled status and submit a stop loss and profit target order with 1 on each.
1 contracts get filled.
In onexecution I get a partfilled status and submit a stop loss and profit target order with 1 on each.
1 contracts get filled.
In onexecution I get a partfilled status and submit a stop loss and profit target order with 1 on each.
within onbarupdate:
My strategy hits certain measurments and I decide I want to move stop losses to break even so I run:
ChangeOrder(SomeStopLossOrder, Position.Quantity, 0, MyChangeToPrice);
It seems Position.Quantity varies, sometimes being 100 or anywhere in between.
What I think I am missing is that I need to create an array of iOrders, something like SomeStopLossOrder[5] so that when I am doing a ChangeOrder it would look like:
loop through count of SomeStopLossOrder
ChangeOrder(SomeStopLossOrder[i], Position.Quantity, 0, MyChangeToPrice);
If this is the correct method to attack this then I would also have to have something that tracks the quantity partially filled that is associated with each SomeStopLossOrder[i].
Am I understanding this correctly? There certainly aren't much in depth examples using the unmanaged approach.
Thanks


Comment