Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

URGENT: Damaging NT6.5 Strategy Termination

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

    URGENT: Damaging NT6.5 Strategy Termination

    Hi,

    When an engine malfunction occurs during a flight, the FMS (Flight Management System) aboard the Boeing 767 or Discovery, doesn't shutdown all engines and systems. But instead it deals with it, allowing the aircraft to continue on its current flight path and altitude.

    More importantly, the pilots/astronauts decide on whether to continue the flight or look for a safe landing site and send a May Day signal (such as "Huston we have a problem").

    All mission critical systems ( and Trading platforms are critical to us) have to deal with exceptional conditions.

    1. An order rejection is an exception (exceptional condition) but not a reason to terminate the process (Strategy). Leaving me with an open position, while before the 'faulty' order, I had a perfectly healthy Stop order.

    2. Handling an exception should be finding a safe landing (not crash). A safe landing in this context is to continue. Although the current Stop loss might not be ideal, but it is MUCH better than a killed strategy which left a completely naked order.
    If FMS were implemented this way, aircrafts would be falling from the sky every minute.

    3. Countless times when this occurred, there was a valid Stop Loss/Trailing Stop in place.
    One faulty order, bang, I find myself in a very, very bad position.
    Ignoring the exception would have been (am not suggesting this, but would prefer as it is less damaging than the implemented 'non-solution') less painful.

    4. Would you, pretty please, provide me with a solution (be it temporary), to deal with this damaging (hard cash wise) situation more efficiently.

    One thing that keeps me here, is that you do try and solve your customer's problems. I and most of us do appreciate that. And we also know that even the FMS on Discovery isn't perfect, but it preserves the lives of the astronauts and passengers.

    Cheers,
    Obi

    #2
    Obi, thanks for your detailed post - to debug your order behavior the TraceOrders feature is immensely helpful - http://www.ninjatrader-support2.com/...ead.php?t=3627

    Also, the conservative way NinjaTrader works by default with is to terminate your strategy when the needed orders cannot be placed as expected (for example rejected at your broker), if you want to step outside of this and program your own order rejection handling you can take a look at this - http://www.ninjatrader-support.com/H...rHandling.html
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Hi NT_Bertrand,

      Thank you for your prompt reply and support.

      Few questions on the "RealtimeErrorHandling" properties:

      - RealtimeErrorHandling.TakeNoAction
      - RealtimeErrorHandling.StopStrategyCancelOrdersClos ePositions

      Q1. Do we have to set the property:
      ' RealtimeErrorHandling.TakeNoAction ' in the 'Initialize()' (as shown in the doc), in addition to coding the 'OnOrderUpdate()' or is it optional?

      Q2. The 'OnOrderUpdate()' code shown in the doc, assumes that there is an Order object obtained via the 'ExitLongStop()' method (and the likes).
      What about the case where one uses the 'SetStopLoss()' method where no Order object is created?

      Maybe the 'SetStopLoss()' method should return an Order object to provide a consistent interface?

      Q3. The second property (which is the default) clearly stops the strategy, cancel orders and close all positions.

      Shouldn't you have more additional options like:
      - RealtimeErrorHandling.CancelOrders
      - RealtimeErrorHandling.ClosePositions

      This way the user can choose to either just 'Cancel the orders' or 'Close positions'. We are adult, I think you can trust us to be responsible and make a choice that is suitable to our needs.

      As things stands, we just have two unacceptable extremes (takeNoAction and the CancelAll etc.).

      Cheers,
      Obi

      Comment


        #4
        1. You have to set that setting in Initialize() if you wish for the error handling to be disabled. When disabled, please be sure you program your own error handling for every single case.

        2. You can still print OnOrderUpdate() events and check them by order names. If you are going to turn off error handling I do highly recommend you not use Set() and instead move to IOrders though. With IOrders you will have the information you need to handle error cases.

        3. No other options are provided. You can either use the default, or you can disable it and completely program your own handling.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Hi Josh,

          Thanks.

          Item 1. I will do and see how it behaves.

          Item 2. Here I have problems. The "SetStopLoss()" method does all the cancellations and placing of new trailing stop orders for me. It's bril; I love that and am used to it.

          I don't know how to use the IOrders to constantly adjust the trailing stops when the market is moving in my direction. Do you have any example or could you point me to one?

          Item 3. This is a suggestion. Giving the user more options to choose from in this context is the best solution and would not require lots of development work. You just have to split the "StopStrategyCancelOrdersClosePositions' into "StopStrategy", "CancelOrders", "ClosePositions'

          Cheers,
          Obi

          Comment


            #6
            Thanks for the suggestions Obi, I will forward it to development for consideration.

            For working with IOrder objects, you could check into this sample -

            The OnOrderUpdate() and OnExecution() methods are reserved for experienced programmers. Instead of using Set() methods to submit stop-loss and profit target orders, you can submit and update them manually through the use of IOrder and IExecution objects in the OnOrderUpdate() and OnExecution() methods. The OnOrderUpdate()
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Thanks Bertrand,

              Will look into this now.

              Tschuss,
              Obi

              Comment


                #8
                Could you please clarify this statement?

                "An order rejection is an exception (exceptional condition) but not a reason to terminate the process (Strategy). Leaving me with an open position..."

                If the strategy terminates(either intentionally or not), doesn't it close your position?

                Thank you.

                p.s. I enjoyed the analogy too

                Comment


                  #9
                  un$ane, if the strategy is terminated due to for example an order being rejected, it would attempt to close open positions and also cancel open strategy orders.
                  BertrandNinjaTrader Customer Service

                  Comment


                    #10
                    Hi un$ane,

                    An "Exception" is 'special condition that occurs during the run of an application and that changes the normal flow of execution' (Wiki).

                    So in our case the 'special condition' is Order rejection, engine failure, etc.

                    A critical system (life supporting systems, FMS, Trading systems, etc) should be able to 'handle' exceptions (special conditions). Basically, 'handling the exception' means, respond to the raised 'special condition' and continue.

                    The exception shouldn't cause an application/process to stop. Application or process in this context is a NinjaScript Strategy.

                    The exception should be handled and this could be:
                    - try to re-send the faulty order,
                    - if the order was a Stop loss/trailing order, close its related open order,
                    - Ignore if there is already a stop loss/trailing order in place,
                    - etc.

                    Or indeed, as is currently implemented in NT6.5, Cancel all, close all and terminate. Which is not necessary, if not annoying and damaging.

                    Cheers,
                    Obi

                    Comment


                      #11
                      Is there an event I can hook into that will notify me if/when the strategy stops besides switching to the RealtimeErrorHandling.TakeNoAction route?

                      Or can I read the OrderState before the strategy shuts down to send an IM or email out for example?

                      Comment


                        #12
                        The OrderState will be your best bet, as far as I am aware.

                        Comment


                          #13
                          Hi NT_Bertrand,

                          What does it mean when you get the following message:

                          "Order has exceded available account equity. Please reduce order size. Affected Order: Buy 25000 Market."

                          Now, this is on the 'Sim101' account which I just had reset and clear all history.

                          Any idea?

                          Cheers,
                          Obin

                          Comment


                            #14
                            Correct, you can work with IOrder objects and check for the OrderState.Rejected - http://www.ninjatrader-support.com/H...V6/IOrder.html

                            Obi, this means your Sim101 account margin is insufficient for the order, please try to reduce the size.
                            BertrandNinjaTrader Customer Service

                            Comment


                              #15
                              So if RealtimeErrorHandling.StopStrategyCancelOrdersClos ePositions is true and the strategy halts, I'll have time to read OrderState.Rejected in the OnOrderUpdate event?

                              Is there an easy way to 'crash' the strategy running on Simulated Data Feed so I can test?

                              Really appreciate all your help Bertrand

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by yertle, 04-18-2024, 08:38 AM
                              9 responses
                              40 views
                              0 likes
                              Last Post yertle
                              by yertle
                               
                              Started by techgetgame, Yesterday, 11:42 PM
                              0 responses
                              9 views
                              0 likes
                              Last Post techgetgame  
                              Started by sephichapdson, Yesterday, 11:36 PM
                              0 responses
                              2 views
                              0 likes
                              Last Post sephichapdson  
                              Started by bortz, 11-06-2023, 08:04 AM
                              47 responses
                              1,615 views
                              0 likes
                              Last Post aligator  
                              Started by jaybedreamin, Yesterday, 05:56 PM
                              0 responses
                              10 views
                              0 likes
                              Last Post jaybedreamin  
                              Working...
                              X