Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

ChangeOrder Quantity and Filled

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

    ChangeOrder Quantity and Filled

    Hello,

    I am wondering if the Quantity property of an Order is adjusted when the Order gets partial fills?

    For example, say I have an ExitLongStopMarket Order for 100 shares. So when the order is initially entered the Filled property = 0. Say 25 shares get filled. The Filled property is now 25. Is the value of the value of the Quantity property still 100 or does it get changed to 75?

    Thanks

    #2
    Hello tornadoatc,

    Thank you for your inquiry.

    The quantity amount of a specific IOrder object will remain at the quantity specified for the order.

    Here is a simple test you can do to check this:
    Code:
    private IOrder entryOrder;
    
    protected override void OnBarUpdate()
    {
         // entry logic ....
    }
    
    // called on an incoming execution (fill)
    protected override void OnExecution(IExecution execution)
    {
         if (execution.Order == entryOrder)
              Print(entryOrder.Quantity);
    }
    More information about OnExecution() can be found here: https://ninjatrader.com/support/help...nexecution.htm

    Please, let us know if we may be of further assistance.
    Zachary G.NinjaTrader Customer Service

    Comment


      #3
      Hello Zachary,

      So the question originated from thoughts around a scenario of how to handle a ChangeOrder for a Stop Order when there might be partial fills. Not something I can easily test...

      So again, if I have entered an order EnterLong(100) and only get filled on 25 and the EnterLong is still working.. Immediately after entering the EnterLong(100, "enterlong Signal Name") I also enter ExitLongStopMarket(stopPrice, "enterlong Signal Name") .. I understand that this order is monitoring the Filled property of the Entry Order ... So if only 25 of the 100 were filled the ExitLongStopMarket order would be working on 25.

      Then on next bar I want to change my ExitLongStopMarket order using ChangeOrder(stopOrder, aQuanity, 0, newStopPrice).

      Question 1: Why do I have to provide Quantity? The only thing I really want to change is the StopPrice. Providing the StopOrder and the newStopPrice should be sufficient. Can you provide an additional overload on ChangeOrder() that would be ChangeOrder(StopOrder, newStopPrice)?

      Question 2: If I have to provide a Quantity, what value should I provide? The amount Filled from entry order (Filled = 25 and entry order still working on 75 more shares) or amount of original Quantity of 100?

      Question 3: Do I enter a value of "0" for the LimitPrice parameter of ChangeOrder() as above ?

      These questions pertain to NT8.

      Thanks,
      Last edited by tornadoatc; 12-20-2015, 04:56 PM.

      Comment


        #4
        Hello tornadoatc,


        Question #1
        You have to specify the quantity because you are changing the order. If you wish to continue using the same order quantity, you could do so by using the original order quantity value.
        "Can you provide an additional overload on ChangeOrder() that would be ChangeOrder(StopOrder, newStopPrice)?"
        Simply enter the new stop price in the stopPrice parameter.


        Question #2
        The value of the Quantity property will be updated with each partial fill.


        Question #3
        You would use 0 for the limitPrice if this parameter is irrelevant for the OrderType being submitted.


        Here is the ChangeOrder() Help Guide to assist you further.
        Shawn B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by pechtri, 06-22-2023, 02:31 AM
        9 responses
        122 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by frankthearm, 04-18-2024, 09:08 AM
        16 responses
        65 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by habeebft, Today, 01:18 PM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by benmarkal, Today, 12:52 PM
        2 responses
        13 views
        0 likes
        Last Post benmarkal  
        Started by f.saeidi, Today, 01:38 PM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Working...
        X