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 Waxavi, Today, 02:10 AM
      0 responses
      3 views
      0 likes
      Last Post Waxavi
      by Waxavi
       
      Started by TradeForge, Today, 02:09 AM
      0 responses
      7 views
      0 likes
      Last Post TradeForge  
      Started by Waxavi, Today, 02:00 AM
      0 responses
      2 views
      0 likes
      Last Post Waxavi
      by Waxavi
       
      Started by elirion, Today, 01:36 AM
      0 responses
      4 views
      0 likes
      Last Post elirion
      by elirion
       
      Started by gentlebenthebear, Today, 01:30 AM
      0 responses
      4 views
      0 likes
      Last Post gentlebenthebear  
      Working...
      X