Exemplo n.º 1
0
        public static bool ParseResult(this string inputString, char separator, out DateTime from, out DateTime to)
        {
            var retVal = false;

            from = new DateTime();
            to   = new DateTime();

            if (string.IsNullOrEmpty(inputString) == false)
            {
                var values = inputString.Split(separator);
                if (values.Length == 3)
                {
                    try
                    {
                        retVal = int.Parse(values[0]) != 0;

                        var iFrom = int.Parse(values[1]);
                        from = Mt5TimeConverter.ConvertFromMtTime(iFrom);

                        var iTo = int.Parse(values[2]);
                        to = Mt5TimeConverter.ConvertFromMtTime(iTo);
                    }
                    catch (Exception)
                    {
                        retVal = false;
                    }
                }
            }

            return(retVal);
        }
Exemplo n.º 2
0
 public MqlTick(DateTime time, double bid, double ask, double last, ulong volume)
 {
     MtTime      = Mt5TimeConverter.ConvertToMtTime(time);
     this.bid    = bid;
     this.ask    = ask;
     this.last   = last;
     this.volume = volume;
 }
Exemplo n.º 3
0
 public MqlRates(DateTime time, double open, double high, double low, double close, long tick_volume, int spread, long real_volume)
 {
     mt_time          = Mt5TimeConverter.ConvertToMtTime(time);
     this.open        = open;
     this.high        = high;
     this.low         = low;
     this.close       = close;
     this.tick_volume = tick_volume;
     this.spread      = spread;
     this.real_volume = real_volume;
 }
Exemplo n.º 4
0
        public static ArrayList ToArrayList(this MqlTradeRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException();
            }

            var exp = Mt5TimeConverter.ConvertToMtTime(request.Expiration);

            return(new ArrayList {
                (int)request.Action, request.Magic, request.Order, request.Symbol, request.Volume
                , request.Price, request.Stoplimit, request.Sl, request.Tp, request.Deviation, (int)request.Type
                , (int)request.Type_filling, (int)request.Type_time, exp, request.Comment
            });
        }
Exemplo n.º 5
0
        public static bool ParseResult(this string inputString, char separator, out DateTime from, out DateTime to)
        {
            Log.Debug($"ParseResult: inputString = {inputString}, separator = {separator}");

            var retVal = false;

            from = new DateTime();
            to   = new DateTime();

            if (string.IsNullOrEmpty(inputString) == false)
            {
                var values = inputString.Split(separator);
                if (values.Length == 3)
                {
                    try
                    {
                        retVal = int.Parse(values[0]) != 0;

                        var iFrom = int.Parse(values[1]);
                        from = Mt5TimeConverter.ConvertFromMtTime(iFrom);

                        var iTo = int.Parse(values[2]);
                        to = Mt5TimeConverter.ConvertFromMtTime(iTo);
                    }
                    catch (Exception ex)
                    {
                        retVal = false;
                        Log.Error($"ParseResult: {ex.Message}");
                    }
                }
            }
            else
            {
                Log.Warn("ParseResult: input srting is null or empty!");
            }

            return(retVal);
        }