Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

PartialFills and LimitOrder

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

    PartialFills and LimitOrder

    Hi,

    I have a question about PartialFills. I have some strategies which trades 3-5 contracts with market orders. Partial-Fill occurs, but everything seems to be fine.

    How often is the OnExecution-Method called? For every partial-fill?
    How often is the OnOrderUpdate-Method called? For every partial-fill?

    Does NTt cumulate the contracts and change the stop/target orders automatically?

    Now I have a range-system with Unmanaged-Approach. I want to trade form, outside to inside the range. For example for Short-Trades I use a LimitOrder with Submit-Order method. With 1 contract it works fine, but how could it work with 2 or more contracts?

    My OnExecution-Methods looks like this:

    Code:
    if    (execution.Order.OrderState == OrderState.Filled || execution.Order.OrderState == OrderState.PartFilled || 
                     (execution.Order.OrderState == OrderState.Cancelled && execution.Order.Filled > 0))
                { ....
    
    if (entryOrderShort != null && entryOrderShort == execution.Order)
    {
                        ....
                        
                        double entryPrice = entryOrderShort.AvgFillPrice;
                        
                        if (Position.MarketPosition == MarketPosition.Short)
                        {                            
    
                            stopLevel = entryPrice + stopLossTicks*TickSize;    
                            targetLevel = entryPrice - profitTargetTicks * TickSize;
                                    
                            stopOrder = SubmitOrder(0, OrderAction.BuyToCover, OrderType.Stop, entryOrderShort.Filled, 0, stopLevel, "OCO " +this.Name, "Initial-Stop");
                            targetOrder = SubmitOrder(0, OrderAction.BuyToCover, OrderType.Limit, entryOrderShort.Filled, targetLevel, 0, "OCO " +this.Name, "Profit-Target");
                        }
    }
    I set stop and profitTarget in OnExecution but yesterday with 2 contracts only target for 1 contract was set to the market. Is it possible that this relies on the Limit-Order?
    With Market in other strategies it seems to work well.

    How do I have to handle Partial-Fills in this case correctly? Do I need to use Market-Orders?

    Thx
    DT
    Last edited by DarthTraderson; 04-27-2011, 01:35 AM.

    #2
    DT, yes OnExecution and OnOrderUpdate are called multiple times if you receive partial fills - the orderstate would first be Partial filled state and then go finally to filled - you would see the IOrder .Filled amount be amended as executions are received.

    For the managed mode it would depend if you run by ByStrategyPosition or PerEntryExecution - http://www.ninjatrader.com/support/h...d_approach.htm

    In the unmanaged mode it would be whatever you coded it to be - you start sending out the exit bracket on a Partial Filled but would need to ensure the qty's resting are matching the needed ones the fully .Filled state is given.

    Comment


      #3
      Ok, thank you for clarification. But in which method should I correct the Order-Fill-Quantities? In OnOrderUpdate or OnExecution?

      Is it correct that in first Fill I have to submit a new Order and in further fills I have to only change this order?

      I read the Online-Help and my conclusion is, that the properties ByStragyPosition / ByEntry... only are relevant, when using SetStopLoss / SetProfitTarget. Is this correct?

      Do I care about my Limit-Order-Scenario with more than 4,5, .... contracts. That means, will the limit-sell Order in the example above be migrated to a market order, when price is touched and all contracts are going to be filled?

      Thx
      DT
      Last edited by DarthTraderson; 04-27-2011, 06:27 AM.

      Comment


        #4
        You would monitor for incoming fills in your OnExecution() - you can either call SubmitOrder() again using the same signal name so it would then update the resting order or you explicitly ChangeOrder() it for the new quantity.

        Correct, PerEntryExecution / ByStrategyPosition is used in the managed order submission approach which would include the Set() methods.

        I'm not following your last question - why should the limit order turn into a marketable one? Have you implemented logic to change it's price at a point to achieve this outcome?

        Thanks,

        Comment


          #5
          Ok, thank you. The limit issue is very special and is not regarding to this thread. Could we discuss it per email? Please send me a mail, where I can describe the issue in more detail.

          Comment


            #6
            Sure DT, you can reach me directly at support at ninjatrader dot com and then simply put to my Attn.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            666 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            377 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            110 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            575 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            580 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X