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 rhyminkevin, Today, 04:58 PM
        0 responses
        2 views
        0 likes
        Last Post rhyminkevin  
        Started by lightsun47, Today, 03:51 PM
        0 responses
        5 views
        0 likes
        Last Post lightsun47  
        Started by 00nevest, Today, 02:27 PM
        1 response
        12 views
        0 likes
        Last Post 00nevest  
        Started by futtrader, 04-21-2024, 01:50 AM
        4 responses
        47 views
        0 likes
        Last Post futtrader  
        Started by Option Whisperer, Today, 09:55 AM
        1 response
        14 views
        0 likes
        Last Post bltdavid  
        Working...
        X