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

Strategy Auto-Disable on Stop Order doesn't exist

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

    Strategy Auto-Disable on Stop Order doesn't exist

    Hi NT -

    Is there a way to "disable" NT's auto strategy shut-off when the Strategy tries to ChangeOrder(...) on an Unmanaged order that was already "cancelled" at the broker?

    For example, if I have an OCO profit/stop pair -- and the stop order is being cancelled while my strategy is trying to adjust it. These conditions happen -- rarely -- but do happen when there's a 'race' condition or a sequence of events that happen very quickly.

    Or -- alternatively -- is there a way to "hook" into the auto-shut off and stop it from shutting down? I've developed my own order system using "unmanaged" -- and it handles its own state management, etc...

    Here's a screen cap of the sequence of checks on the status of an order object:



    in the "try/catch" exception handling part of the code, is there a way to "catch" the exception that NT throws so I can mitigate the Strategy from shutting off?


    - BigSurf

    (really, really dislike NT's auto shut off)
    Last edited by bigsurftrader; 07-11-2017, 12:02 PM. Reason: Added image

    #2
    Hello bigsurftrader,

    Thanks for opening the thread.

    You can use the RealtimeErrorHandling property to prevent your strategy from shutting down when an order rejection or other order error occurs.

    As NinjaTrader will not handle the errors and shut down your strategy, you will have to override OnOrderUpdate() to add in your own rejection handling.

    You can read more about using RealtimeErrorHandling and reference sample code in the documentation below.



    Please let me know if I can be of further help.
    JimNinjaTrader Customer Service

    Comment


      #3
      OMG!!!! That is MARVELOUS!!!!!!!!

      Yes, I already hook into OnOrderUpdate( )..and track all states including rejection and part-fills.

      This is wonderful news. I'll give it a try.

      BigSurf

      Comment


        #4
        disable strategy after failed attempts

        Is there any syntax which allows me to disable the strategy in case the coded error handling doesn't suffice?

        Im coding a loop with 10 iterations in OnOrder update to change the order price if rejected, as i'm assuming this could be because of a minimum stop requirement of my broker.
        Instead of hard coding these I want to set an iteration to change the stop order.

        However, if these changes to my initial order fail, I would the the strategy to disable itself like in the default error handling procedure.

        Comment


          #5
          Hello P-Sionic,

          Thanks for your question.

          A strategy can be disabled with the CloseStrategy() method. I will provide a link to our publicly available documentation below.

          CloseStrategy() - https://ninjatrader.com/support/help...sestrategy.htm

          Please let us know if we can be of further help.
          JimNinjaTrader Customer Service

          Comment


            #6
            Many thanks.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Christopher_R, Today, 12:29 AM
            0 responses
            9 views
            0 likes
            Last Post Christopher_R  
            Started by sidlercom80, 10-28-2023, 08:49 AM
            166 responses
            2,235 views
            0 likes
            Last Post sidlercom80  
            Started by thread, Yesterday, 11:58 PM
            0 responses
            3 views
            0 likes
            Last Post thread
            by thread
             
            Started by jclose, Yesterday, 09:37 PM
            0 responses
            8 views
            0 likes
            Last Post jclose
            by jclose
             
            Started by WeyldFalcon, 08-07-2020, 06:13 AM
            10 responses
            1,415 views
            0 likes
            Last Post Traderontheroad  
            Working...
            X