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

Reject orders

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

    Reject orders

    Hello,

    I would like to know if there is a way to handle reject messages:
    1. is a reject order a cause for the termination of a strategy
    2. is there a way to handle reject in the code (example?)?

    Thanks

    #2
    1) You could code the OnOrderUpdate method: http://www.ninjatrader-support.com/H...derUpdate.html
    Also: http://www.ninjatrader-support.com/H...rHandling.html
    2) I believe the is no code sample. To double check you should consult the references section of this forum

    Comment


      #3
      Originally posted by NinjaTrader_Dierk View Post
      1) You could code the OnOrderUpdate method: http://www.ninjatrader-support.com/H...derUpdate.html
      Also: http://www.ninjatrader-support.com/H...rHandling.html
      2) I believe the is no code sample. To double check you should consult the references section of this forum
      Would be great to have some examples.

      Thanks

      Comment


        #4
        There is no explicit example, but you can use the OnOrderUpdate() sample as a jumping off point. It pretty much has 95% of the framework done. All you need is to set RealtimeErrorHandling and just check if the order state is rejected and do something like resubmitting the order if that is the case.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          By setting that value:
          RealtimeErrorHandling.TakeNoAction
          This won't cause the strategy to terminate itself?

          Comment


            #6
            It will not terminate, but you will need to be absolutely certain you have handled every possible scenario or else something bad may occur if some order messes up.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              It's really important in the case of rejected stops or targets (although missing an opportunity as a cost as well) as the loss can be quite big if not noticed quickly enough so from the link above I don't have the impression that I can have many scenarios in that case except trying to get out of the position.

              Comment


                #8
                I had a look at my logs and noticed that there was a difference on the rejected orders:

                18/07/2008 18:16:23|1|32|Order='176177141/U486316' Name='ShortStop' New State=Cancelled Instrument='ER2 09-08' Action=BuyToCover Limit price=0 Stop price=690.3 Quantity=1 Type=Stop Filled=0 Fill price=0 Error=NoError Native error='Order Canceled - reason:COULD NOT VALUE THIS CONTRACT AT THIS TIME (202)'
                18/07/2008 18:18:12|1|32|Order='6a202e5a82624413829dedf356d84 338/U486316' Name='SDLong' New State=Rejected Instrument='YM 09-08' Action=Buy Limit price=0 Stop price=0 Quantity=1 Type=Market Filled=0 Fill price=0 Error=OrderRejected Native error='Order rejected - reason:COULD NOT VALUE THIS CONTRACT AT THIS TIME (201)'

                The first one which was a stop order is considered as cancelled and the second one which was a market order is considered as rejected. Was wondering why is there a difference between these 2 rejects as they look quite similar (except the difference on the order and the difference on the number). Is this a difference coming from IB?

                Thanks
                Last edited by ryker; 07-20-2008, 09:09 PM.

                Comment


                  #9
                  Being cancelled is completely different than being rejected. Rejected is something that happens either at the brokerage or exchange. Cancelled is generally something that your strategy is doing forcing an order cancellation (e.g. stop loss cancels after profit target fills)
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    Josh,
                    I perfectly understand the difference between a cancel and a reject but if you had read my post a bit closely you would have seen that the cancel comes from IB and not from the strategy:
                    Native error='Order Canceled - reason:COULD NOT VALUE THIS CONTRACT AT THIS TIME (202)'
                    Note that the message is very similar to the reject message. Is this difference from IB?

                    Comment


                      #11
                      Not sure what these error messages mean, you would need to check with IB for more information on this.
                      RayNinjaTrader Customer Service

                      Comment


                        #12
                        Is this possible to make a difference between an IB cancel (like above) and a strategy cancel (like for example if a profit target is hit and the strategy cancels the stop order)?

                        Comment


                          #13
                          Unfortunately not.
                          RayNinjaTrader Customer Service

                          Comment


                            #14
                            When trying to handle rejected orders...

                            How does one get to the "Native Error" as found in the Log?

                            Comment


                              #15
                              This is currently not supported.
                              RayNinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by truepenny, Today, 03:59 AM
                              5 responses
                              21 views
                              0 likes
                              Last Post truepenny  
                              Started by nicthe, Yesterday, 07:38 AM
                              7 responses
                              29 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by trilliantrader, Today, 09:34 AM
                              3 responses
                              8 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by spencerp92, 10-10-2023, 09:56 AM
                              5 responses
                              317 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by flybuzz, Yesterday, 10:33 AM
                              2 responses
                              13 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Working...
                              X