Kullanim Kilavuzu
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
- symboldouble volume
- volumefloat price
- opening priceuint8 cmd
- opening directionuint8 duration
- durationbool islock
- lock flagfloat sl
- stop loss pricefloat tp
- take profit priceuint 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
.
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 symbolfloat ord1_price
- first order opening pricedouble ord1_volume
- first order volumeuint8 ord1_cmd
- first order opening directionbool ord1_islock
- first order lock flagfloat ord2_price
- second order opening pricedouble ord2_volume
- second order volumeuint8 ord2_cmd
- second order opening directionbool ord2_islock
- second order lockuint8 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
.
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 symbolfloat activaton_price
- activation pricefloat ord1_price
- first order opening pricedouble ord1_volume
- first order volumeuint8 ord1_cmd
- first order opening directionbool ord1_islock
- first order lock flagfloat ord2_price
- second order opening pricedouble ord2_volume
- second order volumeuint8 ord2_cmd
- second order opening directionbool ord2_islock
- second order lock flaguint8 duration
- durationbool 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 IDdouble volume
- volumefloat price
- open priceuint8 cmd
- directionuint8 duration
- durationbool islock
- lock flagfloat sl
- stop loss pricefloat tp
- take profit priceuint 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 IDfloat ord1_price
- first order pricedouble ord1_volume
- first order volumeuint8 ord1_cmd
- first order opening directionbool ord1_islock
- first order lockfloat ord2_price
- second order pricedouble ord2_volume
- second order priceuint8 ord2_cmd
- second order opening directionbool ord2_islock
- second order lockuint8 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 IDint64 linked1
- ID of the 2nd level first orderint64 linked2
- ID of the 2nd level second orderfloat activaton_price
- activation pricefloat ord1_price
- first order pricedouble ord1_volume
- first order volumeuint8 ord1_cmd
- first order opening directionbool ord1_islock
- first order lockfloat ord2_price
- second order pricedouble ord2_volume
- second order volumeuint8 ord2_cmd
- second order opening directionbool ord2_islock
- second order lockuint8 duration
- durationbool 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 modeint 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 IDstring Symbol
- order currencyuint16 Direction
- order directionuint16 Type
- order typeuint16 SubType
- order subtypebool IsActive
- order activity flagdouble Volume
- volumefloat Price
- open pricefloat SL
- stop loss pricefloat TP
- take profit pricedatetime OpenTime
- open timedatetime ActTime
- activation timebool IsLimit
- limit order flag(or stop order)uint16 Duration
- order durationbool IsLock
- lock flagint64 OCO
- reference to the paired OCO-orderint64 DealID
- reference to the dealuint TrailingDistance
- trailing stop distancestring Currency
- order currency (the property is deprecated)