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

Handle partial fill methods

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

    Handle partial fill methods

    I am using EnterLong() or EnterLongLimit() to buy a stock with quantity = 100. If only 90 shares are filled (partial fill), I need to cancel the rest pending buy (10 shares) and at the same time, using ExitLongLimit() to sell these bought 90 share.

    myEntryOrder = EnterLongLimit(0, true, 100, myOrderPrice, "BUY 1001");
    ... CancelOrder(myEntryOrder);
    ExitLongLimit(0, true, 90, GetCurrentAsk(), "", "BUY 1001"); // this quantity = 90 is obtained from OnExecutionUpdate()


    A couple of questions:
    1) how to let my testing fill partially? I already tried this which is not working,Tools -> Options -> Trading -> Simulator -> Enforce partial fills


    2) Can the combination of CancelOrder() and ExitLongLimit() work here?
    Last edited by localappleseed; 09-16-2020, 10:01 AM.

    #2
    Hello, thanks for your post.

    Yes, if you call CancelOrder on a partially filled entry order the remainder of the order will be canceled.

    Please let me know if I can be of further assistance.

    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the answer.
      Could you please tell how I can enforce a partial fill in OnExecutionUpdate() or make OrderState.PartFilled true?

      Comment


        #4
        Hello, thanks for your reply.

        From the Control Center, go to Tools>Options>Trading>Enable "Enforce Partial Fills" That will cause partial fills to occur for testing on the Sim101 account. That can be useful for testing strategies that need to handle partial fills.

        Kind regards,
        -ChrisL
        Chris L.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by judysamnt7, 03-13-2023, 09:11 AM
        4 responses
        59 views
        0 likes
        Last Post DynamicTest  
        Started by ScottWalsh, Today, 06:52 PM
        4 responses
        36 views
        0 likes
        Last Post ScottWalsh  
        Started by olisav57, Today, 07:39 PM
        0 responses
        7 views
        0 likes
        Last Post olisav57  
        Started by trilliantrader, Today, 03:01 PM
        2 responses
        21 views
        0 likes
        Last Post helpwanted  
        Started by cre8able, Today, 07:24 PM
        0 responses
        10 views
        0 likes
        Last Post cre8able  
        Working...
        X