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 llanqui, Today, 03:53 AM
        0 responses
        1 view
        0 likes
        Last Post llanqui
        by llanqui
         
        Started by burtoninlondon, Today, 12:38 AM
        0 responses
        10 views
        0 likes
        Last Post burtoninlondon  
        Started by AaronKoRn, Yesterday, 09:49 PM
        0 responses
        14 views
        0 likes
        Last Post AaronKoRn  
        Started by carnitron, Yesterday, 08:42 PM
        0 responses
        11 views
        0 likes
        Last Post carnitron  
        Started by strategist007, Yesterday, 07:51 PM
        0 responses
        14 views
        0 likes
        Last Post strategist007  
        Working...
        X