Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How can we catch such events ?

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

    How can we catch such events ?

    If we enabled "TraceOrders=true;" then we see such occasions:

    Code:
    xxxxx: Entered internal SubmitOrderManaged() method at 16-Jul-20 2:30:00 AM: BarsInProgress=0 Action=Sell OrderType=Market Quantity=0 LimitPrice=0 StopPrice=0 SignalName='myExitSignal' FromEntrySignal=''
    
    
    xxxxx: Ignored SubmitOrderManaged() method at 16-Jul-20 2:30:00 AM: BarsInProgress=0 Action=Sell OrderType=Market Quantity=0 LimitPrice=0 StopPrice=0 SignalName='myExitSignal' FromEntrySignal='' Reason='This was an exit order but no position exists to exit'
    however, neither in OnOrderUpdate, nor in OnExecutionUpdate, such events are not being passed .
    Where/how we can detect those events, so we could write our logic to address those occasions?

    i.e.
    OnOrderUpdateOrWhatever(...)
    {

    if (Order.State==..Ignored) {
    ...
    }
    }


    or how?

    #2
    Hello ttodua, thanks for your post.

    That message means that NinjaTrader suppressed the order before it was even created, so OnOrderUpdate would not be called. To avoid that you must make sure the strategy only calls exit orders when the strategy is in a position.

    Kind regards.

    Chris L.NinjaTrader Customer Service

    Comment


      #3
      ChrisL.
      Many thanks, but the answer doesn't satisfy me. The example i have given, was about exits. however, that is just example, and i have met cases like :
      https://ninjatrader.com/support/foru...der-cancelling
      where the BUY order become cancelled. (the reason was like : submited after session exit handled was finished , or like that sentence, cant remember).

      so, there should be a way hook/subscribe into those events where I can fire my logic programatically, while that event happens (those events which are caught by TraceOrders). However, just TraceOrders logs doesnt help me. I want to have programatic logic in those cases in my code, like i do with OnOrderUpdate.

      i hope i clearly explained.. thanks.

      Comment


        #4
        Hi ttodua, thanks for your reply.

        There is not an event for these type of orders. All suppressed orders can be avoided with the strategy logic. If you want to handle an order that is submitted outside of the session time, don't submit the order.

        Please let me know if I can assist any further.
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          ChrisL, don't get me wrong, but neither this is answer, as you are telling things that are reason-healers, not the actual solution to question. what you said above are:
          - don't fire exit order if there is no position
          - don't submit order if you are outside regular hours..

          so, "don't .. don't" is nowhere near the answer to the problem asked by me. I ask that my strategy do submit exit order when there is no position, and my strategy do submit orders when it might be outside of trading hours.
          So, i want a programmattic access to do this or that (i.e. log into file, or throw my custom message, or do anything i want) when such events fire. So, that should be exposed to programmers to have access to those events, like we have with OnOrderUpdate.

          Comment


            #6
            Hi ttodua, thanks for your reply.

            I found this event method:
            https://ninjatrader.com/support/help...ordertrace.htm

            The trace order strings can be parsed to determine the error message if you would like to handle the messages in this way.

            Please let me know if this does not resolve your inquiry.
            Chris L.NinjaTrader Customer Service

            Comment


              #7
              Thanks chris.
              that is now a solution. thank you.
              1) however, it will need a headache to parse correctly, as that is the string which i dont know how is formed in all cases- do you have any examples to help in parsing for those?

              2) if you already tried(if not i will try...) are those events triggered even when i turn off the TradeOrders=false? so, i could hook into such events without printing the log/stuff on client OutputWindow.
              Last edited by ttodua; 07-30-2020, 01:39 PM.

              Comment


                #8
                3) please rename this topic to "How to catch order events (like from TraceOrders) " and after renaming delete this exact post you are reading at this moment.

                Comment


                  #9
                  Hi ttodua, thanks for your reply.

                  No, the message string will be empty if TraceOrders is false. When you override OnOrderTrace, it completely takes over the trace order logic. So if you don't print anything within OnOrderTrace then nothing will print to the output window. So you can leave trace orders turned on and not print anything if performance is an issue.

                  Please let me know if I can assist any further.
                  Chris L.NinjaTrader Customer Service

                  Comment


                    #10
                    ttodua, unfortunately, I don't know of any example that parses the error messages already. You would need to compare the strings that you get from the standard traceorder message. If you want to see all of the messages it has, the strings are located in in NinjaTrader.Core.xml under C:\Program Files (x86)\NinjaTrader 8.

                    Best regards.
                    Chris L.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by frslvr, Today, 04:29 PM
                    0 responses
                    12 views
                    0 likes
                    Last Post frslvr
                    by frslvr
                     
                    Started by wjadevries, Today, 04:18 PM
                    0 responses
                    5 views
                    0 likes
                    Last Post wjadevries  
                    Started by shahabjet1, Today, 03:47 PM
                    2 responses
                    16 views
                    0 likes
                    Last Post shahabjet1  
                    Started by JTizz, Today, 03:21 PM
                    1 response
                    6 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Started by EB Worx, Today, 02:49 PM
                    1 response
                    10 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Working...
                    X