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

ExitLong while Pending

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

    ExitLong while Pending

    Suppose the order I placed using EnterLong has not yet submitted but in either one of the following states: Accepted/PendingCancel/PendingChange/PendingSubmitWorking.
    What happens if call the ExitLong method? Will it cancel the order or should I use the CancelOrder method? What is the best way to flat my position and to make sure there ae no more open/pending orders?

    Thanks

    #2
    Hello kiss987,

    Thank you for writing in. Please refrain from posting the same question in multiple threads. If you call ExitLong() and ExitShort() without a quantity or entry signal, it will render your entire position flat. Once your position is flat, open orders will be cancelled automatically.

    By default, unfilled orders will expire at the end of the bar unless live until cancelled is set to true. So if your strategy had a partially filled live until cancelled order and the rest of the order had not been cancelled for another reason, it would still exist to be potentially filled in the future until you call the CancelOrder() method or its Time in force is reached or until ExitLong() or ExitShort() had flattened your position.

    In this scenario it would be better practice to call CancelOrder() first to prevent the rest of the order from filling as you are flattening the position using ExitLong().

    For an example using the CancelOrder() strategy, please see here: http://ninjatrader.com/support/forum...ad.php?t=18890
    The CancelOrder() method is also in our help guide: http://ninjatrader.com/support/helpG...ancelorder.htm

    Please let me know if you have any questions.
    Michael M.NinjaTrader Quality Assurance

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by algospoke, 04-17-2024, 06:40 PM
    3 responses
    26 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by bmartz, 03-12-2024, 06:12 AM
    3 responses
    27 views
    0 likes
    Last Post NinjaTrader_Zachary  
    Started by Aviram Y, Today, 05:29 AM
    2 responses
    8 views
    0 likes
    Last Post Aviram Y  
    Started by gentlebenthebear, Today, 01:30 AM
    1 response
    8 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by cls71, Today, 04:45 AM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Working...
    X