Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error in Stop Order

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

    Error in Stop Order

    Hello,

    These are my first steps managin order, so it is possible I am doing very bad

    After a successfull entry order I want to send a Stop order, This is my code (using unmanaged type):

    stopOrder=SubmitOrder(iOrderID++, OrderAction.Sell, OrderType.Stop, entryOrder.Filled, 0, entryOrder.AvgFillPrice-m_iTickStop*TickSize, "", "Stop Loss Order");

    But I am receiving this error with Sym101 account: **NT** Error on calling 'OnExecution' method for strategy 'MyCustomStrategy/ed1d09abeb1f4311a28508f919d7e16a': Índice fuera de los límites de la matriz.
    31/05/2012 13:11:09 CancelAllOrders: BarsInProgress=0

    Any idea?

    Thank you!

    #2
    Hello, guessing at the translation of the error in your local language, I feel you might be not checking for null references properly before accessing your IOrder and it's properties - http://www.ninjatrader.com/support/f...ead.php?t=4226

    Comment


      #3
      Hello,


      I am checking if null before used. Please find the complete code up to the Stop order:

      protectedoverridevoid OnExecution(IExecution execution)
      {
      if (entryOrder != null && entryOrder == execution.Order)
      if (execution.Order.OrderState == OrderState.Filled || execution.Order.OrderState == OrderState.PartFilled || (execution.Order.OrderState == OrderState.Cancelled && execution.Order.Filled > 0))
      if (entryOrder.OrderAction==OrderAction.Buy)
      stopOrder=SubmitOrder(iOrderID++, OrderAction.Sell, OrderType.Stop, entryOrder.Filled, 0, entryOrder.AvgFillPrice-m_iTickStop*TickSize, "", "Stop Loss Order");

      Regarding the error translation: “Index outside the boundaries of the matrix”

      Regards

      Comment


        #4
        Thanks, same issue if you submit to only one static BIP and not to your iOrderID++?

        Comment


          #5
          Now it works. Thank you. I misunderstood the meaning of that parameter.

          Regards

          Comment

          Latest Posts

          Collapse

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