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

partial fills

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

    partial fills

    I have a simple strategy.

    EnterLongStopMarket(0, true, qty, stopPrice, "myLongEntry")

    ExitLong(0, qty, "myLongExit", "myLongEntry") at a specific EoD time.

    managed code is much easier than unmanaged but how does managed code take care of partial fills?​

    does my code need to handle this ... protected override void OnOrderUpdate

    Code:
                    if  (order.OrderState == OrderState.PartFilled)
                    {
    
                    }
                    else if  (order.OrderState == OrderState.Filled)
                    {
    
                    }

    also will ExitLong cancel all positions & pending orders?

    also if there are none, can I still use it|?
    Last edited by fingers; 12-04-2023, 07:51 AM.

    #2
    Hello fingers,

    Thank you for your post.

    You can track partial fills in OnOrderUpdate() or OnExecutionUpdate(). Your stop or target will close the trade for the partially filled amount if either is hit before the entry order is completely filled.

    OnOrderUpdate() - https://ninjatrader.com/support/help...rderupdate.htm
    OnExecutionUpdate() - https://ninjatrader.com/support/help...tionupdate.htm


    ManagedRithmicIBFriendlyExample demonstrates how OnOrderUpdate and OnExecutionUpdate may be used to submit target/stop and this strategy also works well to handle partial fills.

    https://forum.ninjatrader.com/forum/...72#post1206372


    ExitLong() will not cancel all positions/pending orders. You can use CancelOrder() instead. Please see the example script below.

    https://ninjatrader.com/support/help...thod_to_ca.htm


    Please let us know if you have any other questions.
    Gaby V.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by DJ888, Today, 10:57 PM
    0 responses
    6 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by MacDad, 02-25-2024, 11:48 PM
    7 responses
    158 views
    0 likes
    Last Post loganjarosz123  
    Started by Belfortbucks, Today, 09:29 PM
    0 responses
    7 views
    0 likes
    Last Post Belfortbucks  
    Started by zstheorist, Today, 07:52 PM
    0 responses
    7 views
    0 likes
    Last Post zstheorist  
    Started by pmachiraju, 11-01-2023, 04:46 AM
    8 responses
    151 views
    0 likes
    Last Post rehmans
    by rehmans
     
    Working...
    X