The following lists alphabetically built-in PTL functions available for trading and market operations.
List of available functions:
CancelOrder
Deletes the previously placed pending order with the specified identifier from the system, and returns true. Returns false if the order cannot be deleted.
Syntax
Parameters
CancelOrderByAccount
Deletes the previously placed pending order in the specified account from the system, and returns true. Returns false if the orders cannot be deleted.
Syntax
Parameters
CancelOrderBySymbol
Deletes the previously placed pending order for the specified symbol in the specified account from the system, and returns true. Returns false if the orders cannot be deleted.
Syntax
Parameters
ChangeOrder
Modifies the previously placed pending order parameters, and returns true. Returns false if the order cannot be changed.
Syntax
|
bool ChangeOrder( string orderNumber, int newPrice) bool ChangeOrder( string orderNumber, double newPrice) bool ChangeOrder( string orderNumber, int amount, double newPrice) bool ChangeOrder( string orderNumber, double amount, double newPrice) bool ChangeOrder( string orderNumber, int amount, int tif, double newPrice) bool ChangeOrder( string orderNumber, double amount, int tif, double newPrice) bool ChangeOrder( string orderNumber, int amount, int tif, double newPrice, double stoploss, double takeprofit) bool ChangeOrder( string orderNumber, double amount, int tif, double newPrice, double stoploss, double takeprofit) bool ChangeOrder( string orderNumber, double amount, int dispQty, int orderType, int tif, double newPrice, double stopPrice) |
Parameters
ChangeSLTP
Modifies stoploss and takeprofit for an order or a position.
Syntax
|
bool ChangeSLTP( string orderNumber, double stoploss, double takeprofit) |
Parameters
ClosePosition
Close existed position(s), and returns true. Returns false if the positions cannot be closed.
Syntax
|
bool ClosePositions( string stringId) bool ClosePositions( string stringId, double lots) bool ClosePositions( string account, string symbol) bool ClosePositions( string account, string symbol, int part) |
Parameters
ClosePositionMutual
Closes open mutual positions and returns true. Returns false if the positions cannot be closed.
Syntax
Parameters
LastTime
Returns last quotes' time for main symbol.
Syntax
|
datetime LastTime() |
Parameters
none
OpenOrder
Opens an order.
Syntax
|
string OpenOrder( int buysell) string OpenOrder( int orderType, int buysell, double price) string OpenOrder( string symbol, int orderType,double price, int buysell) string OpenOrder( string symbol, int orderType, double price, int buysell, double quoty) string OpenOrder( string symbol, int orderType, double price, int buysell, int quoty) string OpenOrder( string symbol, int orderType, double price, int buysell, double quoty, int validTo) string OpenOrder( string symbol, int orderType, double price, int buysell, double quoty, double stoploss, double takeprofit) string OpenOrder( string symbol, int orderType, double price, int buysell, double quoty, int validTo, double stoploss, double takeprofit) string OpenOrder( string symbol, int orderType, double price, int buysell, double quoty, double stoploss, double takeprofit, double trailStop) string OpenOrder( string symbol, int orderType, double price, int buysell, string account, double quoty, int validTo, double stoploss, double takeprofit) string OpenOrder( string symbol, int orderType, double price, int buysell, string account, string route, double quoty, int validTo, double stoploss, double takeprofit) |
OpenOrderMarket
Opens a market order. Return true when success
Syntax
|
bool OpenOrderMarket( string symbol, int buysell, string account, string route, double quoty, int validTo, bool OpenOrderMarket( string symbol, int buysell, string account, string route, double quoty, int validTo, |
Parameters
OpenOrderLimit
Opens a limit order. Return true when success
Syntax
|
bool OpenOrderLimit( string symbol, int buysell, string account, string route, double quoty, int validTo, int type, double stopPrice, double trailOffset) bool OpenOrderLimit( string symbol, int buysell, string account, string route, double quoty, int validTo, int type, double stopPrice, double trailOffset, , datetime activateTime) |
Parameters
OpenOrderStopLimit
Opens a stop limit order. Return true when success
Syntax
|
bool OpenOrderStopLimit( string symbol, int buysell, string account, string route, double quoty, int validTo, double price, double stopPrice, double trailOffset) bool OpenOrderStopLimit( string symbol, int buysell, string account, string route, double quoty, int validTo, double price, double stopPrice, double trailOffset, datetime activateTime) |
Parameters
OrderClose
Closes the open order and returns true. Returns false if the order cannot be closed.
Syntax
|
bool OrderClose( int ticket, double lots, double price, int slippage, color Color = CLR_NONE) |
Parameters
OrderCloseBy
Closes the open order with another opposite order and returns true. Returns false if the order cannot be closed.
Syntax
|
bool CloseOrderBy( int ticket, int opposite, color Color = CLR_NONE) |
Parameters
OrderClosePrice
Returns the close price for the order currently selected with OrderSelect().
Syntax
|
double OrderOrderPrice() |
OrderCloseTime
Returns the close time for the order currently selected with OrderSelect(). For open and pending orders, 0 is returned.
Syntax
|
datetime OrderCloseTime() |
OrderComment
Returns the comment for the order currently selected with OrderSelect().
Syntax
|
string OrderComment() |
OrderCommission
Returns the commission for the order currently selected with OrderSelect().
Syntax
|
double OrderCommision() |
OrderDelete
Deletes the previously open order from the system and returns true. Returns false if the order cannot be deleted.
Syntax
Parameters
OrderExpiration
Returns the expiration date for the pending order currently selected with OrderSelect().
Syntax
|
datetime OrderExpiration() |
OrderModify
Modifies the previously placed pending order parameters, and returns true. Returns false if the order cannot be modified.
Syntax
|
bool OrderModify( int ticket, double price, double stoploss, double takeprofit, |
Parameters
OrderOpenPrice
Returns the open price for the order currently selected with OrderSelect().
Syntax
|
double OrderOpenPrice() |
OrderOpenTime
Returns the open time for the order currently selected with OrderSelect().
Syntax
|
datetime OrderOpenTime() |
OrderPrint
Prints the details of the order currently selected with OrderSelect().
Syntax
| void OrderPrint() |
OrderProfit
Returns the net profit amount for the order currently selected with OrderSelect(). For open positions, returns the current unrealized profit.
Syntax
|
double OrderProfit() |
Selects an order for further processing. Returns false if the matching order is not found.
Syntax
|
bool OrderSelect( int index, int select, int pool = MODE_TRADES) |
Parameters
OrderSend
Places a market order (i.e. opens a position) or a pending order.
Syntax
|
int OrderSend( string symbol, int buysell, int ordertype, int tif, double amount, double price, double stoploss, double takeprofit, string comment, string account, |
Parameters
OrderSend
Places a market order (i.e. opens a position) or a pending order.
Syntax
|
int OrderSend( string symbol, int buysell, int ordertype, int tif, double amount, double price, |
Parameters
OrdersHistoryTotal
Returns the number of closed orders in the account history.
Syntax
|
int OrdersHistoryTotal() |
OrderStopLoss
Returns the stop loss price set for the order currently selected with OrderSelect().
Syntax
|
double OrderStopLoss() |
OrdersTotal
Returns the total number of active orders, i.e. open positions and pending orders..
Syntax
|
int OrdersTotal() |
OrderSwap
Returns the swap value for the order currently selected with OrderSelect().
Syntax
|
double OrderSwap() |
OrderSymbol
Returns the symbol of the order currently selected with OrderSelect().
Syntax
|
string OrderSymbol() |
OrderTakeProfit
Returns the take profit price set for the order currently selected with OrderSelect().
Syntax
|
double OrderTakeProfit() |
OrderTicket
Returns ticket number of the order currently selected with OrderSelect().
Syntax
|
int OrderTicket() |
OrderType
Returns operation type of order currently selected with OrderSelect():
Syntax
|
int OrderType() |