canceled immediately after it's submitted, even though I'm passing true for
'liveUntilCancelled'.
The 'Close' part of the order remained in the market and ultimately got filled,
but my position went to flat, rather than short in this case, since the second
order to sell was cancelled right after being generated.
Here's the code fragment that's executing in OnExecution() after my strategy
enters a long position --
protected override void OnExecution(IExecution execution)
{
/// ... details removed for clarity
if ( Position.MarketPosition == MarketPosition.Long ) {
EnterShortLimit(0, true, Qty, reverselimitPrice, "****Target");
}
}
Here's the related part of the trace log -- for some reason a cancel gets
generated on the reversing part of the order right after it's generated.
Can anyone explain this ???
--- The fill, position is long 1, which executes
EnterShortLimit(0, true, Qty, reverselimitPrice, "****Target");
in OnExecution() --
2008-12-09 09:33:02:828 (InteractiveBrokers)
Cbi.ExecutionEventArgs.Process:
Execution='0d63a406a75c412cad974cc557bec314' Instrument='YM 12-08'
Account='Sim101' Exchange=Default Price=8795 Quantity=1 Market
position=Long Operation=Insert Order='722f2187182448aca3396b6'
Time='12/9/2008 9:33:02 AM'
--- Close position order is generated ---
2008-12-09 09:33:02:937 (InteractiveBrokers)
Cbi.Connection.ProcessEventArgs.OrderStatusEventAr gs:
Order='bb5710da54ca4c1582c2d159d1f29786/Sim101'
Name='Close position' New State=Initialized Instrument='YM 12-08'
Action=Sell Limit price=8893 Stop price=0 Quantity=1 Type=Limit
Filled=0 Fill price=0 Error=NoError Native error=''
--- Short order is generated ---
2008-12-09 09:33:02:937 (InteractiveBrokers)
Cbi.Connection.ProcessEventArgs.OrderStatusEventAr gs:
Order='137a3263a7ab47e2b9ef614ca1f368c6/Sim101'
Name='****Target' New State=Initialized Instrument='YM 12-08'
Action=SellShort Limit price=8893 Stop price=0 Quantity=1
Type=Limit Filled=0 Fill price=0 Error=NoError Native error=''
--- What's causing this cancel to get generated ???? ---
2008-12-09 09:33:02:937 Strategy.StrategyBase.Process.ExecutionUpdateEvent Args:
cancel order: Order='3cda6f89a91b4e3e9947d1a259bf1757/Sim101'
Name='****Target' State=PendingSubmit Instrument='YM 12-08'
Action=SellShort Limit price=8893 Stop price=0 Quantity=1
Strategy='AutoTest' Type=Limit Tif=Day Oco='' Filled=0 Fill price=0
Token='**7' Gtd='12/1/2099 12:00:00 AM'
2008-12-09 09:33:02:937 (InteractiveBrokers)
Cbi.Order.QueueCancel: order queued, since it's in state 'PendingSubmit':
Order='3cda6f89a91b4e3e9947d1a259bf1757/Sim101'
Name='****Target' State=PendingSubmit Instrument='YM 12-08'
Action=SellShort Limit price=8893 Stop price=0 Quantity=1
Strategy='AutoTest' Type=Limit Tif=Day Oco='' Filled=0 Fill price=0
Token='***' Gtd='12/1/2099 12:00:00 AM'
--- Close position order working ---
2008-12-09 09:33:03:296 (InteractiveBrokers)
Cbi.OrderStatusEventArgs.Process: Order='ac08/Sim101' Name='Close position'
New State=Working Instrument='YM 12-08' Action=Sell Limit price=8893
Stop price=0 Quantity=1 Type=Limit Filled=0 Fill price=0 Error=NoError
Native error=''
--- Short order accepted ---
2008-12-09 09:33:03:296 (InteractiveBrokers)
Cbi.OrderStatusEventArgs.Process: Order='***/Sim101' Name='****Target'
New State=Accepted Instrument='YM 12-08' Action=SellShort
Limit price=8893 Stop price=0 Quantity=1 Type=Limit Filled=0
Fill price=0 Error=NoError Native error=''
--- Cancel on Short order sent ---
2008-12-09 09:33:03:296 (InteractiveBrokers)
Cbi.Globals.ProcessEventArgsInThreadContext.RetryC ancel:
Order='3cda6f89a91b4e3e9947d1a259bf1757/Sim101'
Name='****Target' State=Working Instrument='YM 12-08'
Action=SellShort Limit price=8893 Stop price=0 Quantity=1
Strategy='AutoTest' Type=Limit Tif=Day Oco='' Filled=0 Fill price=0
Token='3cda6f89a91b4e3e9947d1a259bf1757' Gtd='12/1/2099 12:00:00 AM'
2008-12-09 09:33:03:296 (InteractiveBrokers)
Cbi.Order.CancelNow: Order='3cda6f89a91b4e3e9947d1a259bf1757/Sim101'
Name='****Target' State=Working Instrument='YM 12-08'
Action=SellShort Limit price=8893 Stop price=0 Quantity=1
Strategy='AutoTest' Type=Limit Tif=Day Oco='' Filled=0 Fill price=0
Token='3cda6f89a91b4e3e9947d1a259bf1757' Gtd='12/1/2099 12:00:00 AM'
--- Short order canceled (position went to flat later instead of short)
when the Close order was filled ---
2008-12-09 09:33:03:609 (InteractiveBrokers)
Cbi.OrderStatusEventArgs.Process: Order='***/Sim101' Name='****Target'
New State=Cancelled Instrument='YM 12-08' Action=SellShort
Limit price=8893 Stop price=0 Quantity=1 Type=Limit Filled=0
Fill price=0 Error=NoError Native error=''

Comment