Пример #1
0
        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);
        }
Пример #2
0
        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();
        }
Пример #3
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();
 }
Пример #4
0
 internal SymbolMarketInfo(SDParser p)
 {
     Bid = p.popDouble();
     Ask = p.popDouble();
 }