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

Closing Open Orders & and any filled Position

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

    Closing Open Orders & and any filled Position

    I am using OnOrderUpdate() method for confirmation of my EnterLongLimit() entry order, to submit my stop via ExitLongStop() and to submit my profit target via ExitLongLimit(). I've set the parameter liveUntilCancelled to true, so I don't have to resubmit orders on every bar update.

    If a condition arises that would dictate closing all open orders and any filled position (if it has already been entered). What is the preferred method to do this.

    Since I would want to close all open orders, and my entry position if it has been filled, would AtmStrategyClose() , using the entry order signal name be best? Or is some other way preferred.

    Thanks,
    Phineas

    #2
    Follow-Up: I think the following works, Could you let me know if there is a better way.

    I will first check on status of original entry order (filled or not). If not filled, I'll use CancelOrder(), and that is it.
    If it has already been filled, I should submit an ExitShort() or ExitLong to close original position, AND then use CancelOrder() on Stop loss and CancelOrder() on Profit Target.
    Thanks,
    Phineas

    Comment


      #3
      I would CancelOrder(myStopOrder), monitor this to make sure it comes back cancelled with a filled amount of zero, then modifying the limit order to a price (below market if a sell order for example) to get it to fill. This reduces any potential overfill on orders are you request cancellation.
      RayNinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by jaybedreamin, Today, 05:56 PM
      0 responses
      7 views
      0 likes
      Last Post jaybedreamin  
      Started by DJ888, 04-16-2024, 06:09 PM
      6 responses
      18 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by Jon17, Today, 04:33 PM
      0 responses
      1 view
      0 likes
      Last Post Jon17
      by Jon17
       
      Started by Javierw.ok, Today, 04:12 PM
      0 responses
      9 views
      0 likes
      Last Post Javierw.ok  
      Started by timmbbo, Today, 08:59 AM
      2 responses
      10 views
      0 likes
      Last Post bltdavid  
      Working...
      X