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

order state

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

    order state

    Hello,

    If I send for example ExitLongLimitOrder which cause the order state to be OrderState.Accepted or order state == OrderState.Woring,

    and after that I update the same order by sending again ExitLongLimitOrder which cause the order to be OrderState.Rejected.

    The question is whether the order that sent in the first time will be still active in the broker or cancelled?


    Thanks,kobi

    #2
    Hello kobi,

    Thanks for your inquiry.

    If you are using the same SignalName for the order method, a change order will be submitted. If you are using separate SingalNames, a new order will be generated and the previous order may be cancelled depending on if it was submitted with isLiveUntilCancelled set to true.

    If you updated an order with the same SignalName and got a rejection, the strategy will attempt to cancel orders it had generated, so the order should be canceled at the broker and exchange.

    If you wish to handle order rejections on your own, you may do so with RealtimeErrorHandling and OnOrderUpdate().

    Publicly available documentation on isLiveUntilCancelled and order rejection handling can be found below.

    isLiveUntilCancelled - https://ninjatrader.com/support/help...ancelledOrders

    RealtimeErrorHandling - https://ninjatrader.com/support/help...orhandling.htm

    OnOrderUpdate() - https://ninjatrader.com/support/help...rderupdate.htm

    Please let us know if you have any questions.
    JimNinjaTrader Customer Service

    Comment


      #3
      Hello Jim,

      Thank you for your response.

      So, if the strategy set with RealtimeErrorHandling.StopCancelCloseIgnoreRejects and
      my order submitted with isLiveUntilCancelled set to true .

      and attempt to update the same order with the same signal name will rejected by the broker , what TerminalState() method will return since the order will be still active in the broker?

      Sincerely,Kobi
      Last edited by levikNT; 02-01-2018, 08:30 AM.

      Comment


        #4
        Hello kobi,

        RealtimeErrorHandling.StopCancelClose is the default behavior.

        Default behavior is to stop the strategy, cancel any remaining working orders, and then close any open positions managed by the strategy by submitting one "Close" order for each unique position.
        So even if the order is submitted with isLiveUntilCancelled, the strategy will still send cancel requests as it aborts. If you are disconnected from your provider at this time, then the cancels may not reach your broker and you may be in an open position. You would then need to call your broker's Orders Desk to manage the order/position.

        RealtimeErrorHandling.StopCancelCloseIgnoreRejects should ignore a rejection of a change order and the strategy should continue as if the rejection had not occurred, aside from any actions taken after the fact in OnOrderUpdate().

        Please let us know if you have any additional questions.
        Last edited by NinjaTrader_Jim; 02-01-2018, 10:11 AM.
        JimNinjaTrader Customer Service

        Comment


          #5
          [SIZE="6"]
          Originally posted by NinjaTrader_Jim View Post
          Hello kobi,

          RealtimeErrorHandling.StopCancelCloseIgnoreRejects is the default behavior.



          So even if the order is submitted with isLiveUntilCancelled, the strategy will still send cancel requests as it aborts. If you are disconnected from your provider at this time, then the cancels may not reach your broker and you may be in an open position. You would then need to call your broker's Orders Desk to manage the order/position.

          Please let us know if you have any additional questions.
          Hello Jim,
          Sorry but you didn't answer to my question

          First theRealtimeErrorHandling.StopCancelCloseIgnoreReje cts is not the default behavior.
          according to NT help the default is RealtimeErrorHandling.StopCancelClose
          RealtimeErrorHandling - https://ninjatrader.com/support/help...orhandling.htm

          And my Qustion was
          if the strategy was set to theRealtimeErrorHandling.StopCancelCloseIgnoreReje cts
          so, in case of order reject I will catch it in OnOrderUpdate
          and I try to update my order and it has been rejected by the broker and I catch it in OnOrderUpdate ,and I have connection to my broker

          what TerminalState() method will return since the order will be still active in the broker?

          Sincerely,Kobi

          Comment


            #6
            Hello kobi,

            Yes, I had made an error in my last response. My apologies. I'll make sure my previous post is updated with accurate information.

            RealtimeErrorHandling.StopCancelCloseIgnoreRejects will keep the strategy running when a rejection is received, there would be no cancels submitted and the strategy would ignore the rejection outside of what you have done after you have detected it has come back as OrderState.Rejected it in OnOrderUpdate().

            If a change order gets rejected, you should expect the original order to still be active as well as the strategy. Are you seeing something different?

            I'm happy to be of any further assistance.
            Last edited by NinjaTrader_Jim; 02-01-2018, 10:09 AM.
            JimNinjaTrader Customer Service

            Comment


              #7
              Hello Jim,

              Thank you for your response,

              So I understand that in the case of RealtimeErrorHandling.StopCancelCloseIgnoreRejects on change order rejection the TerminalState() method will return false which is OK, but in NT Help it says that the TerminalState() will return true in the case of order rejection, I think that NT refers to the case of RealtimeErrorHandling.StopCancelClose, if this is the case the help guide should be update

              Sincerely, Kobi

              Comment


                #8
                Hello Kobi,

                IsTerminalState() would return true or false if the order state passed to it states that the order is Filled, Cancelled, Rejected, or Unknown. You should still see the IsTerminalState() return true for OrderState.Rejected(), but the strategy will not abort and send cancel requests as the RealTimeErrorHandling is set to ignore rejections.

                If there something else that you would like clarification on, please let me know.
                JimNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by bortz, 11-06-2023, 08:04 AM
                47 responses
                1,607 views
                0 likes
                Last Post aligator  
                Started by jaybedreamin, Today, 05:56 PM
                0 responses
                9 views
                0 likes
                Last Post jaybedreamin  
                Started by DJ888, 04-16-2024, 06:09 PM
                6 responses
                19 views
                0 likes
                Last Post DJ888
                by DJ888
                 
                Started by Jon17, Today, 04:33 PM
                0 responses
                6 views
                0 likes
                Last Post Jon17
                by Jon17
                 
                Started by Javierw.ok, Today, 04:12 PM
                0 responses
                15 views
                0 likes
                Last Post Javierw.ok  
                Working...
                X