使用指南

Order Management
NetTradeX PC
NetTradeX Android
NetTradeX iOS
NetTradeX Mobile
NetTradeX Advisors
Order Management

Setting orders functions

int64 SetPending(string symbol,double volume,float price,uint8 cmd,uint8 duration,bool islock,float sl,float tp,uint trailing_dist)

Setting a pending order.

Parameters:

  • string symbol - symbol
  • double volume - volume
  • float price - opening price
  • uint8 cmd - opening direction
  • uint8 duration - duration
  • bool islock - lock flag
  • float sl - stop loss price
  • float tp - take profit price
  • uint trailing_dist - trailing stop distance

In case of the successful order placement, a unique identifier is returned.

Otherwise, 0 is returned, and the error code can be found via System.LastError.

Example

int64 SetOCO(string symbol,float ord1_price,double ord1_volume,uint8 ord1_cmd,bool ord1_islock,float ord2_price,double ord2_volume,uint8 ord2_cmd,bool ord2_islock,uint8 duration)

Setting an OCO-order consisting of two orders, the activation of one removes another.

Parameters:

  • string symbol - deals symbol
  • float ord1_price - first order opening price
  • double ord1_volume - first order volume
  • uint8 ord1_cmd - first order opening direction
  • bool ord1_islock - first order lock flag
  • float ord2_price - second order opening price
  • double ord2_volume - second order volume
  • uint8 ord2_cmd - second order opening direction
  • bool ord2_islock - second order lock
  • uint8 duration - duration

In case of the successful order placement, a unique identifier is returned.

Otherwise, 0 is returned, and the error code can be found via System.LastError.

Example

int64 SetActivation(string symbol,float activaton_price,float ord1_price,double ord1_volume,uint8 ord1_cmd,bool ord1_islock,float ord2_price,double ord2_volume,uint8 ord2_cmd,bool ord2_islock,uint8 duration,bool ord2_oco)

Setting an Activation-order. When the current price reaches the price of the order, two pending (or OCO-) orders will be placed.

Parameters:

  • string symbol - orders symbol
  • float activaton_price - activation price
  • float ord1_price - first order opening price
  • double ord1_volume - first order volume
  • uint8 ord1_cmd - first order opening direction
  • bool ord1_islock - first order lock flag
  • float ord2_price - second order opening price
  • double ord2_volume - second order volume
  • uint8 ord2_cmd - second order opening direction
  • bool ord2_islock - second order lock flag
  • uint8 duration - duration
  • bool ord2_oco - OCO flag for two activation orders

In case of the successful order placement, a unique identifier is returned.

Otherwise, 0 is returned, and the error code can be found via System.LastError.

Order modifying function

bool ModifyPending(int64 order,double volume,float price,uint8 cmd,uint8 duration,bool islock,float sl,float tp,uint trailing_dist)

Changing parameters of the existing pending order.

Parameters:

  • int64 order - order ID
  • double volume - volume
  • float price - open price
  • uint8 cmd - direction
  • uint8 duration - duration
  • bool islock - lock flag
  • float sl - stop loss price
  • float tp - take profit price
  • uint trailing_dist - trailing stop distance

In case of the successful order modification, the function returns true value.

Otherwise false is returned, and the error code can be found via System.LastError.

bool ModifyOCO(int64 order,float ord1_price,double ord1_volume,uint8 ord1_cmd,bool ord1_islock,float ord2_price,double ord2_volume,uint8 ord2_cmd,bool ord2_islock,uint8 duration)

Changing parameters of the existing OCO-order.

Parameters:

  • int64 order - order ID
  • float ord1_price - first order price
  • double ord1_volume - first order volume
  • uint8 ord1_cmd - first order opening direction
  • bool ord1_islock - first order lock
  • float ord2_price - second order price
  • double ord2_volume - second order price
  • uint8 ord2_cmd - second order opening direction
  • bool ord2_islock - second order lock
  • uint8 duration - duration

In case of the successful order modification, the function returns true.

Otherwise false is returned, and the error code can be found via System.LastError .

bool ModifyActivation(int64 order,int64 linked1,int64 linked2,float activaton_price,float ord1_price,double ord1_volume,uint8 ord1_cmd,bool ord1_islock,float ord2_price,double ord2_volume,uint8 ord2_cmd,bool ord2_islock,uint8 duration,bool ord2_oco)

Changing parameters of the existing Activation-order

Parameters:

  • int64 order - order ID
  • int64 linked1 - ID of the 2nd level first order
  • int64 linked2 - ID of the 2nd level second order
  • float activaton_price - activation price
  • float ord1_price - first order price
  • double ord1_volume - first order volume
  • uint8 ord1_cmd - first order opening direction
  • bool ord1_islock - first order lock
  • float ord2_price - second order price
  • double ord2_volume - second order volume
  • uint8 ord2_cmd - second order opening direction
  • bool ord2_islock - second order lock
  • uint8 duration - duration
  • bool ord2_oco - OCO flag for two 2nd level orders

In case of the successful order modification the function returns true.

Otherwise, false is returned, and error code can be found via System.LastError .

After an Activation-order with the OCO flag is triggered, modification of the order should be performed with the following parameters: order=0 and activaton_price=0.

After an Activation-order with the disabled OCO flag is triggered, the 2nd level orders are modified independently of each other. To modify each of them, call the ModifyActivation() function with the following parameters order=0, ord2=0, activaton_price=0, ord2_price=0, ord2_volume=0.

Additional functions and properties for operating orders

bool Delete(int64 order)

Deleting the order specified by its ID. Flag of the successful deletion is returned as a result of the operation. In case of failure, the error code can be found via System.LastError .

bool Select(int64 sel,int mode)

Selects an order for future reference to its properties.

Parameters:

  • int64 sel - Identifier or position of the order, depending on the selection mode
  • int mode - selection mode

int64 Link(uint num)

Getting id for linked orders of the second level, where num - ordinal number of a linked order.

Orders properties

Before using order properties, the order should be selected by the function Select().

  • int Total - returns the number of created orders (the preliminary invoke of the function Select is not necessary)
  • int64 ID - order ID
  • string Symbol - order currency
  • uint16 Direction - order direction
  • uint16 Type - order type
  • uint16 SubType - order subtype
  • bool IsActive - order activity flag
  • double Volume - volume
  • float Price - open price
  • float SL - stop loss price
  • float TP - take profit price
  • datetime OpenTime - open time
  • datetime ActTime - activation time
  • bool IsLimit - limit order flag(or stop order)
  • uint16 Duration - order duration
  • bool IsLock - lock flag
  • int64 OCO - reference to the paired OCO-order
  • int64 DealID - reference to the deal
  • uint TrailingDistance - trailing stop distance
  • string Currency - order currency (the property is deprecated)