Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

IOrder Question

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

    IOrder Question

    When OnExecution() runs, I'm curious about the Order property. Say that I saved my original IOrder object as myTrade and that my limit order was filled 3 separate times. When myTrade == execution.Order runs on the first trade, I believe that they will evaluate to true, correct?

    When the second order comes in, will myTrade == execution.Order still evaluate to true?

    The reason that I ask is that I'm running my orders as unmanaged. I need to figure out whether to add my partially filled limit orders piecemeal to my market position collection or to wait for the entire order to get filled before I start managing it.

    #2
    Hi texasnomad,

    OnExecution will be raised each time an order is Filled or PartFilled. If you are checking when myTrade == execution.Order, it can raise the event multiple times.

    There are properties you can access from each individual part filled execution as well as the complete order (depends whether you access execution.Order or just the Order directly), so you could take either approach.


    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Hi Ryan,

      Thanks for the quick reply. If I take the approach that myTrade is the entire IOrder returned for the limit, does myTrade == execution.Order for all 3 unique fills?

      Say myFills<IOrder> is a generic List storing my IOrder objects:
      myFills[0] = execution.Order on trade 1
      myFills[1] = execution.Order on trade 2
      myFills[2] = execution.Order on trade 3

      Is this all true?
      myFills[0] == myTrade
      myFills[1] == myTrade
      myFills[2] == myTrade

      Comment


        #4
        Also, it will help me to go through the evolution of a limit order into a market order.

        1) When I send a limit order, the IOrder object will have OrderType.Limit. When this trade fills, will the OrderType change to OrderType.Market?

        2) Which property of the IOrder helps me differentiate between an order that's a limit and one that's in the market? Which property would tell me that a limit order filled successfully and has also exited the market?

        Comment


          #5
          Unfortunately I can't comment much on your IOrders collection as this is more of a C# concept. My comments earlier were applicable if you receive multiple partial fills for the same order.

          You should know that each time your order is filled or part filled, it will raise the OnExecution event. If you are using an IOrders collection, then you probably will need to keep track of which item in the collection raised the event, as each item is unique.

          1) When I send a limit order, the IOrder object will have OrderType.Limit. When this trade fills, will the OrderType change to OrderType.Market?
          A limit order would not see its order type changed to market. The only place you would see this is with simulated stop orders, where a market order is sent once the price for the stop order has been reached.

          2) Which property of the IOrder helps me differentiate between an order that's a limit and one that's in the market? Which property would tell me that a limit order filled successfully and has also exited the market?
          You can access OrderState property to find out if an order is working, filled, etc. See this page for all potential OrderState values.
          Last edited by NinjaTrader_RyanM1; 11-08-2011, 03:25 PM.
          Ryan M.NinjaTrader Customer Service

          Comment


            #6
            If you get a partial fill on an IOrder, which property tells you how many units were filled and how many are outstanding?

            Comment


              #7
              Originally posted by texasnomad View Post
              If you get a partial fill on an IOrder, which property tells you how many units were filled and how many are outstanding?
              Position.Quantity tells you how many orders are open in the position. The difference between that and the order quantity is the quantity that has not yet been filled.

              Comment


                #8
                Thanks, Koganam. Yes, Position.Quantity is one way to get it.

                To see all properties you can expose from an execution event, try printing these two:

                protected override void OnExecution(IExecution execution)
                {
                Print(execution.Order.ToString());
                Print(execution.ToString());
                }
                Last edited by NinjaTrader_RyanM1; 11-08-2011, 03:24 PM.
                Ryan M.NinjaTrader Customer Service

                Comment


                  #9
                  That's a great tip. Thanks.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  683 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  386 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  111 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  584 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  585 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X