Operations > Automated Trading > Automated Trading Interface (ATI) > eSignal Integration >

Functions

Print this Topic Previous pageReturn to chapter overviewNext page

*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 ATI tab.

 

tog_minusData 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.

 

bool NTConnected(int showMessage)

Gets the current connection state of the ATI. Returns true when connected, false 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.

 

string NTNewOrderId()

Gets a unique order ID.

 

string NTOrders(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 NTOrderStatus(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.

 

double NTRealizedPnL(string account)

Gets the realized profit and loss of an account.

 

string NTStopOrders(string strategyId)

Gets a string of order ID's of all Stop Loss orders of an ATM Strategy separated by '|'. Internal token ID value is used since it is guaranteed to be unique.

 

string NTStrategies(string account)

Gets a string of strategy ID's of all ATM 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.

 

string TargetOrders(string strategyId)

Gets a string of order ID's of all Profit Target orders of an ATM Strategy separated by '|'. Internal token ID value is used since it is guaranteed to be unique.

tog_minusGlobal 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 in the Control Center window by left mouse clicking on the Tools menu, selecting the Options menu item and then checking "Confirm Order Placement."

 

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.

tog_minusOrder 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 an order by orderId. If you want to change an order that was automatically submitted by an internal NinjaTrader ATM 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.

tog_minusOrder 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.