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

Order Field Questions

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

    Order Field Questions

    I am passing orders to brokerage via Ninjatrader from an external source using Account.Submit() and getting status back via Account.OrderUpdate.

    I need to be able to track an external identifier thru that process and wanted to ask some questions about Order fields that are not documented as far as I can tell.

    1. OrderId is supposed to be the brokerage id for the order, but it seems to be set even when the order is in Initialized state (before being sent), which would imply this is a Ninja id, not the brokerage id. Is this true? If so, is there any way to get the brokerage order id?

    2. ClientId is an undocumented long field. If I set this field, it seems to be carried thru the order process (except in the Initialized state when it is set to -1). Can this field be safely used for this purpose? If so, any reason it would not be set in the Initialized state (I set it it when passed to Submit, but first OrderUpdate has set to -1, subsequent OrderUpdates have properly set)?

    3. Similarly, there is an undocumented Id long field. Can this be used?

    4. Finally, there are two string fields, Name and FromEntrySignal. Can these be safely used to store order information thru the order update process?

    Thanks.

    #2
    Hello aslane,

    Thanks for your questions.

    1. OrderId is supposed to be the brokerage id for the order, but it seems to be set even when the order is in Initialized state (before being sent), which would imply this is a Ninja id, not the brokerage id. Is this true? If so, is there any way to get the brokerage order id?
    Adding prints for these properties in OnOrderUpdate can help to draw a bigger picture on how these properties can be used. For example, printing the OrderState and the OrderID, we can see that a NinjaTrader ID is given on Submitted, but when the Order comes back with an Accepted or Working State, we see the OrderID is reflective of what is being used at the broker/exchange.

    2. ClientId is an undocumented long field. If I set this field, it seems to be carried thru the order process (except in the Initialized state when it is set to -1). Can this field be safely used for this purpose? If so, any reason it would not be set in the Initialized state (I set it it when passed to Submit, but first OrderUpdate has set to -1, subsequent OrderUpdates have properly set)?
    I do not have any information on this property or its usage. I would not recommend using it to set your own values and would recommend using your own class level variables instead.

    3. Similarly, there is an undocumented Id long field. Can this be used?
    You are welcome to use this if you find an appropriate purpose. Prints will show that this value will increment with each order submitted.

    4. Finally, there are two string fields, Name and FromEntrySignal. Can these be safely used to store order information thru the order update process?
    As with number 2, I would not recommend using these properties to store information outside of the context of their design. I would instead recommend using your own class level variables to manage that information.

    I used the following print to observe this behavior in OnOrderUpdate. (This was used in the SampleOnOrderUpdate strategy testing against a paper trading account, but the application would be the same for using Account OrderUpdate events.

    Print(String.Format("State: {0} OrderID: {1} ClientID: {2} ID: {3} SignalName: {4} fromEntrySignal: {5}", order.OrderState, order.OrderId, order.ClientId, order.Id, order.Name, order.FromEntrySignal));

    Please let us know if there is anything else we can do to help.
    JimNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by DJ888, 04-16-2024, 06:09 PM
    4 responses
    12 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by terofs, Today, 04:18 PM
    0 responses
    11 views
    0 likes
    Last Post terofs
    by terofs
     
    Started by nandhumca, Today, 03:41 PM
    0 responses
    7 views
    0 likes
    Last Post nandhumca  
    Started by The_Sec, Today, 03:37 PM
    0 responses
    3 views
    0 likes
    Last Post The_Sec
    by The_Sec
     
    Started by GwFutures1988, Today, 02:48 PM
    1 response
    9 views
    0 likes
    Last Post NinjaTrader_Clayton  
    Working...
    X