Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OrderState question

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

    OrderState question

    Hello,
    I have this code from RealtimeErrorHandling help guide.

    Code:
    [FONT=Courier New] [COLOR=#0000ff]if[/COLOR] (order.OrderState == OrderState.Rejected)[/FONT] 
    [FONT=Courier New]        {    
    [COLOR=#008000]            // Stop loss order was rejected !!!![/COLOR][/FONT] 
    [FONT=Courier New][COLOR=#008000]            // Do something about it here[/COLOR][/FONT] 
    [FONT=Courier New]        }[/FONT]
    I've seen that I can print the status of Filled with this in the OnOrderUpdate section:

    Code:
    [FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]
    Print([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"13 -OrderState.Filled:\t"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]+OrderState.Filled);
    [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]Print([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"14 -order.Filled:\t"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]+order.Filled);
    
    [/SIZE][/FONT][/SIZE][/FONT]
    13 Results in "Filled" and 14 results in 1.

    Is there a similar method as my line 14 to get Initialized, Submitted, Accepted,Working, Rejected or Cancelled.

    These don't work except for the Filled line:
    Code:
    [FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]
    Print([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"14 -order.Initialized:\t"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]+order.Initialized);
    Print([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"14 -order.Pending:\t"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]+order.Pending);
    Print([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"14 -order.Submitted:\t"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]+order.Submitted);
    Print([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"14 -order.Working:\t"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]+order.Working);
    Print([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"14 -order.Filled:\t"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]+order.Filled);
    Print([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"14 -order.Cancelled:\t"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]+order.Cancelled);
    Print([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"14 -order.Rejected:\t"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]+order.Rejected);
    
    [/SIZE][/FONT][/SIZE][/FONT]
    Any thoughts or links you could point me to?
    Thanks,
    Kirk

    #2
    Hello zeller4,

    There aren't supported methods for this, but you should be able to custom code easily enough. You might consider checking order state and set any variables needed from that.

    if (order.OrderState == OrderState.Initialized)
    myOrderInitialized = 1;

    else
    myOrderInitialized = 0;
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      I understand setting it up by custom coding, thanks for that. Can you please tell my why the "Filled" orderstate works in this manner (differently than the others)?

      Thanks,
      Kirk

      Comment


        #4
        Hi Kirk,

        Unfortunately I don't have additional information on this. We support checking order state through the documented technique. The properties you're using are not supported / documented.
        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        648 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        369 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        108 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        572 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        574 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X