I have something very strange. A client has sent me a trade where there seems to be no OnExecutionUpdate event nor a OnPositionUpdate event.
The code prints to the Output window each time these events occur, so this is easy to track.
Normally, orders are placed, and their order states update, and when they get filled there are Execution events and a Position update. I’ve bolded these in a log excerpt.
13-Jul-20 00:30:00 raw signal -1, position is Flat trades open = 0 inEntryWindow=True
13-Jul-20 00:30:00 at GoShort()
13-Jul-20 00:30:00 submitting Limit order to sell short at 2.922 into slot 0
Acc available Margin 651790.08, margin required 87382, unit=1, ratio=7, qty=7
13-Jul-20 00:30:00 Strategy 'MV HG SD/172610087': Entered internal SubmitOrderManaged() method at 13-Jul-20 00:30:00: BarsInProgress=1 Action=SellShort OrderType=Limit Quantity=7 LimitPrice=2.9220 StopPrice=0 SignalName='SE1' FromEntrySignal=''
OnOrderUpdate() SE1 Submitted : orderId='NT-00024-47' account='U3365545' name='SE1' orderState=Submitted instrument='HG 09-20' orderAction=SellShort orderType='Limit' limitPrice=2.922 stopPrice=0 quantity=7 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2020-07-13 00:30:00' gtd='2099-12-01' statementDate='2020-07-23'
OnOrderUpdate() SE1 Accepted : orderId='NT-00024-47' account='U3365545' name='SE1' orderState=Accepted instrument='HG 09-20' orderAction=SellShort orderType='Limit' limitPrice=2.922 stopPrice=0 quantity=7 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2020-07-13 00:30:00' gtd='2099-12-01' statementDate='2020-07-23'
OnOrderUpdate() SE1 Working : orderId='NT-00024-47' account='U3365545' name='SE1' orderState=Working instrument='HG 09-20' orderAction=SellShort orderType='Limit' limitPrice=2.922 stopPrice=0 quantity=7 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2020-07-13 00:30:00' gtd='2099-12-01' statementDate='2020-07-23'
OnOrderUpdate() SE1 Filled : orderId='NT-00024-47' account='U3365545' name='SE1' orderState=Filled instrument='HG 09-20' orderAction=SellShort orderType='Limit' limitPrice=2.922 stopPrice=0 quantity=7 tif=Gtc oco='' filled=7 averageFillPrice=2.922 onBehalfOf='' id=-1 time='2020-07-13 00:30:00' gtd='2099-12-01' statementDate='2020-07-23'
EXECUTION (Historical): execution='NT-00016-47' instrument='HG 09-20' account='U3365545' exchange=Default price=2.922 quantity=7 marketPosition=Short orderId='NT-00024-47' time='2020-07-13 00:52:00' sod=False statementDate='0001-01-01'
13-Jul-20 00:30:00 at OnPositionUpdate(), chart bar 268 of 639, state=Historical, position is Short
For the trade mentioned there are no execution events or Position updates, even though the order becomes filled.
This means the exit orders the strategy places have no position to correspond to (according to Ninja) and thus are ignored.
SI 09-20 75 Minute; raw signal 1, position is Flat trades open = 0 inEntryWindow=True
SI 09-20 75 Minute; 23-Jul-20 01:15:04 at GoLong()
SI 09-20 75 Minute; 23-Jul-20 01:15:00 submitting Limit order to buy at 23.185 into slot 0
SI 09-20 75 Minute; Acc available Margin 651840.09, margin required 134989, unit=1, ratio=4, qty=4
23-Jul-20 01:15:04 Strategy 'MV SI V5/172610104': Entered internal SubmitOrderManaged() method at 23-Jul-20 01:15:04: BarsInProgress=1 Action=Buy OrderType=Limit Quantity=4 LimitPrice=23.185 StopPrice=0 SignalName='LE1' FromEntrySignal=''
SI 09-20 75 Minute; 01:15:04.6410937 OnOrderUpdate() LE1 Submitted : orderId='c6068b173eda4d1d8a57922c2d0e4a59' account='U3365545' name='LE1' orderState=Submitted instrument='SI 09-20' orderAction=Buy orderType='Limit' limitPrice=23.185 stopPrice=0 quantity=4 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=16448 time='2020-07-23 01:15:04' gtd='2099-12-01' statementDate='2020-07-23'
SI 09-20 75 Minute; 01:15:04.7963671 OnOrderUpdate() LE1 Accepted : orderId='855157719' account='U3365545' name='LE1' orderState=Accepted instrument='SI 09-20' orderAction=Buy orderType='Limit' limitPrice=23.185 stopPrice=0 quantity=4 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=16448 time='2020-07-23 01:15:04' gtd='2099-12-01' statementDate='2020-07-23'
SI 09-20 75 Minute; 01:15:04.7963671 OnOrderUpdate() LE1 Working : orderId='855157719' account='U3365545' name='LE1' orderState=Working instrument='SI 09-20' orderAction=Buy orderType='Limit' limitPrice=23.185 stopPrice=0 quantity=4 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=16448 time='2020-07-23 01:15:04' gtd='2099-12-01' statementDate='2020-07-23'
SI 09-20 75 Minute; 01:15:04.9975390 OnOrderUpdate() LE1 Filled : orderId='855157719' account='U3365545' name='LE1' orderState=Filled instrument='SI 09-20' orderAction=Buy orderType='Limit' limitPrice=23.185 stopPrice=0 quantity=4 tif=Gtc oco='' filled=4 averageFillPrice=23.185 onBehalfOf='' id=16448 time='2020-07-23 01:15:04' gtd='2099-12-01' statementDate='2020-07-23'
SI 09-20 75 Minute; 01:15:04.9975390 pseudoExecution of LE1, 23.185, 23-Jul-20 01:15:04
SI 09-20 75 Minute; Fill Long at 23.185, calculating initial StopLoss 23.065 and final Profit Target 23.71, latest minute Close is 23.19 totalQty = 4
SI 09-20 75 Minute; Final Fill qty on LE1 = 4
23-Jul-20 01:15:04 Strategy 'MV SI V5/172610104': Entered internal SubmitOrderManaged() method at 23-Jul-20 01:15:04: BarsInProgress=1 Action=Sell OrderType=StopMarket Quantity=4 LimitPrice=0 StopPrice=23.065 SignalName='LS1' FromEntrySignal='LE1'
23-Jul-20 01:15:04 Strategy 'MV SI V5/172610104': Ignored SubmitOrderManaged() method at 23-Jul-20 01:15:04: BarsInProgress=1 Action=Sell OrderType=StopMarket Quantity=4 LimitPrice=0 StopPrice=23.065 SignalName='LS1' FromEntrySignal='LE1' Reason='This was an exit order but no position exists to exit'
23-Jul-20 01:15:04 Strategy 'MV SI V5/172610104': Entered internal SubmitOrderManaged() method at 23-Jul-20 01:15:04: BarsInProgress=1 Action=Sell OrderType=Limit Quantity=4 LimitPrice=23.710 StopPrice=0 SignalName='LT1' FromEntrySignal='LE1'
23-Jul-20 01:15:04 Strategy 'MV SI V5/172610104': Ignored SubmitOrderManaged() method at 23-Jul-20 01:15:04: BarsInProgress=1 Action=Sell OrderType=Limit Quantity=4 LimitPrice=23.710 StopPrice=0 SignalName='LT1' FromEntrySignal='LE1' Reason='This was an exit order but no position exists to exit'
The next thing in the log is many minutes later, so it isn't just a late arrival of those events.
I have NEVER seen this before. Under what circumstances could this possible happen?
Cheers,
saltminer
Comment