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 Petrv333, Today, 02:03 PM
      1 response
      9 views
      0 likes
      Last Post NInjaTrader_MaxH  
      Started by stafe, Today, 12:34 PM
      2 responses
      23 views
      0 likes
      Last Post stafe
      by stafe
       
      Started by asmmbillah, Today, 11:18 AM
      1 response
      19 views
      0 likes
      Last Post NinjaTrader_ChrisL  
      Started by nickse2003, Today, 09:56 AM
      1 response
      30 views
      0 likes
      Last Post NinjaTrader_ChristopherJ  
      Started by ATMtrader0001, Today, 10:08 AM
      5 responses
      40 views
      0 likes
      Last Post ATMtrader0001  
      Working...
      X