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

IOrder.Error vs. IOrder.NativeError

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

    IOrder.Error vs. IOrder.NativeError

    Can't fully understand how to use IOrder.Error and IOrder.NativeError properties:

    1) Error not mentioned in NT7 Help but is recognized by the NT7 editor / compiler and works in Sim mode.

    2) Error="NoError" and NativeError="" when OK.

    3) The following code seems to work, any limitations?

    Code:
     
    OnOrderUpdate (IOrder orderHandle)
    {
    if (orderHandle.Error != ErrorCode.NoError)
    {
    Print("Problem");
    }
    }

    #2
    Hello,

    Thanks for your forum post.


    A Native error is a text error that comes directly from the broker and never NinjaTrader generated. The iOrder.Error is an internal NinjaTrader error that is internally generated by NinjaTrader.

    So I dont see any issue with your code. A change I might make is that I Print the Native Error text instead of just Problem. So that if an error was to occur you can see the reasoning for the error from the broker and even a broker error message that you can ask the broker what the error code indicates.

    Let me know if I can be of further assistance.

    Comment


      #3
      Presuming then that the possible values of NativeError specified in NT7 IOrder help file actually apply to Error and that the possible values of NativeError are broker-dependent? If this is the case, the help is misleading (at least the Error property is missing). But thanks for explanation.

      Comment


        #4
        Hello,

        Jut realized, That we dont even show Error on the help guide therefor NativeError is the only one to use in this case.

        As, the error property is for NinjaTrader internal use only.

        Let me know if I can be of further assistance.

        Comment


          #5
          Hmmm. So this means that the possible values of NativeError are 'erroneous' (should be e.g. 'string containing the broker-generated error message'), right?

          I am inspecting the OrderState, and can therefore identify reject, but not much more (automatically).
          Last edited by jp_kettunen; 12-27-2010, 08:22 AM.

          Comment


            #6
            Hello,

            No these have been reversed for NinjaScript. The string containing the broker message is for display in NinjaTrader only. Use NativeError to get the error code, there is no access to this String error from the broker in NinjaScript I jumped the gun when I mentioned this. As when you analyze the log file the native error is the shown error from the broker. Since there is no need for this in a NinjaScript strategy it is not availiable.

            Let me know if I can be of further assistance.

            Comment


              #7
              I am not yet sure whether I have understood this completely (sorry!). So I'll have to continue posing these questions.

              1) You wrote earlier that "the error property is for NinjaTrader internal use only". Question: what is the risk involved in referring to order.Error in NT script, e.g. inside OnOrderUpdate()?

              2) If I wanted to inspect NativeError programmatically, should I do it like this:

              if (order.NativeError != "") { Print("Broker error: " + order.NativeError); },

              or like this:

              if (order.NativeError == "ErrorCode.Panic") { Print("Abandon ship"); }

              Comment


                #8
                Hello,

                You would use:

                if (order.NativeError == "ErrorCode.Panic") { Print("Abandon ship"); } , also using order.Error is unsupported suggest not using this.

                Let me know if I can be of further assistance.

                Comment


                  #9
                  Ok, making progress... But one more crucial question: if "A Native error is a text error that comes directly from the broker and never NinjaTrader generated", as you wrote, then how come we can know in advance what it can be (e.g. "ErrorCode.Panic" instead of "ijifj32350")? Or do all brokers adhere to the same industry standard, described in the IOrder help file?

                  Comment


                    #10
                    Hello,

                    This is only in terms of the logs sorry for the confusion. In terms of NinjaScript ignore this statement as you have no access to this. In NinjaScript the Order.NativeError is the standard error codes that you can check for with checking equality to the order types mentioned on the iOrder page. Therefor you will not have access to the error that comes direct from the broker as you are correct there would be no action you could take on these.

                    Let me know if I can be of further assistance.

                    Comment


                      #11
                      thanks, trying to live with that!

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by yertle, Yesterday, 08:38 AM
                      7 responses
                      28 views
                      0 likes
                      Last Post yertle
                      by yertle
                       
                      Started by bmartz, 03-12-2024, 06:12 AM
                      2 responses
                      21 views
                      0 likes
                      Last Post bmartz
                      by bmartz
                       
                      Started by funk10101, Today, 12:02 AM
                      0 responses
                      5 views
                      0 likes
                      Last Post funk10101  
                      Started by gravdigaz6, Yesterday, 11:40 PM
                      1 response
                      9 views
                      0 likes
                      Last Post NinjaTrader_Manfred  
                      Started by MarianApalaghiei, Yesterday, 10:49 PM
                      3 responses
                      11 views
                      0 likes
                      Last Post NinjaTrader_Manfred  
                      Working...
                      X