Пример #1
0
        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());
        }
Пример #2
0
 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();
 }
Пример #3
0
        //

        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();
            }
        }