Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ExitLongStop not executed!

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

    ExitLongStop not executed!

    Dear all,

    Can anyone help with my issue:

    An order "ExitLongStop" in historical chart never executed and it returns with state:"PendingSubmit" in the order object?

    ( Order='NT-00015/Sim101' Name='Sell' State=PendingSubmit Instrument='ES 12-08' Action=Sell Limit price=0 Stop price=981.47 Quantity=39 Strategy='MyTest' Type=Stop Tif=Gtc Oco='' Filled=0 Fill price=0 Token='698b5db16a0549219ddc3291f69e71d0' Gtd='01/12/2099 00:00:00' )

    Thanks
    Sam Mano

    #2
    Are you on the last bar in the set of historical data?
    RayNinjaTrader Customer Service

    Comment


      #3
      Hi Ray,

      This stop order is not at the last bar.

      Whe I flter these stop orders within OnOrderUpdate event handler:

      I get 5 event calls: with state: "PendingSubmit, Accepted, Working, PendingCancel, Cancelled".

      In my code I do not call cancel orders.

      I've 3 stops in this 60min 2 months charts - none were executed.

      Do I've to call ExitXxxxx() in the OnOrderUpdate event handler?

      Thanks

      Sam

      Comment


        #4
        Hi Sam,

        If you could post some code snippets it will help us evaluate the situation more. Thank you.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Simply check if not processed before with PartFilled, then place a ExitXxxxStopLimit in OnExecution:

          protectedoverridevoid OnExecution(IExecution execution)
          {
          if (execution.Order.OrderState == OrderState.Filled || execution.Order.OrderState == OrderState.PartFilled)
          {
          //...doing pre calc here...
          //double stopPrice =
          //double limitPrice =
          //
          if(execution.Order.Token == oLastEntry.Token && stopTokens.Exists(oLastEntry)==false)
          {
          if(Position.MarketPosition == MarketPosition.Long)
          {
          o1 = ExitLongStopLimit(Position.Quantity, limitPrice, stopPrice);
          }
          elseif(Position.MarketPosition == MarketPosition.Short)
          {
          o1 = ExitShortStopLimit(Position.Quantity, limitPrice, stopPrice);
          }

          stopTokens.Add(oLastEntry, o1);
          //...doing some other suff...
          }
          }
          }


          Hope this help, please let me know if you need more info...
          Thanks
          Sam

          Comment


            #6
            Even though you do not explicitly call "cancel order" the nature of your orders are cancelled when you do not resubmit them on every single OnBarUpdate(). To prevent this from happening please use the liveUntilCancelled parameter when you call your StopLimit orders.
            Josh P.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

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