Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unexplained Order changes and cancellation

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

    Unexplained Order changes and cancellation

    Having problems managing exit orders. Here's the situation :

    When a position is entered, the strategy places a "protective" stop-limit exit order for the whole position.
    At the same time it places a "profit target" limit exit order for part of the position.
    The code employs IOrder objects and the ExitLongStopLimit, ExitShortStopLimit, ExitLongLimit, and ExitShortLimit methods.
    The two orders have differing "Name" parameters, but the same "FromEntrySignal" parameter.
    The code does not attempt to specify or modify OCO parameters.
    If the "profit target" exit order fills, the strategy places another "profit target" exit limit order, using the same method and IOrder object, but a different limit price, quantity, and "Name" parameter.
    These exit quantities remain less than the whole position until a certain number of exits have transpired, when it will exit the entire position.

    If I use four profit targets and four exits (exit all on the last), a couple of things happen which I can't explain:
    The second exit fill cancels the "protective stop" order, but the first and third exit fills do not. I can easily regenerate the cancelled order, but this inconsistency is unexplained and may be implicated in the second problem.
    The first three exits work correctly, but the last exit order, placed for the entire remaining position, is processed by the platform with a different quantity than I specified. It is smaller by exactly the amount of the previous exit fill.

    Have tried using a completely separate IOrder object and exit order "Name" parameter for the last exit, but the same thing happens.
    I could work around this, but I can't nail down why these exits work inconsistently.
    The 'OnOrderUpdate' method does not provide enough information.

    Is there some detailed documentation somewhere regarding how the platform makes decisions about tying orders together with the "FromEntrySignal" parameter, as well as the rejecting, ignoring, canceling, and in this case, changing of orders ?

    ( using NT v7.0.0.20)

    #2
    Hello Shogun SunTzu,

    You should first upgrade your Ninjatrader 7 client, as we are now on release 22 of beta.

    When using a scaling strategy with different targets / stop losses, it's important to note the setting Stop and Target submission. You may want to set to PerEntryExecution.

    ByStrategyPosition- When this is selected, only one stop loss, trail stop and/or profit target order is submitted. As entry executions come in, the order size is amended. The downside of this approach is that if you have partial fills, the orders are re-inserted into the exchange order queue. The upside is that if you broker charges you a per order commission (not per lot), you will not incur additional commission expenses.

    PerEntryExecution - When this is selected, a stop loss, trail stop and/or profit target order is submitted for each partial fill received. The downside is if your broker charges commission per order, you can incur very expensive commission costs if you receive partial fills. The upside is that orders are submitted as soon as possible giving you the advantage of getting into the order queue immediately.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Ryan, is your suggestion that I ditch "advanced order handling" ? I would consider it if orders didn't expire every bar -- is there any way to use the managed approach and not have to renew ?

      Perhaps my description of my current problem was a bit involved. Basically I don't understand how the relationships of orders' ("advanced order handling") "FromEntrySignal" parameters to the the "SignalName" of other orders are being processed, especially in a multi-exit situation like this.

      Is there any detailed documentation of those issues, as well as OCO functionality, which may be related or also provide a solution ?
      Last edited by Shogun SunTzu; 10-11-2010, 10:26 AM.

      Comment


        #4
        You can submit orders that don't expire by using the liveUntilCanceled property. This is available with all the Enter and Exit statements.

        What is your setting for Stop and Target submission? It sound like you are using ByStrategyPosition but want PerEntryExecution.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          I am using the "liveUntilCancelled" property currently. Importantly, I'm currently not using the "SetProfitTarget", "SetStopLoss" and "SetTrailStop" methods. Instead, I'm placing simultaneous exit orders (eg: for a Long position, an "ExitLongStopLimit" order for a protective stop and "ExitLongLimit" for a profit target) upon coming into a position. I'm using event-driven "advanced order handling", as it's described in 'Help', to cancel or modify some orders as others fill, etc., albeit with the problems I've described.

          Looked into using those "Set..." methods instead of what I'm doing now, set to "PerEntryExecution" -- but that generates a separate exit order for each entry fill, for the quantity of the entry fill, right ? If that's true, I couldn't generate four exits from one entry fill, and couldn't dynamically control the quantity exited among those exit orders (they are hard-tied to their respective entry fill) ?

          Comment


            #6
            You should follow closely with this reference sample:
            Scaling out of a position

            In order to scale out of a strategy, you must use unique entry names for each scale out.

            I would verify proper scaling out with a simple implementation and then add complexity only when everything works the way you expect.

            If that's true, I couldn't generate four exits from one entry fill, and couldn't dynamically control the quantity exited among those exit orders (they are hard-tied to their respective entry fill) ?
            Correct. The exit quantity is tied to the entry signal name. You would need 4 entries and 4 exits if this is what you wanted. This is true for Set methods and Exit methods.
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              Unfortunately I'd like to exit at quantities determined dynamically following the entry, and although I can place multiple entry orders at one price as if it were a single entry, I'd have to decide the quantities before the entries are made.

              To achieve those dynamic exits, is the only alternative the "unmanaged" approach ?

              Comment


                #8
                Yes, with the managed approach all your exit quantities are tied to quantity of the entry signal. In order to submit dynamically you would have to move to the unmanaged approach:
                Ryan M.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                633 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                364 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                105 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                567 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                568 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X