Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Partial Fills Unmanaged Approach

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

    Partial Fills Unmanaged Approach

    Hi,

    I am using the unmanaged approach and want to verify how to cancel the remainder of an entry order if a partial fill is received.

    I can have a situation where I have a partial fill then decide to exit the position prior to getting a full fill reported. I am managing my profit target and stop loss prices and position sizes.

    I want to make sure there aren't any gotcha's if I simply issue a CancelOrder referencing my IOrder variable. My intent is to only cancel the remaining portion of the original entry order leaving all other orders and more importantly any associated NinjaTrader internal variables intact.

    The actual logic to decide to cancel the remaining portion is quite complicated and I would rather verify I am coding this correctly prior to starting the code as opposed to just trying it and see what happens.

    I also plan to manage any fills that cross my cancel in the same fashion as I would under any other circumstances where I have an unexpected fill (unless for some technical reason that is not possible).

    Thanks in advance.

    Scott
    Last edited by ScottB; 09-10-2010, 12:07 PM.

    #2
    Hello,

    Thank you for your forum post and patience.

    We are looking into this and will respond shortly.

    Let me know if I can be of further assistance.

    Comment


      #3
      Hello,

      The response I originally posted was for another forum question. Sorry for confusion. We will respond shortly.

      Thank you for your patience.
      Last edited by NinjaTrader_Brett; 09-10-2010, 01:35 PM.

      Comment


        #4
        Originally posted by ScottB View Post
        Hi,

        I am using the unmanaged approach and want to verify how to cancel the remainder of an entry order if a partial fill is received.

        I can have a situation where I have a partial fill then decide to exit the position prior to getting a full fill reported. I am managing my profit target and stop loss prices and position sizes.

        I want to make sure there aren't any gotcha's if I simply issue a CancelOrder referencing my IOrder variable. My intent is to only cancel the remaining portion of the original entry order leaving all other orders and more importantly any associated NinjaTrader internal variables intact.

        The actual logic to decide to cancel the remaining portion is quite complicated and I would rather verify I am coding this correctly prior to starting the code as opposed to just trying it and see what happens.

        I also plan to manage any fills that cross my cancel in the same fashion as I would under any other circumstances where I have an unexpected fill (unless for some technical reason that is not possible).

        Thanks in advance.

        Scott
        every order is identified by an unique token number. you can easily compare that token number and cancel modify the order.

        you can take reference from this indicator of mine.

        Comment


          #5
          Actually, you should be very careful when using Token values in NT7 because Token values are not guaranteed to be unique as outlined here: http://www.ninjatrader.com/support/h...nt7/iorder.htm

          As the strategy transitions between historical to real-time the .Token value of the IOrder can change. Calling CancelOrder() on your entry's IOrder object directly will work, but what you need to be careful of are inflight executions. It is possible to call CancelOrder() and while that is processing, still receive additional partial fills for the order. Only until you receive cancel confirmation from the IOrder can you be certain that no more partial fills would be coming in. When an inflight partial fill comes in, all you have to do is add it to your own position size tracking variables, etc. and you should be good.
          Josh P.NinjaTrader Customer Service

          Comment


            #6
            Josh,

            Thank you very much, I felt pretty certain that was the case but wanted to double check. Yes, I understand the entire inflight execution issue as I am used to programming in native FIX with no framework handling that sort of thing.

            You guys do a great job answering questions in the forum; I appreciate the effort involved.

            Comment


              #7
              Originally posted by NinjaTrader_Josh View Post
              Actually, you should be very careful when using Token values in NT7 because Token values are not guaranteed to be unique as outlined here: http://www.ninjatrader.com/support/h...nt7/iorder.htm

              As the strategy transitions between historical to real-time the .Token value of the IOrder can change. Calling CancelOrder() on your entry's IOrder object directly will work, but what you need to be careful of are inflight executions. It is possible to call CancelOrder() and while that is processing, still receive additional partial fills for the order. Only until you receive cancel confirmation from the IOrder can you be certain that no more partial fills would be coming in. When an inflight partial fill comes in, all you have to do is add it to your own position size tracking variables, etc. and you should be good.
              Josh,
              If i remember correctly the help files mentioned Token Ids are unique when i build the indicator.

              in NT6.5 (version 15 which is currently installed in my PC) the help file says, and i quote,

              To check for equality check the <IOrder>.Token property which is a guaranteed unique identifier for an order
              seems there has been a change in NTs approach, and i must have missed the changes in the release notes.

              But things get a bit difficult without a unique id. your thoughts will be appreciated.

              regards..

              Comment


                #8
                bukkan,

                First, I want to thank you for your earlier advice and secondly to ask you for a little clarification. I use Velocity Futures (a great futures broker in all ways) and go through a Trading Technologies gateway. I have used WireShark to look at the messages being transmitted and in my case, they are FIX messages.

                Under FIX, it is the client's responsibility to keep up with orders from an identification perspective. You provide a unique identifier that you want to use and in this case the "you" would be NinjaTrader, so it could be anything of their choosing.

                In my experience the easiest way to handle this issue (and maybe the only) is to simply compare the objects (i.e. compare my IOrder variable to the one provided in the event). When in OnExecution, etc. this always works (to the best of my knowledge) and is very easy to code.

                You seem to be much more experienced with NinjaTrader than I am so I apologize if I have stated anything obvious or worse yet, given wrong information. However, I am curious if there is any issue with my approach.

                Scott

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by pkefal, 04-11-2024, 07:39 AM
                11 responses
                36 views
                0 likes
                Last Post jeronymite  
                Started by bill2023, Yesterday, 08:51 AM
                8 responses
                44 views
                0 likes
                Last Post bill2023  
                Started by yertle, Today, 08:38 AM
                6 responses
                25 views
                0 likes
                Last Post ryjoga
                by ryjoga
                 
                Started by algospoke, Yesterday, 06:40 PM
                2 responses
                24 views
                0 likes
                Last Post algospoke  
                Started by ghoul, Today, 06:02 PM
                3 responses
                16 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Working...
                X