Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to capture orders execution Failure

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

    How to capture orders execution Failure

    Hello Everyone,

    Yesterday my script tried to execute an order, but got a error message back from the broker. Which is fine, the error was actually valid, but I just figured I need to capture this error and treat it.

    Question goes: how can I capture an order execution failure at the same moment I executed the order, I could always check position if flat on the next bar update, but I need a more real time control. Can that be captured on OnBarUpdate right after the execution command (Enterlong, entershort), like in a try catch? Or can I capture if the order was executed successfully on the event OnExecution?

    What would you guys recommend?

    thank you,

    Rodrigo

    #2
    Originally posted by rgaleote View Post
    Hello Everyone,

    Yesterday my script tried to execute an order, but got a error message back from the broker. Which is fine, the error was actually valid, but I just figured I need to capture this error and treat it.

    Question goes: how can I capture an order execution failure at the same moment I executed the order, I could always check position if flat on the next bar update, but I need a more real time control. Can that be captured on OnBarUpdate right after the execution command (Enterlong, entershort), like in a try catch? Or can I capture if the order was executed successfully on the event OnExecution?

    What would you guys recommend?

    thank you,

    Rodrigo
    OnOrderUpdate() records what happens to orders.

    Comment


      #3
      Hi rgaleote,

      Thank you for your post.

      Did the error cause the strategy to become disabled?
      If so, you may need to set the RealtimeErrorHandling to NoAction so that you can print the message from OnOrderUpdate().
      http://www.ninjatrader.com/support/h...orhandling.htm

      In OnOrderUpdate() you can print the information of the order.

      private override void OnOrderUpdate(IOrder order)
      {
      print(order.ToString());
      }
      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
      579 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      334 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
      554 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      551 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X