So, this may be a feature and expected (ChangePending order state).
Heres the scenario:
1. Enter a long trade with 100 contracts
2. Price in profit
3. Call ExitLong(70)
4. Straight after without waiting for the exit order to fill, call ExitLong(30).
5. The first ExitLong(70) will be cancelled and only the ExitLong(30) will be filled.
Therefore the existing order is overridden if it is in a working state and a new one is submitted.
Simple test I wrote is:
bool canExit = true;
protected override void OnBarUpdate ()
{
if (Time[0].Day == 24 && Time[0].Hour == 14 && Time[0].Minute == 45)
{
if(Position.MarketPosition == MarketPosition.Flat)
{
EnterLong(100);
}
}
if (canExit == true&& Time[0].Day == 24 && Time[0].Hour == 15 && Time[0].Minute == 00)
{
ExitLong(30);
ExitLong(70);
canExit= false;
}
}
I believe, by looking at the order traces, the second ExitLong puts the order state into: ChangePending?.
Is there any way to fulfil the first order and the subsequent orders and never cancel/ change?
Thanks,
Tarik

Comment