Both the DLL Interface and COM Interface share the same functions.
int Ask(string instrument, double price, int size)
Sets the ask price and size for the specified instrument. A return value of 0 indicates success and -1 indicates an error.
int AskPlayback(string instrument, double price, int size, string timestamp)
Sets the ask price and size for the specified instrument for use when synchronizing NinjaTrader playback with an external application playback. A return value of 0 indicates success and -1 indicates an error. The timeStamp parameter format is "yyyyMMddhhmmss".
double AvgEntryPrice(string instrument, string account)
Gets the average entry price for the specified instrument/account combination.
double AvgFillPrice(string orderId)
Gets the average entry price for the specified orderId.
int Bid(string instrument, double price, int size)
Sets the bid price and size for the specified instrument. A return value of 0 indicates success and -1 indicates an error.
int BidPlayback(string instrument, double price, int size, string timestamp)
Sets the bid price and size for the specified instrument for use when synchronizing NinjaTrader playback with an external application playback. A return value of 0 indicates success and -1 indicates an error. The timeStamp parameter format is "yyyyMMddhhmmss".
int Command(string command, string account, string instrument, string action, int quantity, string orderType, double limitPrice, double stopPrice,
string timeInForce, string oco, string orderId, string strategy, string strategyId)
Function for submitting, cancelling and changing orders, positions and strategies. Refer to the Commands and Valid Parameters section for detailed information. A return value of 0 indicates success and -1 indicates an error. The Log tab will list context sensitive error information.
int ConfirmOrders(int confirm)
The parameter confirm indicates if an order confirmation message will appear. This toggles the global option that can be set manually via NinjaTrader Control Center Tools-->Options, "Confirm order placement" checkbox. A value of 1 sets this option to true, any other value sets this option to false.
int Connected(int showMessage)
Returns a value of zero if the DLL has established a connection to the NinjaTrader server (application) and if the ATI is currently enabled or, -1 if it is disconnected. Calling any function in the DLL will automatically initiate a connection to the server. The parameter showMessage indicates if a message box is displayed in case the connection can not be established. A value of 1 = show message box, any other value = don't show message box.
int Filled(string orderId)
Gets the number of contracts/shares filled for the orderId.
int Last(string instrument, double price, int size)
Sets the last price and size for the specified instrument. A return value of 0 indicates success and -1 indicates an error.
int LastPlayback(string instrument, double price, int size, string timestamp)
Sets the last price and size for the specified instrument for use when synchronizing NinjaTrader playback with an external application playback. A return value of 0 indicates success and -1 indicates an error.
int MarketPosition(string instrument, string account)
Gets the market position for an instrument/account combination. Returns 0 for flat, negative value for short positive value for long. This function will only return values for positions initiated via the ATI.
string NewOrderId()
Gets a new unique order id value.
string Orders(string account)
Gets a string of order Ids of all orders that were initiated through the ATI if an account separated by '|'.
string OrderStatus(string orderId)
Gets the order state (see definitions) for the orderId.
int SetUp(string host, int port)
Optional function to set the host and port number. By default, host is set to "localhost" and port is set to 36973. The default port number can be set via the General tab under Options. If you change these default values, this function must be called before any other function. A return value of 0 indicates success and -1 indicates an error.
string Strategies(string account)
Gets a string of strategy ids of all strategies of an account separated by '|'. Duplicate ID values can be returned if strategies were initiated outside of the ATI.
int StrategyPosition(string strategyId)
Gets the position for a strategy. Returns 0 for flat, negative value for short and positive value for long.
int TearDown()
Disconnects the DLL from the NinjaTrader server. A return value of 0 indicates success and -1 indicates an error.