internal TradeRecord(DataTrade dataTrade, FxOrder fxOrder) { this.DataTrade = dataTrade; this.OrderId = fxOrder.OrderId; this.ClientOrderId = fxOrder.ClientOrderId; this.Symbol = fxOrder.Symbol; this.Price = fxOrder.Price; this.StopLoss = fxOrder.StopLoss; this.TakeProfit = fxOrder.TakeProfit; this.InitialVolume = fxOrder.InitialVolume; this.Volume = fxOrder.Volume ?? 0; this.StopPrice = fxOrder.StopPrice; this.MaxVisibleVolume = fxOrder.MaxVisibleVolume; this.Commission = fxOrder.Commission; this.Swap = fxOrder.Swap; this.Profit = fxOrder.Profit; this.InitialType = (TradeRecordType)fxOrder.InitialType; this.Type = (TradeRecordType)fxOrder.Type; this.Side = fxOrder.Side; this.Comment = fxOrder.Comment; this.Tag = fxOrder.Tag; this.Magic = fxOrder.Magic; this.IsReducedOpenCommission = fxOrder.IsReducedOpenCommission; this.IsReducedCloseCommission = fxOrder.IsReducedCloseCommission; this.ImmediateOrCancel = fxOrder.ImmediateOrCancel; this.MarketWithSlippage = fxOrder.MarketWithSlippage; this.Expiration = fxOrder.Expiration; this.Created = fxOrder.Created; this.Modified = fxOrder.Modified; }
public FxOrder ModifyOrder(string operationId, string orderId, string clientId, string symbol, TradeRecordType type, TradeRecordSide side, double?newVolume, double?newMaxVisibleVolume, double?newPrice, double?newStopPrice, double?newStopLoss, double?newTakeProfit, DateTime?newExpiration, string newComment, string newTag, int?newMagic, double?prevVolume, bool?IOCOverride, bool?IFMOverride, int timeoutInMilliseconds) { if (operationId == null) { operationId = string.Empty; } if (orderId == null) { orderId = string.Empty; } if (clientId == null) { clientId = string.Empty; } if (newComment == null) { newComment = string.Empty; } else if (newComment == string.Empty) { newComment = "<empty>"; } if (newTag == null) { newTag = string.Empty; } else if (newTag == string.Empty) { newTag = "<empty>"; } this.VerifyInitialized(); this.Validate(nameof(newVolume), newVolume); this.Validate(nameof(newMaxVisibleVolume), newMaxVisibleVolume); this.Validate(nameof(newPrice), newPrice); this.Validate(nameof(newStopPrice), newStopPrice); this.Validate(nameof(newStopLoss), newStopLoss); this.Validate(nameof(newTakeProfit), newTakeProfit); this.Validate(nameof(prevVolume), prevVolume); var order = new FxOrder(orderId, clientId, symbol, (int)type, side, newVolume, newMaxVisibleVolume, newPrice, newStopPrice, newStopLoss, newTakeProfit, newExpiration, newComment, newTag, newMagic, prevVolume, IOCOverride, IFMOverride); return(Native.TradeServer.ModifyOrder(this.handle, operationId, order, (uint)timeoutInMilliseconds)); }
public FxOrder OpenNewOrder(string operationId, string symbol, TradeCommand command, TradeRecordSide side, double volume, double?maxVisibleVolume, double?price, double?stopPrice, double?stopLoss, double?takeProfit, DateTime?expiration, string comment, string tag, int?magic, int timeoutInMilliseconds) { if (operationId == null) { operationId = string.Empty; } this.VerifyInitialized(); this.Validate(nameof(volume), volume); this.Validate(nameof(maxVisibleVolume), maxVisibleVolume); this.Validate(nameof(price), price); this.Validate(nameof(stopPrice), stopPrice); this.Validate(nameof(stopLoss), stopLoss); this.Validate(nameof(takeProfit), takeProfit); var order = new FxOrder(symbol, (int)command, side, volume, maxVisibleVolume, price, stopPrice, stopLoss, takeProfit, expiration, comment, tag, magic); return(Native.TradeServer.OpenNewOrder(this.handle, operationId, order, (uint)timeoutInMilliseconds)); }