Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exit Orders won't submit for my second entry signal

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

    Exit Orders won't submit for my second entry signal

    Hi,

    I have a strategy that places two different entries. Both entries are submitted and filled ok. The first entry's exit orders are also submitted and filled fine. However, the exit orders for the second entry are not submitted for some reason. I can see NT evaluating the logic inside the brackets that contain the second entry's exit order. But nothing happens when NT gets to the following exit order code.

    Code:
    longProfitTargetOrder2 = ExitLongLimit(0, true, filled2, limitEntryAdd + (Target2 * TickSize),  "ProTgtLE2Exit"+instrument, "ProLE2"+instrument) ; //Set Profit Target 
    						
    							
    longStopOrder2 = ExitLongStopLimit(0, true, filled2, limitEntryAdd - (Stop2 * TickSize), limitEntryAdd - (Stop2 * TickSize), "ProStopLE2Exit"+instrument, "ProLE2"+instrument) ; //Set Stop Loss
    I'm pretty stumped as to what's going on here. Any help would be greatly appreciated.

    #2
    Hi maltese,

    Are there any errors generated in your log?

    I recommend that you add TraceOrders = true; to the Initialize() method in your script. This will show you if the orders are being rejected. The output from TraceOrders will go to the Ouput window.
    (Tools -> Output Window...)

    Below is a link to the help guide on TraceOrders.
    http://www.ninjatrader.com/support/h...raceorders.htm

    Are you seeing the orders as ignored in the output window?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by maltese View Post
      Hi,

      I have a strategy that places two different entries. Both entries are submitted and filled ok. The first entry's exit orders are also submitted and filled fine. However, the exit orders for the second entry are not submitted for some reason. I can see NT evaluating the logic inside the brackets that contain the second entry's exit order. But nothing happens when NT gets to the following exit order code.

      Code:
      longProfitTargetOrder2 = ExitLongLimit(0, true, filled2, limitEntryAdd + (Target2 * TickSize),  "ProTgtLE2Exit"+instrument, "ProLE2"+instrument) ; //Set Profit Target 
      						
      							
      longStopOrder2 = ExitLongStopLimit(0, true, filled2, limitEntryAdd - (Stop2 * TickSize), limitEntryAdd - (Stop2 * TickSize), "ProStopLE2Exit"+instrument, "ProLE2"+instrument) ; //Set Stop Loss
      I'm pretty stumped as to what's going on here. Any help would be greatly appreciated.
      I have added Trace Order to initialize and will monitor it.

      The exit orders do not even appear in the log which confirms that they are not being submitted.

      Comment


        #4
        fyi, I didn't have EntryHandling set to UniqueEntries, I think. I haven't verified it yet but I'm 95% certain that this is the problem.

        Comment


          #5
          Hello maltese,

          This is what I am expecting.

          Once we are able to see that there are orders being ignored, we will be able to see why they are being ignored.

          Likely its because you can only make 1 entry per direction. Changing to UniqueEntries will allow one order from each signal name with a unique signal name.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Well my hunch was flat wrong, lol.

            NT is still ignoring my orders. Here is some output from the trace

            Code:
            5/20/2014 1:42:47 PM Entered internal PlaceOrder() method at 5/20/2014 1:42:47 PM: BarsInProgress=0 Action=Sell OrderType=Limit Quantity=1 LimitPrice=1869.00 StopPrice=0 SignalName='ProTgtLE2ExitES 06-14' FromEntrySignal='ProLE2'
            
            5/20/2014 1:42:47 PM Ignored PlaceOrder() method at 5/20/2014 1:42:47 PM: Action=Sell OrderType=Limit Quantity=1 LimitPrice=1869.00 StopPrice=0 SignalName='ProTgtLE2ExitES 06-14' FromEntrySignal='ProLE2' Reason='SignalName does not have a matching FromEntrySignal to exit'
            
            5/20/2014 1:42:47 PM Entered internal PlaceOrder() method at 5/20/2014 1:42:47 PM: BarsInProgress=0 Action=Sell OrderType=StopLimit Quantity=1 LimitPrice=1863.25 StopPrice=1863.25 SignalName='ProStopLE2ExitES 06-14' FromEntrySignal='ProLE2'
            
            5/20/2014 1:42:47 PM Ignored PlaceOrder() method at 5/20/2014 1:42:47 PM: Action=Sell OrderType=StopLimit Quantity=1 LimitPrice=1863.25 StopPrice=1863.25 SignalName='ProStopLE2ExitES 06-14' FromEntrySignal='ProLE2' Reason='SignalName does not have a matching FromEntrySignal to exit'
            
            5/20/2014 1:45:04 PM Entered internal PlaceOrder() method at 5/20/2014 1:45:04 PM: BarsInProgress=0 Action=Buy OrderType=Limit Quantity=1 LimitPrice=1866.00 StopPrice=0 SignalName='ProLE1ES 06-14' FromEntrySignal=''
            
            5/20/2014 1:45:04 PM Entered internal PlaceOrder() method at 5/20/2014 1:45:04 PM: BarsInProgress=0 Action=Buy OrderType=Limit Quantity=1 LimitPrice=1864.00 StopPrice=0 SignalName='ProLE2' FromEntrySignal=''

            Comment


              #7
              Hi maltese,

              The ignore message you are getting is saying there is no entry order that has the signal name ProLE2.

              5/20/2014 1:42:47 PM Ignored PlaceOrder() method at 5/20/2014 1:42:47 PM: Action=Sell OrderType=Limit Quantity=1 LimitPrice=1869.00 StopPrice=0 SignalName='ProTgtLE2ExitES 06-14' FromEntrySignal='ProLE2' Reason='SignalName does not have a matching FromEntrySignal to exit'

              Are you certain that an order with this signal name has been placed?
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Originally posted by NinjaTrader_ChelseaB View Post
                Hi maltese,

                The ignore message you are getting is saying there is no entry order that has the signal name ProLE2.

                5/20/2014 1:42:47 PM Ignored PlaceOrder() method at 5/20/2014 1:42:47 PM: Action=Sell OrderType=Limit Quantity=1 LimitPrice=1869.00 StopPrice=0 SignalName='ProTgtLE2ExitES 06-14' FromEntrySignal='ProLE2' Reason='SignalName does not have a matching FromEntrySignal to exit'

                Are you certain that an order with this signal name has been placed?
                Yes, take a look at the above output. It's listed there in the output. However, I will also post the corresponding entry trace in a moment.

                SignalName='ProTgtLE2ExitES 06-14' FromEntrySignal='ProLE2'

                Comment


                  #9
                  Hello maltese,

                  Both of these messages are about the same order.

                  5/20/2014 1:42:47 PM Entered internal PlaceOrder() method at 5/20/2014 1:42:47 PM: BarsInProgress=0 Action=Sell OrderType=Limit Quantity=1 LimitPrice=1869.00 StopPrice=0 SignalName='ProTgtLE2ExitES 06-14' FromEntrySignal='ProLE2'

                  5/20/2014 1:42:47 PM Ignored PlaceOrder() method at 5/20/2014 1:42:47 PM: Action=Sell OrderType=Limit Quantity=1 LimitPrice=1869.00 StopPrice=0 SignalName='ProTgtLE2ExitES 06-14' FromEntrySignal='ProLE2' Reason='SignalName does not have a matching FromEntrySignal to exit'

                  These messages do not refer at all to an entry orders.

                  (You will see the order attempt to enter and if it is not able right after you will see the ignore).
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    Here is the output from the entry signal:

                    I do notice that FromEntrySignal is blank. I don't know why this would be happening considering that this is the output from the entry signal.

                    Code:
                    
                    5/20/2014 1:30:04 PM Entered internal PlaceOrder() method at 5/20/2014 1:30:04 PM: BarsInProgress=0 Action=Buy OrderType=Limit Quantity=1 LimitPrice=1866.00 StopPrice=0 SignalName='ProLE2' FromEntrySignal=''

                    Comment


                      #11
                      Hi maltese,

                      FromEntrySignals are only used for exit orders as they specify the order that you are exiting. This would not make sense for an entry order as the entry order is not trying to close any other order.

                      The order was not cancelled in between these prints was it? (May I have the entire output from the output window?)
                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #12
                        The entry order was filled and was not cancelled. Here is the output for this trade:

                        Code:
                        **NT** Enabling NinjaScript strategy 'NinLE1/a3b7e7dcfc944b6892b5969d9699fd16' : On starting a real-time strategy - StrategySync=WaitUntilFlat SyncAccountPosition=False EntryHandling=UniqueEntries EntriesPerDirection=2 StopTargetHandling=PerEntryExecution ErrorHandling=StopStrategyCancelOrdersClosePositions ExitOnClose=False Set order quantity by=Strategy ConnectionLossHandling=KeepRunning DisconnectDelaySeconds=10 CancelEntryOrdersOnDisable=False CancelExitOrdersOnDisable=True CalculateOnBarClose=True MaxRestarts=4 in 5 minutes
                        5/20/2014 1:30:04 PM Entered internal PlaceOrder() method at 5/20/2014 1:30:04 PM: BarsInProgress=0 Action=Buy OrderType=Limit Quantity=1 LimitPrice=1868.00 StopPrice=0 SignalName='ProLE1ES 06-14' FromEntrySignal=''
                        5/20/2014 1:30:04 PM Entered internal PlaceOrder() method at 5/20/2014 1:30:04 PM: BarsInProgress=0 Action=Buy OrderType=Limit Quantity=1 LimitPrice=1866.00 StopPrice=0 SignalName='ProLE2' FromEntrySignal=''
                        **NT** Enabling NinjaScript strategy 'NinLE1/7f1c22760e6a47f799ea0aaf01a3de90' : On starting a real-time strategy - StrategySync=WaitUntilFlat SyncAccountPosition=False EntryHandling=UniqueEntries EntriesPerDirection=2 StopTargetHandling=PerEntryExecution ErrorHandling=StopStrategyCancelOrdersClosePositions ExitOnClose=False Set order quantity by=Strategy ConnectionLossHandling=KeepRunning DisconnectDelaySeconds=10 CancelEntryOrdersOnDisable=False CancelExitOrdersOnDisable=True CalculateOnBarClose=True MaxRestarts=4 in 5 minutes
                        5/20/2014 1:39:14 PM Entered internal PlaceOrder() method at 5/20/2014 1:39:14 PM: BarsInProgress=0 Action=Sell OrderType=Limit Quantity=1 LimitPrice=1875.75 StopPrice=0 SignalName='ProTgtLE1ExitES 06-14' FromEntrySignal='ProLE1ES 06-14'
                        5/20/2014 1:39:14 PM Entered internal PlaceOrder() method at 5/20/2014 1:39:14 PM: BarsInProgress=0 Action=Sell OrderType=StopLimit Quantity=1 LimitPrice=1865.00 StopPrice=1865.00 SignalName='ProStopLE1ExitES 06-14' FromEntrySignal='ProLE1ES 06-14'
                        5/20/2014 1:40:25 PM CancelAllOrders: BarsInProgress=0
                        **NT** Disabling NinjaScript strategy 'NinLE1/a3b7e7dcfc944b6892b5969d9699fd16'
                        **NT** Enabling NinjaScript strategy 'NinLE1/a3b7e7dcfc944b6892b5969d9699fd16' : On starting a real-time strategy - StrategySync=WaitUntilFlat SyncAccountPosition=False EntryHandling=UniqueEntries EntriesPerDirection=2 StopTargetHandling=PerEntryExecution ErrorHandling=StopStrategyCancelOrdersClosePositions ExitOnClose=False Set order quantity by=Strategy ConnectionLossHandling=KeepRunning DisconnectDelaySeconds=10 CancelEntryOrdersOnDisable=False CancelExitOrdersOnDisable=True CalculateOnBarClose=True MaxRestarts=4 in 5 minutes
                        EVALUTING SEND POSITION 2 TARGETS FORES 06-14
                        longProfitTargetOrder2 VALUE ES 06-14 
                        longStopOrder2 VALUE ES 06-14 
                        filled2 ES 06-14 = 1
                        entryName2 ES 06-14 = ProLE2
                        5/20/2014 1:42:47 PM Entered internal PlaceOrder() method at 5/20/2014 1:42:47 PM: BarsInProgress=0 Action=Sell OrderType=Limit Quantity=1 LimitPrice=1869.00 StopPrice=0 SignalName='ProTgtLE2ExitES 06-14' FromEntrySignal='ProLE2'
                        5/20/2014 1:42:47 PM Ignored PlaceOrder() method at 5/20/2014 1:42:47 PM: Action=Sell OrderType=Limit Quantity=1 LimitPrice=1869.00 StopPrice=0 SignalName='ProTgtLE2ExitES 06-14' FromEntrySignal='ProLE2' Reason='SignalName does not have a matching FromEntrySignal to exit'
                        5/20/2014 1:42:47 PM Entered internal PlaceOrder() method at 5/20/2014 1:42:47 PM: BarsInProgress=0 Action=Sell OrderType=StopLimit Quantity=1 LimitPrice=1863.25 StopPrice=1863.25 SignalName='ProStopLE2ExitES 06-14' FromEntrySignal='ProLE2'
                        5/20/2014 1:42:47 PM Ignored PlaceOrder() method at 5/20/2014 1:42:47 PM: Action=Sell OrderType=StopLimit Quantity=1 LimitPrice=1863.25 StopPrice=1863.25 SignalName='ProStopLE2ExitES 06-14' FromEntrySignal='ProLE2' Reason='SignalName does not have a matching FromEntrySignal to exit'
                        5/20/2014 1:45:04 PM Entered internal PlaceOrder() method at 5/20/2014 1:45:04 PM: BarsInProgress=0 Action=Buy OrderType=Limit Quantity=1 LimitPrice=1866.00 StopPrice=0 SignalName='ProLE1ES 06-14' FromEntrySignal=''
                        5/20/2014 1:45:04 PM Entered internal PlaceOrder() method at 5/20/2014 1:45:04 PM: BarsInProgress=0 Action=Buy OrderType=Limit Quantity=1 LimitPrice=1864.00 StopPrice=0 SignalName='ProLE2' FromEntrySignal=''
                        5/20/2014 1:45:21 PM Entered internal PlaceOrder() method at 5/20/2014 1:45:21 PM: BarsInProgress=0 Action=Sell OrderType=Limit Quantity=1 LimitPrice=1873.75 StopPrice=0 SignalName='ProTgtLE1ExitES 06-14' FromEntrySignal='ProLE1ES 06-14'
                        5/20/2014 1:45:21 PM Entered internal PlaceOrder() method at 5/20/2014 1:45:21 PM: BarsInProgress=0 Action=Sell OrderType=StopLimit Quantity=1 LimitPrice=1863.00 StopPrice=1863.00 SignalName='ProStopLE1ExitES 06-14' FromEntrySignal='ProLE1ES 06-14'
                        **NT** Enabling NinjaScript strategy 'NinLE1/e3f8024e5b4543c99202054617269d00' : On starting a real-time strategy - StrategySync=WaitUntilFlat SyncAccountPosition=False EntryHandling=UniqueEntries EntriesPerDirection=2 StopTargetHandling=PerEntryExecution ErrorHandling=StopStrategyCancelOrdersClosePositions ExitOnClose=False Set order quantity by=Strategy ConnectionLossHandling=KeepRunning DisconnectDelaySeconds=10 CancelEntryOrdersOnDisable=False CancelExitOrdersOnDisable=True CalculateOnBarClose=True MaxRestarts=4 in 5 minutes
                        Cancelled custom managed order at 5/20/2014 1:46:01 PM: Order='0d0a534b0a9b4db0bfbcfdf881c79704/Sim102' Name='ProLE2' State=Working Instrument='ES 06-14' Action=Buy Limit price=1864 Stop price=0 Quantity=1 Strategy='NinLE1' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='0d0a534b0a9b4db0bfbcfdf881c79704' Gtd='12/1/2099 12:00:00 AM'
                        Time = 5/20/2014 1:45:00 PM
                        FINAL MFE EXIT
                        activeProLevel = 1
                        excursion = 1865.75
                        5/20/2014 1:46:01 PM Entered internal PlaceOrder() method at 5/20/2014 1:46:01 PM: BarsInProgress=0 Action=Sell OrderType=StopLimit Quantity=1 LimitPrice=1865.50 StopPrice=1865.50 SignalName='ProStopLE1ExitES 06-14' FromEntrySignal='ProLE1ES 06-14'
                        5/20/2014 1:46:01 PM Amended matching order: Action=Sell OrderType=StopLimit Quantity=1 LimitPrice=1865.50 StopPrice=1865.50 SignalName=ProStopLE1ExitES 06-14' FromEntrySignal='ProLE1ES 06-14'
                        5/20/2014 1:46:45 PM Cancelled pending exit order, since associated position is closed: Order='610551945c4e42dd9ed8b88d1163b301/Sim102' Name='ProTgtLE1ExitES 06-14' State=Working Instrument='ES 06-14' Action=Sell Limit price=1873.75 Stop price=0 Quantity=1 Strategy='NinLE1' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='610551945c4e42dd9ed8b88d1163b301' Gtd='12/1/2099 12:00:00 AM'
                        5/20/2014 1:49:38 PM Cancelled pending exit order, since associated position is closed: Order='cb585c3f616a416eb29460dac8f897d6/Sim103' Name='ProTgtLE1ExitES 06-14' State=Working Instrument='ES 06-14' Action=Sell Limit price=1875.75 Stop price=0 Quantity=1 Strategy='NinLE1' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='cb585c3f616a416eb29460dac8f897d6' Gtd='12/1/2099 12:00:00 AM'
                        5/20/2014 1:51:27 PM CancelAllOrders: BarsInProgress=0
                        **NT** Disabling NinjaScript strategy 'NinLE1/a3b7e7dcfc944b6892b5969d9699fd16'
                        5/20/2014 1:51:57 PM CancelAllOrders: BarsInProgress=0
                        **NT** Disabling NinjaScript strategy 'NinLE1/9876b885a75447e1842a32d502e54ec7'

                        Comment


                          #13
                          Hi maltese,

                          Here is what I am seeing in the output:

                          **NT** Enabling NinjaScript strategy 'NinLE1/a3b7e7dcfc944b6892b5969d9699fd16' : On starting a real-time strategy - StrategySync=WaitUntilFlat SyncAccountPosition=False EntryHandling=UniqueEntries EntriesPerDirection=2 StopTargetHandling=PerEntryExecution ErrorHandling=StopStrategyCancelOrdersClosePositio ns ExitOnClose=False Set order quantity by=Strategy ConnectionLossHandling=KeepRunning DisconnectDelaySeconds=10 CancelEntryOrdersOnDisable=False CancelExitOrdersOnDisable=True CalculateOnBarClose=True MaxRestarts=4 in 5 minutes
                          EVALUTING SEND POSITION 2 TARGETS FORES 06-14
                          longProfitTargetOrder2 VALUE ES 06-14
                          longStopOrder2 VALUE ES 06-14
                          filled2 ES 06-14 = 1
                          entryName2 ES 06-14 = ProLE2
                          5/20/2014 1:42:47 PM Entered internal PlaceOrder() method at 5/20/2014 1:42:47 PM: BarsInProgress=0 Action=Sell OrderType=Limit Quantity=1 LimitPrice=1869.00 StopPrice=0 SignalName='ProTgtLE2ExitES 06-14' FromEntrySignal='ProLE2'
                          5/20/2014 1:42:47 PM Ignored PlaceOrder() method at 5/20/2014 1:42:47 PM: Action=Sell OrderType=Limit Quantity=1 LimitPrice=1869.00 StopPrice=0 SignalName='ProTgtLE2ExitES 06-14' FromEntrySignal='ProLE2' Reason='SignalName does not have a matching FromEntrySignal to exit'
                          5/20/2014 1:42:47 PM Entered internal PlaceOrder() method at 5/20/2014 1:42:47 PM: BarsInProgress=0 Action=Sell OrderType=StopLimit Quantity=1 LimitPrice=1863.25 StopPrice=1863.25 SignalName='ProStopLE2ExitES 06-14' FromEntrySignal='ProLE2'
                          5/20/2014 1:42:47 PM Ignored PlaceOrder() method at 5/20/2014 1:42:47 PM: Action=Sell OrderType=StopLimit Quantity=1 LimitPrice=1863.25 StopPrice=1863.25 SignalName='ProStopLE2ExitES 06-14' FromEntrySignal='ProLE2' Reason='SignalName does not have a matching FromEntrySignal to exit'
                          The **NT** Enabling NinjaScript strategy is where the strategy starts. The first submitted order after this is the exit. Where is the entry?

                          Also, you mention the entry has filled, how has it filled if it has not been placed?

                          The entry order does have to fill before the exit order with a fromSignalName can be placed. (Its best to place the exit order in OnExecution when detecting the fill of the entry order).

                          No where else in the output am I seeing FromEntrySignal='ProLE2'.
                          Chelsea B.NinjaTrader Customer Service

                          Comment


                            #14
                            Originally posted by NinjaTrader_ChelseaB View Post
                            Hi maltese,

                            Here is what I am seeing in the output:



                            The **NT** Enabling NinjaScript strategy is where the strategy starts. The first submitted order after this is the exit. Where is the entry?

                            Also, you mention the entry has filled, how has it filled if it has not been placed?

                            The entry order does have to fill before the exit order with a fromSignalName can be placed. (Its best to place the exit order in OnExecution when detecting the fill of the entry order).

                            No where else in the output am I seeing FromEntrySignal='ProLE2'.

                            I've been operating in OnMarketData which might be the problem. I'll try OnExecution, if that doesn't work I'll have my programmer take a look at it. Thanks for all of your help.

                            Comment


                              #15
                              Hi maltese,

                              Just a heads up, OnMarketData() does not work in Historical.
                              Chelsea B.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              633 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              364 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              105 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              567 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              568 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X