Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Filled vs. Quantity

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

    Filled vs. Quantity

    I am using the SampleOnOrderUpdate strategy as the basis for my work and am wondering about something. What is the difference between filled and quantity when used in a stop order. I've read the documentation but that just doesn't have much information. Specifically, I'm looking at something like this.

    stopOrder = ExitLongStop(0, true, execution.Order.Filled, execution.Order.AvgFillPrice - (StopLoss*TickSize), "StopLong", "Long");

    So again, what is the difference between filled and quantity.

    I hope the answer solves my problem and won't have to ask further questions about this.

    Thank you,
    Mike

    #2
    They should be roughly the same. You could use execution.Quantity that way you don't need to access the order object.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      I was afraid you were going to say that but i was hoping there was a subtle difference that would solve my problem...anyway, here's the situation.

      Enter a long position with 3 contracts, placing a stop for all 3 contracts. Also, place a target 1 and target 2 and leaving the 3rd contract as a runner. That all occurs ok. However, when target 1 and target 2 are hit, the stop quantity remains at 3 instead of decrementing from 3 to 2 and then 1. Do I need to change that quantity in code. I figured that it would change automatically.

      Thanks,
      Mike

      Comment


        #4
        If you are using a single order it will part fill 1, 2 and then fill 3. If you are trying to scale out you need to scale in first and use multiple exit orders to match multiple entry orders.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Thanks Josh, I'm using a single order to enter the market with 3 contracts. But unfortunately as each target is hit the stop order still has 3 contracts.

          Comment


            #6
            Right. This is why we say you need to scale-in to be able to scale-out. You are using 3 target orders correct? If so you need to scale-in respectively.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              i see said the blind man...thanks josh

              Comment


                #8
                I assume if I am using the following for 1 contract...

                entryOrder = EnterShort(1, "Short");

                Then I should use the following for 2 contracts when scaling in...

                entryOrder_1 = EnterShort(1, "Short_1");
                entryOrder_2 = EnterShort(1, "Short_2");

                Comment


                  #9
                  That is correct.
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    Thank you Josh

                    Comment


                      #11
                      multiple orders in wizard

                      Josh, I'm having a similar problem in the strategy wizard. I have entered multiple orders uneder set 1. ie, 3 long orders names "A" "B" "C" and then I did likewise in the stops and targets section. The strategy only puts one order in and exits one order , the very first one listed.
                      I'm sure it's something very simple but I can't find anythng in help.

                      gordon

                      Comment


                        #12
                        Gordon,

                        You need to increase EntriesPerDirection as you start running the strategy.
                        Josh P.NinjaTrader Customer Service

                        Comment


                          #13
                          Multiple entries

                          Thanks Josh, I knew it was simple.

                          Comment


                            #14
                            Hi NT Support,
                            All my strategy development I do from your "SampleOnOrderUpdate" template.
                            I think maybe there is a bug.
                            The line I'm referring to is:
                            Code:
                            stopOrder  = ExitLongStop(0, true, execution.Order.Filled, execution.Order.AvgFillPrice - 4 * TickSize, "MyStop", "MyEntry");
                            the same for profit.
                            The parameter I question about is: execution.Order.Filled.
                            Shouldn't it be Position.Quantity?
                            The scenario I refer to is: If I want to buy 2 contracts and have been partially filled with one.
                            The stop order will be executed also with one contract. Now I'm filled with the second contract (so now my position is 2), again the stop order will be executed with one contract, so stopOrder.Quantity == 1, but my entryOrder.Quantity==2.

                            Am I correct or not?

                            Regards,
                            Baruch

                            Comment


                              #15
                              Baruch,

                              execution.Order.Filled is the filled amount of the underlying IOrder object. When you are part filled with 1, the value will be 1. When you get completely filled with 2, it now becomes 2.

                              Position.Quantity would not necessarily work depending on when you are submitting the stopOrder. The IPosition object is the last thing to update. For example, when you are processing executions, the Position update for that execution is not done yet.
                              Josh P.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              647 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              368 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              108 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              571 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              573 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X