internal AccountInfo(MT4 conn, String data) { _conn = conn; // var p = new SDParser(data, '|'); // Login = p.popLong(); TradeMode = ((AccountTradeMode[])Enum.GetValues(typeof(AccountTradeMode)))[p.popInt()]; Leverage = p.popLong(); LimitOrders = p.popInt(); StopOutMode = ((StopOutMode[])Enum.GetValues(typeof(StopOutMode)))[p.popInt()]; IsTradeAllowed = p.popBoolean(); IsTradeExpert = p.popBoolean(); // Name = p.pop(); Server = p.pop(); Currency = p.pop(); Company = p.pop(); // Balance = p.popDouble(); Credit = p.popDouble(); Profit = p.popDouble(); Equity = p.popDouble(); Margin = p.popDouble(); FreeMargin = p.popDouble(); MarginLevel = p.popDouble(); MarginSoCall = p.popDouble(); MarginSoLevel = p.popDouble(); }
public PositionImpl(string positionEncoded, MT4 utils) { var bp = new DDParser(positionEncoded, MT4.ArgStartC, MT4.ArgEndC); var p = new SDParser(bp.pop(), '|'); _tCount = int.Parse(p.pop(), CultureInfo.InvariantCulture); _hCount = int.Parse(p.pop(), CultureInfo.InvariantCulture); _str = AsString(); // var sz = int.Parse(bp.pop(), CultureInfo.InvariantCulture); LiveOrders = new Dictionary <long, IOrderInfo>((int)(sz * 1.2)); for (var i = 0; i < sz; i++) { var oi = new OrderImpl(bp.pop(), utils); LiveOrders.Add(oi.TicketNumber, oi); } sz = int.Parse(bp.pop(), CultureInfo.InvariantCulture); HistoricalOrders = new Dictionary <long, IOrderInfo>((int)(sz * 1.2)); for (var i = 0; i < sz; i++) { var oi = new OrderImpl(bp.pop(), utils); HistoricalOrders.Add(oi.TicketNumber, oi); } }
internal static List <Rate> Decode(string ratesEncoded, MT4 utils, out double bid, out double ask) { var bp = new DDParser(ratesEncoded, MT4.ArgStartC, MT4.ArgEndC); var sz = int.Parse(bp.pop(), CultureInfo.InvariantCulture); var rates = new List <Rate>(sz); for (var i = 0; i < sz; i++) { var oi = new Rate(bp.pop(), utils); rates.Add(oi); } var tail = bp.tail(); if (string.IsNullOrEmpty(tail)) { bid = ask = 0; } else { var p = new SDParser(tail, '|'); bid = p.popDouble(); ask = p.popDouble(); } return(rates); }
internal Rate(string encodedRate, MT4 utils) { var p = new SDParser(encodedRate, '|'); Time = utils.ToDate(int.Parse(p.pop(), CultureInfo.InvariantCulture)); Open = double.Parse(p.pop(), CultureInfo.InvariantCulture); High = double.Parse(p.pop(), CultureInfo.InvariantCulture); Low = double.Parse(p.pop(), CultureInfo.InvariantCulture); Close = double.Parse(p.pop(), CultureInfo.InvariantCulture); TickVolume = long.Parse(p.pop()); Spread = int.Parse(p.pop(), CultureInfo.InvariantCulture); RealVolume = long.Parse(p.pop()); }
internal SymbolInfo(MT4 conn, SDParser p) { // IsSelected = p.popBoolean(); IsFloatingSpread = p.popBoolean(); // SessionDeals = p.popLong(); SessionBuyOrders = p.popLong(); SessionSellOrders = p.popLong(); Volume = p.popLong(); VolumeHigh = p.popLong(); VolumeLow = p.popLong(); // Digits = p.popInt(); Spread = p.popInt(); StopsLevel = p.popInt(); FreezeLevel = p.popInt(); // ContractPriceCalculationMode = ((PriceCalculationMode[])Enum.GetValues(typeof(PriceCalculationMode)))[p.popInt()]; TradeMode = ((TradeMode[])Enum.GetValues(typeof(TradeMode)))[p.popInt()]; SwapMode = ((SwapMode[])Enum.GetValues(typeof(SwapMode)))[p.popInt()]; SwapRollover3Days = ((DayOfWeek[])Enum.GetValues(typeof(DayOfWeek)))[p.popInt()]; TradeExecutionMode = ((TradeExecutionMode[])Enum.GetValues(typeof(TradeExecutionMode)))[p.popInt()]; // Time = conn.ToDate(p.popDouble()); StartTime = conn.ToDate(p.popDouble()); ExpirationTime = conn.ToDate(p.popDouble()); // ExpirationModes = ExpirationModeValues(p.popInt()); FillingModes = FillingModeValues(p.popInt()); OrderModes = OrderModeValues(p.popInt()); // BaseCurrency = p.pop(); ProfitCurrency = p.pop(); MarginCurrency = p.pop(); Description = p.pop(); Path = p.pop(); // Bid = p.popDouble(); BidHigh = p.popDouble(); BidLow = p.popDouble(); Ask = p.popDouble(); AskHigh = p.popDouble(); AskLow = p.popDouble(); Last = p.popDouble(); LastHigh = p.popDouble(); LastLow = p.popDouble(); Point = p.popDouble(); TradeTickValue = p.popDouble(); TradeTickValueProfit = p.popDouble(); TradeTickValueLoss = p.popDouble(); TradeTickSize = p.popDouble(); TradeContractSize = p.popDouble(); MinVolume = p.popDouble(); MaxVolume = p.popDouble(); StepVolume = p.popDouble(); LimitVolume = p.popDouble(); LongSwap = p.popDouble(); ShortSwap = p.popDouble(); InitialMargin = p.popDouble(); MaintenanceMargin = p.popDouble(); LongMargin = p.popDouble(); ShortMargin = p.popDouble(); LimitMargin = p.popDouble(); StopMargin = p.popDouble(); StopLimitMargin = p.popDouble(); SessionVolume = p.popDouble(); SessionTurnover = p.popDouble(); SessionInterest = p.popDouble(); SessionBuyOrdersVolume = p.popDouble(); SessionSellOrdersVolume = p.popDouble(); SessionOpenPrice = p.popDouble(); SessionClosePrice = p.popDouble(); SessionAverageWeightedPrice = p.popDouble(); SessionSettlementPrice = p.popDouble(); SessionMinLimitPrice = p.popDouble(); SessionMaxLimitPrice = p.popDouble(); }
internal SymbolMarketInfo(SDParser p) { Bid = p.popDouble(); Ask = p.popDouble(); }
// public OrderImpl(String encodedOrderInfo, MT4 utils) { var p = new SDParser(encodedOrderInfo, '|'); if (p.peek().StartsWith("C")) { // order change info _diffBitMap = long.Parse(p.pop().Substring(1), CultureInfo.InvariantCulture); TicketNumber = long.Parse(p.pop(), CultureInfo.InvariantCulture); if (IsModified()) { if (IsTradeOperationChanged()) { Type = ((TradeOperation)int.Parse(p.pop(), CultureInfo.InvariantCulture)); } else { p.pop(); } if (IsOpenTimeChanged()) { OpenTime = utils.ToDate(int.Parse(p.pop(), CultureInfo.InvariantCulture)); } else { p.pop(); } if (IsCloseTimeChanged()) { CloseTime = utils.ToDate(int.Parse(p.pop(), CultureInfo.InvariantCulture)); } else { p.pop(); } if (IsExpirationTimeChanged()) { Expiration = utils.ToDate(int.Parse(p.pop(), CultureInfo.InvariantCulture)); } else { p.pop(); } if (IsLotsChanged()) { Lots = double.Parse(p.pop(), CultureInfo.InvariantCulture); } else { p.pop(); } if (IsOpenPriceChanged()) { OpenPrice = double.Parse(p.pop(), CultureInfo.InvariantCulture); } else { p.pop(); } if (IsClosePriceChanged()) { ClosePrice = double.Parse(p.pop(), CultureInfo.InvariantCulture); } else { p.pop(); } if (IsStopLossChanged()) { Sl = double.Parse(p.pop(), CultureInfo.InvariantCulture); } else { p.pop(); } if (IsTakeProfitChanged()) { Tp = double.Parse(p.pop(), CultureInfo.InvariantCulture); } else { p.pop(); } if (IsProfitChanged()) { Profit = double.Parse(p.pop(), CultureInfo.InvariantCulture); } else { p.pop(); } if (IsCommissionChanged()) { Commission = double.Parse(p.pop(), CultureInfo.InvariantCulture); } else { p.pop(); } if (IsSwapChanged()) { Swap = double.Parse(p.pop(), CultureInfo.InvariantCulture); } else { p.pop(); } if (IsCloseTimeChanged()) { string pop = p.pop(); Comment = pop ?? Comment; } else { p.pop(); } } } else { TicketNumber = long.Parse(p.pop()); Type = (TradeOperation)int.Parse(p.pop(), CultureInfo.InvariantCulture); OpenTime = utils.ToDate(int.Parse(p.pop(), CultureInfo.InvariantCulture)); CloseTime = utils.ToDate(int.Parse(p.pop(), CultureInfo.InvariantCulture)); Magic = int.Parse(p.pop(), CultureInfo.InvariantCulture); Expiration = utils.ToDate(int.Parse(p.pop(), CultureInfo.InvariantCulture)); Lots = double.Parse(p.pop(), CultureInfo.InvariantCulture); OpenPrice = double.Parse(p.pop(), CultureInfo.InvariantCulture); ClosePrice = double.Parse(p.pop(), CultureInfo.InvariantCulture); Sl = double.Parse(p.pop(), CultureInfo.InvariantCulture); Tp = double.Parse(p.pop(), CultureInfo.InvariantCulture); Profit = double.Parse(p.pop(), CultureInfo.InvariantCulture); Commission = double.Parse(p.pop(), CultureInfo.InvariantCulture); Swap = double.Parse(p.pop(), CultureInfo.InvariantCulture); Symbol = p.pop(); Comment = p.pop(); } }