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

NT 7 Unmanaged Orders - OCO Target/Stop not responding to change order request

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

    NT 7 Unmanaged Orders - OCO Target/Stop not responding to change order request

    I've noticed that as I build the OCO target/stop from within OnExecution (NT 7) upon receiving partial fills, sometimes the change order request I send to increase the size of the stop and target orders are ignored. (Most of the time this works flawlessly, but not always.)

    I looked into the trace file and found that the request is discarded:
    (contract total for the stop was 28, request to change to 32)

    2018-03-18 00:28:49:917 (Simulated Data Feed) Cbi.Globals.ProcessEventArgsInThreadContext.Discar dRetryChange: Order='fce76efd445d4a24ac63f80ddbaa68e8/Sim101' Name='SS1A-15-2-ShortAutoDynStpLimEntryLive' State=PendingChange Instrument='ES 12-17' Action=Buy Limit price=0 Stop price=2689 Quantity=32 Strategy='a_Strat_CADI_CCTI_SMEI_Abstract_Test01' Type=Stop Tif=Gtc Oco='3de80fa4a87e40098459065872a06c45' Filled=0 Fill price=0 Token='fce76efd445d4a24ac63f80ddbaa68e8' Gtd='2099-12-01 00:00:00'

    and we're back to 28 contracts:
    2018-03-18 00:28:49:917 (Simulated Data Feed) Cbi.OrderStatusEventArgs.Process: Order='fce76efd445d4a24ac63f80ddbaa68e8/Sim101' Name='SS1A-15-2-ShortAutoDynStpLimEntryLive' New state=PendingChange Instrument='ES 12-17' Action=Buy Limit price=0 Stop price=2689 Quantity=28 Type=Stop Filled=0 Fill price=0 Error=NoError Native error=''

    2018-03-18 00:28:50:526 (Simulated Data Feed) Cbi.Connection.ProcessEventArgs.OrderStatusEventAr gs: Order='fce76efd445d4a24ac63f80ddbaa68e8/Sim101' Name='SS1A-15-2-ShortAutoDynStpLimEntryLive' New state=Accepted Instrument='ES 12-17' Action=Buy Limit price=0 Stop price=2689 Quantity=28 Type=Stop Filled=0 Fill price=0 Error=NoError Native error=''

    2018-03-18 00:28:50:526 (Simulated Data Feed) Cbi.Order.Update1: oldid='fce76efd445d4a24ac63f80ddbaa68e8' Order='fce76efd445d4a24ac63f80ddbaa68e8/Sim101' Name='SS1A-15-2-ShortAutoDynStpLimEntryLive' New state=Accepted Instrument='ES 12-17' Action=Buy Limit price=0 Stop price=2689 Quantity=28 Type=Stop Filled=0 Fill price=0 Error=NoError Native error=''

    2018-03-18 00:28:50:526 (Simulated Data Feed) Cbi.OrderStatusEventArgs.Process: Order='fce76efd445d4a24ac63f80ddbaa68e8/Sim101' Name='SS1A-15-2-ShortAutoDynStpLimEntryLive' New state=Accepted Instrument='ES 12-17' Action=Buy Limit price=0 Stop price=2689 Quantity=28 Type=Stop Filled=0 Fill price=0 Error=NoError Native error=''

    My question is how do I catch this?? Why does this occur within NT? There is no error.

    All I know from my code is that a request was sent and I didn't receive an updated quantity for the order when OnOrderUpdate fires. You can see it stays at its previous value of 28.

    I don't really want to open the trace file via code to search for the order and find the DiscardRetryChange entry. This is a rough and not a very clean solution.

    Is there a way to read the same information contained in the trace file regarding the order requests? Cbi.Globals.ProcessEventArgsInThreadContext.Discar dRetryChange? If I could access this it would help.

    Is there a way to access the eventArgs that go along with the OnOrderUpdate event? I can't imagine these are null.

    Right now all I know is that a request was sent and we get nothing back to confirm or deny the action has occurred, and the OCO contracts do not match the entry. I could create a class with a list and a timer, record all of my requests internally and if an update doesn't show up through OnOrderUpdate in a reasonable time, resend the request, but it would be nice if I could check NT's various eventArgs or results of failed operations for clues as to what may have happened. This way I wouldn't be guessing and blindly resending the request.

    Since I can't see under the hood of NT, any guidance you can offer would be appreciated.

    Thanks.

    #2
    Hello multininja,

    I am able to see the PendingChange state with a quantity of 28 but I am not seeing the PendingChange for 32.

    Are you adding prints to your script in OnOrderUpdate or above the line that calls ChangeOrder()?

    How do you know the code is being reached, as I am not able to see this in the output?

    Below is a link to a post on using prints.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      I can send you the output window log if you have an email address. It's 356kB. I can make it smaller if it helps. TraceOrders == true, so you'll be able to see those as well.

      Comment


        #4
        Hello multininja,

        Can you share just the prints used and the output from the trace orders and prints from that order in question?

        The email for platform support is platformsupport [at] ninjatrader [dot] com.

        You can also send an email for support from the platform by clicking Help -> Email Support.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by alifarahani, Today, 09:40 AM
        3 responses
        15 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by RookieTrader, Today, 09:37 AM
        4 responses
        17 views
        0 likes
        Last Post RookieTrader  
        Started by PaulMohn, Today, 12:36 PM
        0 responses
        3 views
        0 likes
        Last Post PaulMohn  
        Started by love2code2trade, 04-17-2024, 01:45 PM
        4 responses
        39 views
        0 likes
        Last Post love2code2trade  
        Started by junkone, Today, 11:37 AM
        3 responses
        23 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X