ユーザーガイド
Examples of working with Deals
NetTradeX PC
NetTradeX Android
NetTradeX iOS
NetTradeX Mobile
NetTradeX Advisors
-
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
Examples of working with Deals
Example*. Opening a buy position:
int64 OpenMyDeal(double volume) { double ask; int64 dealID=0; ask=Symbols.LastAsk(Chart.Symbol); if(ask==0) { System.Print("Can't update the prices"); return(0); } dealID=Deals.Open(Chart.Symbol,volume,ask,opBuy,false,0,0,false,5,0); if(dealID==0) { System.Print("Can't open the position. System.LastError="+System.LastError); } else { System.Print("The position has been successfully opened. DealID="+dealID); } return (dealID); } int Initialize(){return(0);} int Run() { OpenMyDeal(10000.00); return(0); } int DeInitialize(){return(0);}
Example*. Opening a position and changing the stop loss value:
extern double volume = 10000; int Initialize() { return(0); } int Run() { double ask; uint dealID = 0; ask = Symbols.LastAsk(Chart.Symbol); double sl_price = ask-0.1; if(ask==0) { System.Print("Can\'t update prices!"); return 0; } dealID=Deals.Open(Chart.Symbol,volume,ask,opBuy,false,sl_price,0,true,5,0); if(dealID!=0) { System.Print("The deal has been created"); } else { System.Print("Can't create the deal"); return 0; } sl_price -= 0.1; if(!Deals.Modify(dealID, sl_price, 0, 0)) { System.Print("Can't change stop_loss"); return (0); } else { System.Print("Stop_loss has been changed"); if(!Deals.Select(dealID,0)) { System.Print("Can't select the deal"); return 0; } else { System.Print("New value of stop loss is "+Deals.SL); } } return(0); } int DeInitialize() { return(0); }
* All these examples are recommended to be run in demo accounts only.