From 992ba2a713bfce78e347cc6a8e60b4f256f3eaa3 Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Sat, 8 Aug 2020 02:13:22 +0900 Subject: [PATCH] removed formula parsing --- Core/ProfitTrailer/StrategyHelper.cs | 36 ++++------------------------ 1 file changed, 5 insertions(+), 31 deletions(-) diff --git a/Core/ProfitTrailer/StrategyHelper.cs b/Core/ProfitTrailer/StrategyHelper.cs index 4b7a363..3a7442c 100644 --- a/Core/ProfitTrailer/StrategyHelper.cs +++ b/Core/ProfitTrailer/StrategyHelper.cs @@ -219,7 +219,6 @@ namespace Core.ProfitTrailer string strategyNameOnly = strategyName; // PT allows for "advanced_stats" to be turned on in the application settings, to show details of the trailing logic. - // This code ensures PTM doesn't generate an unnecessary shortcut for this information if (result.Contains("STATS")) { result = ""; @@ -592,7 +591,6 @@ namespace Core.ProfitTrailer isValidStrategy = StrategyHelper.IsValidStrategy(strategy.Name); if (!isValidStrategy) { - if (strategy.Name.Contains("TRIGGERED")) // remove levels already triggered, to show only currently waiting trigger { @@ -609,37 +607,13 @@ namespace Core.ProfitTrailer if (strategy.Name.Contains("LEVEL")) // level X { - string level = strategy.Name.Substring(5, 2); - string expression = strategy.Name.Remove(0, 17); - expression = expression.Replace("", "true").Replace("", "false").Replace("", "").Replace("&&", "and").Replace("||", "or"); - expression = regx.Replace(expression, String.Empty); - var tokens = new Tokenizer(expression).Tokenize(); - var parser = new Parser(tokens); - if (parser.Parse()) - { - strategyText += "L " + level + " "; - } - else - { - strategyText += "L " + level + " "; - } + string level = strategy.Name.Substring(5, 1); + strategyText += "L " + level + " "; } else // standard formula { - string expression = strategy.Name.Remove(0, 10); - expression = expression.Replace("", "true").Replace("", "false").Replace("", "").Replace("&&", "and").Replace("||", "or"); - expression = regx.Replace(expression, String.Empty); - var tokens = new Tokenizer(expression).Tokenize(); - var parser = new Parser(tokens); - if (parser.Parse()) - { - strategyText += "FORM "; - } - else - { - strategyText += "FORM "; - } + strategyText += "FORM "; } } else @@ -663,7 +637,7 @@ namespace Core.ProfitTrailer { if (isTrue) { - strategyText = "" + StrategyHelper.GetStrategyShortcut(strategyText, true) + ""; + strategyText = "" + StrategyHelper.GetStrategyShortcut(strategyText, true) + " "; if (isTrailingBuyActive) { @@ -675,7 +649,7 @@ namespace Core.ProfitTrailer isValidStrategy = StrategyHelper.IsValidStrategy(strategyText); if (isValidStrategy) { - strategyText = "" + StrategyHelper.GetStrategyShortcut(strategyText, true) + ""; + strategyText = "" + StrategyHelper.GetStrategyShortcut(strategyText, true) + " "; } else if (strategyText.Equals("") && isValidStrategy == false) {