Ejemplo n.º 1
0
        private static string GetMq4Name(string mq4Code, AlgoType algoType)
        {
            var match = Mq4NameRegex.Match(mq4Code);

            if (!match.Success)
            {
                return("Converted" + algoType.ToString());
            }

            return(AlgoNameProvider.GetSimplifiedName(match.Groups["name"].Value, algoType));
        }
Ejemplo n.º 2
0
        public static string AddTypeParameterToICustom(this string code, out string[] customIndicators)
        {
            var resultIndicators = new List <string>();

            var methodCalls = MethodCallsParser.Parse(code)
                              .Where(mc => mc.MethodName == "iCustom")
                              .ToArray();

            foreach (var methodCall in methodCalls)
            {
                var nameParameter  = methodCall.Parameters[2];
                var simplifiedName = AlgoNameProvider.GetSimplifiedName(nameParameter, AlgoType.Indicator);

                var stringToReplace = methodCall.OriginalText.Replace("iCustom", string.Format("iCustom<{0}>", simplifiedName));
                code = code.Replace(methodCall.OriginalText, stringToReplace);
                resultIndicators.Add(simplifiedName);
            }

            customIndicators = resultIndicators.Distinct().ToArray();
            return(code);
        }