Method OrderSend
- Namespace
- ViiSync.AccountApi
- Assembly
- ViiSync.AccountApi.dll
OrderSend(string, double, double, OrderType, double, double, ulong, string?, long, FillPolicy, TradeType, double, Expiration?, long, PlacedType)
Open a market position or place a pending order (MT5 OrderSend, same parameters).
price: ignored for market orders (ViiSync fills at the live quote); the order price for Limit/Stop; the STOP (activation) price for StopLimit, whose limit price isstoplimit.deviation: max slippage in points (recorded on the order).expertID: magic number.comment: order/position comment.expiration: pending-order time in force (GTC / Today / Specified / SpecifiedDay).closeByTicketwithtype == OrderType.CloseByis not an OrderSend in ViiSync — use OrderCloseBy(long, long) or OrderClose(long, string, double, double, OrderType, ulong, FillPolicy, long, string?, long, PlacedType) with closeByTicket.
Returns the opened position (market) or the working order (pending). Throws ServerException with an MT5 return code (NO_MONEY, INVALID_VOLUME, MARKET_CLOSED, NO_PRICES, …) when refused.
public Order OrderSend(string symbol, double lots, double price, OrderType type, double sl = 0, double tp = 0, ulong deviation = 0, string? comment = null, long expertID = 0, FillPolicy fillPolicy = FillPolicy.Any, TradeType tradeType = TradeType.Transfer, double stoplimit = 0, Expiration? expiration = null, long closeByTicket = 0, PlacedType placedType = PlacedType.Manually)
Parameters
symbolstringlotsdoublepricedoubletypeOrderTypesldoubletpdoubledeviationulongcommentstringexpertIDlongfillPolicyFillPolicytradeTypeTradeTypestoplimitdoubleexpirationExpirationcloseByTicketlongplacedTypePlacedType
Returns
Remarks
MT5 equivalent
MT5API.OrderSend(string symbol, double lots, double price, OrderType type, double sl = 0, double tp = 0, ulong deviation = 0, string comment = null, long expertID = 0, FillPolicy fillPolicy = Any, TradeType tradeType = Transfer, double stoplimit = 0, Expiration expiration = null, long closeByTicket = 0, PlacedType placedType = Manually)— full