Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 The_Sec, Yesterday, 03:37 PM
      1 response
      11 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by vecnopus, Today, 06:15 AM
      0 responses
      1 view
      0 likes
      Last Post vecnopus  
      Started by Aviram Y, Today, 05:29 AM
      0 responses
      5 views
      0 likes
      Last Post Aviram Y  
      Started by quantismo, 04-17-2024, 05:13 PM
      3 responses
      27 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by ScottWalsh, 04-16-2024, 04:29 PM
      7 responses
      36 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Working...
      X