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

Sending multiple ChangeOrders in fast market without waiting for OrderState.Accepted

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

    Sending multiple ChangeOrders in fast market without waiting for OrderState.Accepted

    My client trades news events (i.e. trying to catch moves in an extremely fast moving market) by placing bracket orders on price seconds before the news release. I am using UnManaged order handling with orders on the brokers books on a strategy with a base time of 1 second and a secondary period at tick level. (strategy running on a fast machine with a low latency/near market server)

    Upon entering a position Im placing a trailing stop n ticks behind entry and want it to trail very quickly to capture as much of the initial radical swings as possible (sometimes 50-150 ticks in a second or two) To do so i'm issuing a stream of ChangeOrder() requests to trail my stops behind price as it quickly moves. I want to do this with as low a latency as possible and don't want to have to monitor OnOrderUpdate for a round trip OrderState.Accepted message before sending my next ChangeOrder.

    The question I have is can i issue back to back ChangeOrder requests to the broker without monitoring the brokers sending back the order status as Order.Accepted without Ninja kicking me out of the strategy holding an open position? My thinking is that since its 'UnManaged' NinjaTrader will happily send out the requests and the broker will either process them sequentially as they stack with other traders orders, or worst case ignore some requests that come in before my previous changeorders are processed.

    Are my assumptions correct in this? or do you foresee any Ninja gotchas i may be overlooking?

    I can test this in replay but replays instant acceptance of orders wont tell me what will happen in real life with several thousands of my clients dollars on the line.

    #2
    Hello,

    Thank you for the reply.

    based on the description, you could potentially run into overfills or other broker related order modification errors.

    By submitting many ChangeOrders or CancelOrder() requests without checking the state of the order, there can be in-flight executions, overfills or other errors depending on the broker being used.

    You can catch overfill errors in code to handle the situation better, there is more information regarding that here: http://ninjatrader.com/support/helpG...reoverfill.htm

    Additionally there is a small description on overfills and inflight executions here:


    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hi Jessie:

      My chief concern was to prevent Ninja from prematurely exiting the strategy leaving orphan open orders on the brokers books.

      Adding the parameters...

      IgnoreOverFill = true;
      RealtimeErrorHandling = RealtimeErrorHandling.TakeNoAction;

      ...to Initialize section should take care of that and I have OnExecution and OnOrderUpdate code to nullify the iOrder objects once filled/closed.

      Secondary concern is now...

      Broker receives one of my ChangeOrder commands to move the stop price, he moves it and trailstop/target is then hit leaving me flat in the market. Broker then receives another inflight ChangeOrder request (sent before strategy was aware of stop or OCO target being hit) for the closed OrderID to move the stop on the order that just closed. My assumption is that there would be no danger of an actual overfill condition (broker creating a new order based on my ChangeOrder on a now closed orderID) but instead broker would just send back an 'OrderRejected, no such order exists' message that i handle within the strategy.

      Is this in line with your thinking?

      Comment


        #4
        Hello,

        Yes in that case that would likely get a reject or a broker related error.

        For specifics on the brokers end and order fills, I would always suggest to contact that broker directly for further information as our support would not have that specific information available.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Aviram Y, Today, 05:29 AM
        0 responses
        2 views
        0 likes
        Last Post Aviram Y  
        Started by quantismo, 04-17-2024, 05:13 PM
        3 responses
        25 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by ScottWalsh, 04-16-2024, 04:29 PM
        7 responses
        34 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by cls71, Today, 04:45 AM
        0 responses
        6 views
        0 likes
        Last Post cls71
        by cls71
         
        Started by mjairg, 07-20-2023, 11:57 PM
        3 responses
        217 views
        1 like
        Last Post PaulMohn  
        Working...
        X