public class OrderClient
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
boolean |
IsDemoAccount |
Logger |
Log |
online.mtapi.mt4.MT4Symbol |
MT4Symbol |
Event<OrderProgressEventHandler> |
OnOrderProgress
Open/close progress of the order before ticket number assign.
|
QuoteClient |
QuoteClient |
boolean |
QuoteClientInitSymbols |
int |
TradeTimeout
How long to wait for trade execution, if TradeTimeoutException no reply from server.
|
int |
User
Account number.
|
| Constructor and Description |
|---|
OrderClient()
Initialize order client.
|
OrderClient(QuoteClient qc)
Main constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
onProgress(byte[] buf,
ProgressType type,
int RequestID,
java.lang.Exception exception) |
Order |
OrderClose(java.lang.String symbol,
int ticket,
double volume,
double price,
int slippage)
Close opened order.
|
int |
OrderCloseAsync(java.lang.String symbol,
int ticket,
double volume,
double price,
int slippage)
Close opened order without awiting reply from server.
|
void |
OrderCloseBy(java.lang.String symbol,
int ticket1,
int ticket2)
Close of pair of opposite open orders.
|
int |
OrderCloseByAsync(java.lang.String symbol,
int ticket1,
int ticket2)
Close of pair of opposite open orders without awiting reply from server.
|
void |
OrderDelete(int ticket,
Op type,
java.lang.String symbol,
double volume,
double price)
Delete pending order.
|
int |
OrderDeleteAsync(int ticket,
Op type,
java.lang.String symbol,
double volume,
double price)
Delete pending order without awiting reply from server.
|
Order |
OrderModify(Op type,
int ticket,
double price,
double stoploss,
double takeprofit,
java.time.LocalDateTime expiration)
Modification of previously opened position or pending orders.
|
int |
OrderModifyAsync(Op type,
int ticket,
double price,
double stoploss,
double takeprofit,
java.time.LocalDateTime expiration)
Modification of characteristics for the previously opened position or pending orders without awiting reply from server.
|
void |
OrderMultipleCloseBy(java.lang.String symbol)
Close of multiple open orders.
|
int |
OrderMultipleCloseByAsync(java.lang.String symbol)
Close of multiple open orders without awiting reply from server.
|
Order |
OrderSend(java.lang.String symbol,
Op operation,
double volume,
double price,
int slippage,
double stoploss,
double takeprofit)
The main function used to open a position or place a pending order.
|
Order |
OrderSend(java.lang.String symbol,
Op operation,
double volume,
double price,
int slippage,
double stoploss,
double takeprofit,
java.lang.String comment,
int magic,
java.time.LocalDateTime expiration)
The main function used to open a position or place a pending order.
|
int |
OrderSendAsync(java.lang.String symbol,
Op operation,
double volume,
double price,
int slippage,
double stoploss,
double takeprofit)
Send order without awiting reply from server.
|
int |
OrderSendAsync(java.lang.String symbol,
Op operation,
double volume,
double price,
int slippage,
double stoploss,
double takeprofit,
java.lang.String comment,
int magic,
java.time.LocalDateTime expiration)
Send order without awiting reply from server.
|
public Event<OrderProgressEventHandler> OnOrderProgress
public int TradeTimeout
public Logger Log
public int User
public online.mtapi.mt4.MT4Symbol MT4Symbol
public boolean QuoteClientInitSymbols
public boolean IsDemoAccount
public QuoteClient QuoteClient
public OrderClient()
public OrderClient(QuoteClient qc)
qc - Quote client.public Order OrderModify(Op type, int ticket, double price, double stoploss, double takeprofit, java.time.LocalDateTime expiration) throws TimeoutException
type - Operation type.ticket - Unique number of the order ticket.price - Price value.stoploss - Stop loss level.takeprofit - Take profit level.expiration - Expiration time.TradeContextBusyException - All trade connections are busy.TimeoutException - No reply from server in TradeTimeout milliseconds.public int OrderModifyAsync(Op type, int ticket, double price, double stoploss, double takeprofit, java.time.LocalDateTime expiration)
type - Operation type.ticket - Unique number of the order ticket.price - Price value.stoploss - Stop loss level.takeprofit - Take profit level.expiration - Expiration time.TradeContextBusyException - All trade connections are busy.public Order OrderClose(java.lang.String symbol, int ticket, double volume, double price, int slippage) throws TimeoutException
symbol - Symbol for trading.ticket - Unique number of the order ticket.volume - Number of lots.price - Preferred closing price.slippage - Value of the maximum price slippage in points.TradeContextBusyException - All trade connections are busy.ServerException - Check exception message for details.TimeoutException - No reply from server in TradeTimeout milliseconds.public int OrderCloseAsync(java.lang.String symbol,
int ticket,
double volume,
double price,
int slippage)
symbol - Symbol for trading.ticket - Unique number of the order ticket.volume - Number of lots.price - Preferred closing price.slippage - Value of the maximum price slippage in points.TradeContextBusyException - All trade connections are busy.public void OrderCloseBy(java.lang.String symbol,
int ticket1,
int ticket2)
throws TimeoutException,
TradeContextBusyException
symbol - Symbol for trading.ticket1 - Unique number of the first order ticket.ticket2 - Unique number of the two order ticket.TradeContextBusyException - All trade connections are busy.ServerException - Check exception message for details.TimeoutException - No reply from server in TradeTimeout milliseconds.public int OrderCloseByAsync(java.lang.String symbol,
int ticket1,
int ticket2)
throws TradeContextBusyException
symbol - Symbol for trading.ticket1 - Unique number of the first order ticket.ticket2 - Unique number of the two order ticket.TradeContextBusyException - All trade connections are busy.ServerException - Check exception message for details.TimeoutException - No reply from server in TradeTimeout milliseconds.public void OrderMultipleCloseBy(java.lang.String symbol)
throws TimeoutException,
TradeContextBusyException
symbol - Symbol for trading.TradeContextBusyException - All trade connections are busy.ServerException - Check exception message for details.TimeoutException - No reply from server in TradeTimeout milliseconds.public int OrderMultipleCloseByAsync(java.lang.String symbol)
throws TradeContextBusyException
symbol - Symbol for trading.TradeContextBusyException - All trade connections are busy.ServerException - Check exception message for details.TimeoutException - No reply from server in TradeTimeout milliseconds.public void OrderDelete(int ticket,
Op type,
java.lang.String symbol,
double volume,
double price)
throws TimeoutException,
TradeContextBusyException
ticket - Unique number of the order ticket.type - Operation type.symbol - Symbol for trading.volume - Number of lots.price - Preferred deleting price.TradeContextBusyException - All trade connections are busy.TimeoutException - No reply from server in TradeTimeout milliseconds.public int OrderDeleteAsync(int ticket,
Op type,
java.lang.String symbol,
double volume,
double price)
throws TradeContextBusyException
ticket - Unique number of the order ticket.type - Operation type.symbol - Symbol for trading.volume - Number of lots.price - Preferred deleting price.TradeContextBusyException - All trade connections are busy.public Order OrderSend(java.lang.String symbol, Op operation, double volume, double price, int slippage, double stoploss, double takeprofit, java.lang.String comment, int magic, java.time.LocalDateTime expiration) throws TimeoutException, TradeContextBusyException
symbol - Symbol for trading.operation - Operation type.volume - Number of lots.price - Preferred price of the trade.slippage - Maximum price slippage for buy or sell order.stoploss - Stop loss level.takeprofit - Take profit level.comment - Order comment text. Last part of the comment may be changed by server.magic - Order magic number. May be used as user defined identifier.expiration - Order expiration time (for pending orders only).TradeContextBusyException - All trade connections are busy.ServerException - Check exception message for details.RequoteException - Server cannot execute order(instant execution) at specified price. Check exception fields for latest server price.TimeoutException - No reply from server in TradeTimeout milliseconds.public Order OrderSend(java.lang.String symbol, Op operation, double volume, double price, int slippage, double stoploss, double takeprofit) throws TimeoutException, TradeContextBusyException
symbol - Symbol for trading.operation - Operation type.volume - Number of lots.price - Preferred price of the trade.slippage - Maximum price slippage for buy or sell order.stoploss - Stop loss level.takeprofit - Take profit level.TradeContextBusyException - All trade connections are busy.ServerException - Check exception message for details.RequoteException - Server cannot execute order(instant execution) at specified price. Check exception fields for latest server price.TimeoutException - No reply from server in TradeTimeout milliseconds.public int OrderSendAsync(java.lang.String symbol,
Op operation,
double volume,
double price,
int slippage,
double stoploss,
double takeprofit)
throws TimeoutException,
TradeContextBusyException
symbol - Symbol for trading.operation - Operation type.volume - Number of lots.price - Preferred price of the trade.slippage - Maximum price slippage for buy or sell order.stoploss - Stop loss level.takeprofit - Take profit level.comment - Order comment text. Last part of the comment may be changed by server.magic - Order magic number. May be used as user defined identifier.expiration - Order expiration time (for pending orders only).TradeContextBusyException - All trade connections are busy.TimeoutExceptionpublic int OrderSendAsync(java.lang.String symbol,
Op operation,
double volume,
double price,
int slippage,
double stoploss,
double takeprofit,
java.lang.String comment,
int magic,
java.time.LocalDateTime expiration)
throws TradeContextBusyException
symbol - Symbol for trading.operation - Operation type.volume - Number of lots.price - Preferred price of the trade.slippage - Maximum price slippage for buy or sell order.stoploss - Stop loss level.takeprofit - Take profit level.comment - Order comment text. Last part of the comment may be changed by server.magic - Order magic number. May be used as user defined identifier.expiration - Order expiration time (for pending orders only).TradeContextBusyException - All trade connections are busy.public void onProgress(byte[] buf,
ProgressType type,
int RequestID,
java.lang.Exception exception)