Beispiel #1
0
        public static bool ParseResult(this string inputString, char separator, out MqlTradeCheckResult result)
        {
            var retVal = false;

            result = null;

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

                        var retcode     = uint.Parse(values[1]);
                        var balance     = double.Parse(values[2]);
                        var equity      = double.Parse(values[3]);
                        var profit      = double.Parse(values[4]);
                        var margin      = double.Parse(values[5]);
                        var marginFree  = double.Parse(values[6]);
                        var marginLevel = double.Parse(values[7]);
                        var comment     = values[8];

                        result = new MqlTradeCheckResult(retcode, balance, equity, profit, margin, marginFree, marginLevel, comment);
                    }
                    catch (Exception)
                    {
                        retVal = false;
                    }
                }
            }

            return(retVal);
        }
Beispiel #2
0
        public static bool ParseResult(this string inputString, char separator, out MqlTradeCheckResult result)
        {
            bool retVal = false;
            result = null;

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

                        uint retcode = uint.Parse(values[1]);
                        double balance = double.Parse(values[2]);
                        double equity = double.Parse(values[3]);
                        double profit = double.Parse(values[4]);
                        double margin = double.Parse(values[5]);
                        double margin_free = double.Parse(values[6]);
                        double margin_level = double.Parse(values[7]);
                        string comment = values[8];

                        result = new MqlTradeCheckResult(retcode, balance, equity, profit, margin, margin_free, margin_level, comment);
                    }
                    catch (Exception)
                    {
                        retVal = false;
                    }
                }
            }

            return retVal;
        }