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 cmoran13, Yesterday, 01:02 PM
        0 responses
        25 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        17 views
        0 likes
        Last Post PaulMohn  
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        160 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        94 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        148 views
        2 likes
        Last Post CaptainJack  
        Working...
        X