Hướng dẫn cách dùng
-
User Guide for NTTX Advisors
- NetTradeX Advisors Terminal
-
Articles
-
NetTradeX Language: Introduction
- Language Basics
- Language Functions
-
Language System Objects
- Deal Management
- Order Management
- Indicators
- Object-Oriented Programming
-
DLL files
-
Object Account
-
Object Bars
-
Object Chart
-
Object datetime
-
Object History
-
Object file
-
Object Globals
-
Object Math
-
Object Symbols
-
Object System
int64 Open(const string& in symbol,double volume,float price,uint16 cmd,bool islock,float sl,float tp,bool byanyprice,uint max_deviation,uint trailing_dist)
Opening a position1.
Parameters:
- string symbol - symbol for trading
- double volume - volume
- float price - opening price
- uint16 cmd - direction
- bool islock - lock flag
- float sl - stop loss price
- float tp - take profit price
- bool byanyprice - open at any price flag
- uint max_deviation - maximum deviation from opening price
- uint trailing_dist - trailing stop distance
When the result is successful the unique deal identifier is returned.
If case of failure, 0 is returned, and error code can be found via System.LastError
.
bool Modify(int64 id,float sl,float tp,uint trailing)
Modifying an existing position.
Parameters:
int64 id
- position IDfloat sl
- stop loss pricefloat tp
- take profit priceuint trailing
- trailing stop distance
Returned value - flag of successful position modification. In case of failure, the error code can be found via System.LastError
bool Unlock(const string& in symbol,int64 dealid1,int64 dealid2)
Unlocking a pair of existing positions of the opposite direction.
Parameters:
string symbol
- position symbolint64 dealid1
- first position IDint64 dealid2
- second position ID
Returned value - flag of successful position unlocking. In case of failure , the error code can be found via System.LastError
bool Close(int64 id,float bid,float ask,bool byanyprice,uint max_deviation)
Closing the existing position.
Parameters:
int64 id
- position IDfloat bid, ask
- closing pricesbool byanyprice
- closing at any price flaguint max_deviation
- maximum deviation from closing price
Returned value - flag of successful position closure. In case of failure, the error code can be found via System.LastError
bool Select(int64 sel,int mode)
Selects a deal for future reference to its properties.
Parameters:
int64 sel
- ID or a position of a deal, depending on selection modeint mode
- deal selection mode
Deals Properties (selected position properties)
Before using position properties, the position should be selected by the function Select().
int Total
- returns the number of open positions (the preliminary invoke of the function Select is not necessary)int64 ID
- unique position IDstring Symbol
- position symboluint16 Direction
- directiondouble Volume
- position volumebool IsLock
- position lockdatetime OpenTime
- open timefloat OpenPrice
- close timefloat SL
- stop lossfloat TP
- take profitbool TrailingActive
- trailing activity flaguint TrailingDistance
- trailing distancedouble Swap
- deal swap
1 If positions of opposite directions are being opened with the flag islock=true, their symbols coincide with one another and their volumes are equal, the positions collapse and Open() function for the second position returns a non-zero value.