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 charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        59 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        143 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        161 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        97 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        283 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X