*Submitting an account value is optional. If no account value is passed in as an argument, pass in empty string "" and the default account is used as specified under the Misc tab.
|
Data Retrieval Functions |
double NTAvgEntryPrice(string acccount)
Gets the average entry price for the selected instrument/account combination.
double NTAvgFillPrice(string orderId)
Gets the average fill price of an order.
int NTConnected)
Gets the current connection state of the ATI. Returns 0 when connected, -1 when disconnected.
int NTConnected(int showMessage)
Gets the current connection state of the ATI. Returns 0 when connected, -1 when disconnected. 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 NTFilled(string orderId)
Gets the number of contracts/shares filled for the orderId.
int NTMarketPosition(string account)
Gets the market position for the selected instrument/account combination. Returns 0 for flat, negative for short and positive for long. This function will only return values for positions initiated via the ATI.
string NTNewOrderId()
Gets a unique order id.
string NTOrders(string account)
Gets a string of order Ids of all orders that were initiated through the ATI if an account separated by '|'.
string NTOrderStatus(string orderId)
Gets the order state (see definitions) for the orderId.
string NTStrategies(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.
string NTStrategyPosition(string strategyId)
Gets the position of a strategy. Returns 0 for flat, negative for short and positive for long.
|
Global Functions |
int NTCancelAllOrders()
Cancels all orders across all connections across all accounts. A return value of 0 indicates success and -1 indicates an error. Success indicates success in submitting the command NOT that all orders are in fact cancelled.
int NTCommand(string command, string account, 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 NTConfirmOrders(int enable)
Enables order confirmation dialog box. 0 = false, 1 = true. This is a global NinjaTrader setting that can be also set via the Control Center window Tools-->Options menu.
int NTClosePosition(string account)
Closes the selected instrument/account position. A return value of 0 indicates success and -1 indicates an error. Success indicates success in submitting the command NOT that the position has in fact been closed.
int NTFlattenEverything()
Closes all positions and cancels all orders across all connections across all accounts. A return value of 0 indicates success and -1 indicates an error. Success indicates success in submitting the command NOT that all orders are in fact cancelled and all positions are in fact closed.
|
Order Modification Functions |
int NTCancel(string orderId)
Cancels an order by orderId. A return value of 0 indicates success and -1 indicates an error. Success indicates success in submitting the command NOT that the order has in fact been cancelled.
int NTChange(string orderId, int quantity, double limitPrice, double stopPrice)
Change and order by orderId. If you want to change an order that was automatically submitted by an internal NinjaTrader strategy, use the intCommand function and pass in the strategyId and order name (STOP1 or TARGET1 etc) via the orderId parameter. A return value of 0 indicates success and -1 indicates an error. Success indicates success in submitting the command NOT that the order has in fact been changed.
|
Order Placement Functions |
* Submitting an orderId value is optional. Optionally leave it to empty string "".
int NTBuyLimit(string orderId, int quantity, double limitPrice)
Sends a buy limit order. A return value of 0 indicates success and -1 indicates an error. Success indicates success in submitting the command NOT that the order was successfully submitted.
int NTBuyMarket(string orderId, int quantity)
Sends a buy market order. A return value of 0 indicates success and -1 indicates an error. Success indicates success in submitting the command NOT that the order was successfully submitted.
int NTBuyStop(string orderId, int quantity, double stopPrice)
Sends a buy stop order. A return value of 0 indicates success and -1 indicates an error. Success indicates success in submitting the command NOT that the order was successfully submitted.
int NTBuyStopLimit(string orderId, int quantity, double limitPrice, double stopPrice)
Sends a buy stop limit order. A return value of 0 indicates success and -1 indicates an error. Success indicates success in submitting the command NOT that the order was successfully submitted.
int NTSellLimit(string orderId, int quantity, double limitPrice)
Sends a sell limit order. A return value of 0 indicates success and -1 indicates an error. Success indicates success in submitting the command NOT that the order was successfully submitted.
int NTSellMarket(string orderId, int quantity)
Sends a sell market order. A return value of 0 indicates success and -1 indicates an error. Success indicates success in submitting the command NOT that the order was successfully submitted.
int NTSellStop(string orderId, int quantity, double stopPrice)
Sends a sell stop order. A return value of 0 indicates success and -1 indicates an error. Success indicates success in submitting the command NOT that the order was successfully submitted.
int NTSellStopLimit(string orderId, int quantity, double limitPrice, double stopPrice)
Sends a sell stop limit order. A return value of 0 indicates success and -1 indicates an error. Success indicates success in submitting the command NOT that the order was successfully submitted.