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

  • NinjaTrader_Jim
    replied
    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.

    Leave a comment:


  • aslane
    started a topic Order Field Questions

    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.

Latest Posts

Collapse

Topics Statistics Last Post
Started by rajendrasubedi2023, Today, 09:50 AM
3 responses
15 views
0 likes
Last Post NinjaTrader_BrandonH  
Started by lorem, Today, 09:18 AM
2 responses
11 views
0 likes
Last Post NinjaTrader_ChelseaB  
Started by geddyisodin, Today, 05:20 AM
4 responses
29 views
0 likes
Last Post geddyisodin  
Started by geotrades1, Today, 10:02 AM
2 responses
9 views
0 likes
Last Post geotrades1  
Started by ender_wiggum, Today, 09:50 AM
1 response
5 views
0 likes
Last Post NinjaTrader_Gaby  
Working...
X