Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

No Execution or Position update for a trade.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    No Execution or Position update for a trade.

    Hi Support,
    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

    #2
    Hi saltminer, thanks for your question.

    This is not expected, so there are no scenarios I could think of that would make this possible. For OnExecutionUpdate (OEU) and OnPositionUpdate (OPU) to be called, the order must be generated by the strategy, and not from an ATM or manual (Point and click) trading. Are you able to reproduce the problem on your end? Are the clients using Rithmic or Interactive Brokers as a data provider?

    I look forward to hearing from you.
    Chris L.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by bortz, 11-06-2023, 08:04 AM
    51 responses
    1,986 views
    0 likes
    Last Post aligator  
    Started by aligator, 01-06-2022, 12:14 PM
    2 responses
    227 views
    0 likes
    Last Post john_44573  
    Started by dmking, 11-12-2019, 12:31 PM
    4 responses
    4,143 views
    0 likes
    Last Post jasonw
    by jasonw
     
    Started by roblogic, Today, 04:31 PM
    0 responses
    10 views
    0 likes
    Last Post roblogic  
    Started by morrnel, 05-12-2024, 06:07 PM
    4 responses
    57 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Working...
    X