PDA

View Full Version : manage order by 3rd party code


roland_nt
02-27-2012, 07:36 PM
Is there a way (API?) to manage the exit of an order generated from within a strategy from outside the strategy?

Specifically i would like to move stops and targets on a multi contract entry (entry determined by logic in the strategy) from a program running concurrently with Ninja.
The strategy might or might not be using DOM/ATM facilities.

Thanks

NinjaTrader_Bertrand
02-28-2012, 02:04 AM
Hi Roland, not a full API unfortunately but an Automated Trading Interface that should offer what you seek here : http://www.ninjatrader.com/support/helpGuides/nt7/automated_trading_interface_at.htm

Here's all you could do with this inferface -

http://www.ninjatrader.com/support/helpGuides/nt7/what_can_i_do_and_how_.htm

roland_nt
02-29-2012, 11:25 AM
Thanks Bertrand
The DLL appears to be the right interface, but I could not tell from the descriptions
if I could pick up from the DLL interface the details of a trade entered from strategy, i/e. a trade that was started not using the DLL API.

Can you tell me which call[s] would do that?

NinjaTrader_RyanM
02-29-2012, 12:22 PM
Hi roland_nt,

You could look into these two from the dll functions page (http://www.ninjatrader.com/support/helpGuides/nt7/functions.htm):

string Orders(string account)
Gets a string of order ID's of all orders of an account separated by '|'. *If a user defined order ID was not originally provided, the internal token ID value is used since it is guaranteed to be unique.

string OrderStatus(string orderId)
Gets the order state (see definitions) for the orderId. Returns an empty string if the order ID value provided does not return an order.

roland_nt
02-29-2012, 04:23 PM
Ryan:
Just to be very certain,
1) the order id string WOULD contain orders generated from within a running strategy?
2) Is the name of initiating strategy indicated somehow?
3) are closed orders (trade completed) also in the list or only open/unfilled
Thanks for your patience

NinjaTrader_Bertrand
03-01-2012, 06:08 AM
Roland, it would give you access to order running on the specified account, this can include automated ones, too.

You can check for the StrategyID field of the order.

It should give you the orders string for the session being run.