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)); }
public static IAlgo CreateAlgo(AlgoType algoType, int?start = null, double?value = null) { IAlgoFactory factory = null; if (!Factories.ContainsKey(algoType)) { throw new Exception("Invalid algo type"); } switch (algoType) { case AlgoType.Constant: Factories.TryGetValue(AlgoType.Constant, out factory); break; case AlgoType.Increment: Factories.TryGetValue(AlgoType.Increment, out factory); break; case AlgoType.Multiple: Factories.TryGetValue(AlgoType.Multiple, out factory); break; case AlgoType.Exp: Factories.TryGetValue(AlgoType.Exp, out factory); break; case AlgoType.Fibonacci: Factories.TryGetValue(AlgoType.Fibonacci, out factory); break; } try { IAlgo algo = null; if (value.HasValue) { algo = factory.CreateAlgo(start.Value, value.Value); } else if (start.HasValue) { algo = factory.CreateAlgo(start.Value); } else { algo = factory.CreateAlgo(); } return(algo); } catch { throw new Exception($"Invalid parameters for algo type: {algoType.ToString()}"); } }
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); }