Guía de Usuario
- 
                                                                                                            
                                                                                                        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 ID
- float sl- stop loss price
- float tp- take profit price
- uint 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 symbol
- int64 dealid1- first position ID
- int64 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 ID
- float bid, ask- closing prices
- bool byanyprice- closing at any price flag
- uint 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 mode
- int 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 ID
- string Symbol- position symbol
- uint16 Direction- direction
- double Volume- position volume
- bool IsLock- position lock
- datetime OpenTime- open time
- float OpenPrice- close time
- float SL- stop loss
- float TP- take profit
- bool TrailingActive- trailing activity flag
- uint TrailingDistance- trailing distance
- double 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.