Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to cancel all working orders at the end of the day

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

    How to cancel all working orders at the end of the day

    Hi, I have developed a strategy and now I have a problem: I want to make my strategy to close all working orders at the end of the day. I can put lines with <to time> but I didn't found any line with cancel all working orders if position is flat. Can somebody help?

    Thanks,

    #2
    serman, there's unfortunately no 'flatten all' NinjaScript command for working orders. What you can do is either manually click on File > Flatten Everything when you're day is done or track the used IOrder objects for the day and CancelOrder them at a specific time if still placed - http://www.ninjatrader-support.com/H...ncelOrder.html
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Bertrand View Post
      serman, there's unfortunately no 'flatten all' NinjaScript command for working orders.
      Hmmmm, why not? You have a button in chart trader that closes your position and cancels any orders...... Couldn't Ninja expose a method that will run that routine for us?

      Comment


        #4
        Because a strategy can only manage orders generated by itself. It should not and will not touch anything else the user is doing, whether that be from other strategies or manual orders.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Goldfly,

          I found this undocumented method. I tested it and it essentially gets you flat, stops your strategies, and cancels all orders that are working regardless of which strategy has them out there.




          I think it is the equivilent of the "Flatten Everything" menu command.

          You are on your own, NT will not support this. Try at your own risk.

          Please report your findings in the thread I am providing you.

          Thanks,


          Originally posted by goldfly View Post
          Hmmmm, why not? You have a button in chart trader that closes your position and cancels any orders...... Couldn't Ninja expose a method that will run that routine for us?

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by StockTrader88, 03-06-2021, 08:58 AM
          45 responses
          3,992 views
          3 likes
          Last Post johntraderuser2  
          Started by TAJTrades, Today, 09:46 AM
          0 responses
          7 views
          0 likes
          Last Post TAJTrades  
          Started by rhyminkevin, Yesterday, 04:58 PM
          5 responses
          62 views
          0 likes
          Last Post dp8282
          by dp8282
           
          Started by realblubb, Today, 09:28 AM
          0 responses
          8 views
          0 likes
          Last Post realblubb  
          Started by AaronKoRn, Yesterday, 09:49 PM
          1 response
          19 views
          0 likes
          Last Post Rikazkhan007  
          Working...
          X