Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ExitOnClose

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

    ExitOnClose

    I have a Long-Order for which I have created a stop loss order.

    Code:
    entryLongOrder = EnterLong(1, "entry1");
    SetStopLoss("entry1", CalculationMode.Price, stopLossPrice, false);
    The stop loss order was not executed. Now all outstanding orders are filled by ExitOnClose.

    My problem is:
    If an StopLoss-order is executed 'normal' then the name of the associated Long order are available in IExecution.Order.FromEntrySignal ("Entry1").

    But will the StopLoss triggered by ExitOnClose, IExecution.Order.FromEntrySignal is empty.

    How can i get the name of the associated Long order?

    Eddy

    #2
    Eddy, would you see the same then for Order.Name instead?

    Comment


      #3
      Order.Name contains "Exit on close", but not the name of the entry order.

      Comment


        #4
        You would unfortunately not be able to access the entry order name in this case, but knowing ExitOnClose triggered the order you would then know what to expect.

        Comment


          #5
          We are having the same issue using unmanaged orders. We have the orders in lists and need to cancel the oco orders associated with the entry order that was exited by Exit On Close.

          What is the most reliable way (one that won't break with new releases) to tell an exit was an Exit On Close order?

          Best Regards,
          Scott

          Comment


            #6
            Scott, for now you'll have to check whether or not order.Name is "Exit on close" to see if it is an exit on close order.

            OnExecution output:
            Code:
            Execution='NT-00000' Instrument='CL 08-11' Account='Backtest' Name='long entry' Exchange=Default Price=93.29 Quantity=1 Market position=Long Commission=0 Order='NT-00000' Time='6/20/2011 8:42:00 AM'
            Execution='NT-00001' Instrument='CL 08-11' Account='Backtest' Name='Exit on close' Exchange=Default Price=93.61 Quantity=1 Market position=Short Commission=0 Order='NT-00001' Time='6/20/2011 12:30:00 PM'
            AustinNinjaTrader Customer Service

            Comment


              #7
              Austin, thanks. Can I assume this won't "break" with future releases? If it might, please forward my suggestion that this is highlighted in the potential issues section of the release?

              The issue is this isn't something that happens very often and we might not notice it at first. Obviously we would rather not find out about it due to an unintended trade.

              Best Regards,
              Scott

              Comment


                #8
                Of course, Scott. I'll send it in right away and let you know the tracking number when I receive it.

                EDIT: The "of course" was for sending in the request. I can't personally guarantee it won't change in future releases.
                Last edited by NinjaTrader_Austin; 06-29-2011, 09:09 AM.
                AustinNinjaTrader Customer Service

                Comment


                  #9
                  But what can I do if I have 2 open orders. How can I recognize which was first closed?

                  Comment


                    #10
                    ejzj1, can you please clarify? If you have any open orders when the exit on close occurs, they will be canceled.
                    AustinNinjaTrader Customer Service

                    Comment


                      #11
                      Austin, are open orders are cancelled in addition to open positions closed?

                      Comment


                        #12
                        For example, i have to 2 open orders.

                        Code:
                        entryLongOrder1 = EnterLong(1, "entry1"); 
                        SetStopLoss("entry1", CalculationMode.Price, stopLossPrice1, false);
                        
                        entryLongOrder2 = EnterLong(1, "entry2"); SetStopLoss("entry2", CalculationMode.Price, stopLossPrice2, false);
                        How can i recognize, which one was closed first. Because, my strategy needs the close price from each order.

                        Or will they be closed in the order in which they were submitted ?

                        Comment


                          #13
                          ejzj1, they will be closed together at the same price.

                          ScottB, I just ran a test to make sure, and yes, it does close open orders.
                          Code:
                          Init()
                          {
                             ExitOnClose = true;
                             TraceOrders = true;
                          }
                          OBU()
                          {
                            if (CurrentBar == 100)
                             EnterLongLimit(0, true, 1, 0.12, "long entry");
                          }
                          
                          // exit on close is for session end, which is scheduled for 12am est, 10pm mountain (where we are).
                          Code:
                          6/26/2011 11:50:00 PM Entered internal PlaceOrder() method at 6/26/2011 11:50:00 PM: BarsInProgress=0 Action=Buy OrderType=Limit Quantity=1 LimitPrice=0.12 StopPrice=0 SignalName='long entry' FromEntrySignal=''
                          6/27/2011 10:00:00 PM Cancelled order due to end of session handling: BarsInProgress=0: Order='NT-00000/Backtest' Name='long entry' State=Working Instrument='CL 08-11' Action=Buy Limit price=0.12 Stop price=0 Quantity=1 Strategy='EoCOrderTest' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='2907574a03ea40bcb48aeb30bde31d9d' Gtd='12/1/2099 12:00:00 AM'
                          AustinNinjaTrader Customer Service

                          Comment


                            #14
                            Austin, thanks!

                            Comment


                              #15
                              Austin, thanks too.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              672 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              379 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              111 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              575 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              582 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X