public static string GetStrategyText(Summary summary, List <Strategy> strategies, string strategyText, bool isTrue, bool isTrailingBuyActive)
        {
            if (strategies.Count > 0)
            {
                foreach (Strategy strategy in strategies)
                {
                    string textClass = (strategy.IsTrue) ? "label-success" : "label-danger";
                    if (!StrategyHelper.IsValidStrategy(strategy.Name))
                    {
                        strategyText += "<span class=\"label label-warning\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"" + strategy.Name + "\">" + StrategyHelper.GetStrategyShortcut(strategy.Name, false) + "</span> ";
                    }
                    else
                    {
                        strategyText += "<span class=\"label " + textClass + "\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"" + strategy.Name + "\">" + StrategyHelper.GetStrategyShortcut(strategy.Name, false) + "</span> ";
                    }
                }

                if (isTrailingBuyActive)
                {
                    strategyText += " <i class=\"fa fa-flag text-success\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"Trailing active!\"></i>";
                }
            }
            else
            {
                if (isTrue)
                {
                    strategyText = "<span class=\"label label-success\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"" + strategyText + "\">" + StrategyHelper.GetStrategyShortcut(strategyText, true) + "</span>";

                    if (isTrailingBuyActive)
                    {
                        strategyText += " <i class=\"fa fa-flag text-success\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"Trailing active!\"></i>";
                    }
                }
                else
                {
                    if (StrategyHelper.IsValidStrategy(strategyText))
                    {
                        strategyText = "<span class=\"label label-danger\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"" + strategyText + "\">" + StrategyHelper.GetStrategyShortcut(strategyText, true) + "</span>";
                    }
                    else if (strategyText.Equals(""))
                    {
                        strategyText = summary.DCABuyStrategy;
                        strategyText = "<span class=\"label label-danger\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"" + strategyText + "\">" + StrategyHelper.GetStrategyShortcut(strategyText, true) + "</span>";
                    }
                    else
                    {
                        strategyText = "<span class=\"label label-warning\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"" + strategyText + "\">" + StrategyHelper.GetStrategyShortcut(strategyText, false) + "</span> ";
                    }
                }
            }

            return(strategyText);
        }
        public static string GetTriggerValueText(Summary summary, List <Strategy> strategies, string strategyText, double bbValue, double simpleValue, int buyLevel, bool includeShortcut)
        {
            string result = "";

            if (strategies.Count > 0)
            {
                foreach (Strategy strategy in strategies)
                {
                    if (StrategyHelper.IsValidStrategy(strategy.Name))
                    {
                        if (!result.Equals(""))
                        {
                            result += "<br />";
                        }

                        string decimalFormat = "";
                        int    decimals      = StrategyHelper.GetStrategyValueDecimals(strategy.Name);
                        for (int d = 1; d <= decimals; d++)
                        {
                            decimalFormat += "0";
                        }
                        if (includeShortcut)
                        {
                            result += "<span class=\"text-muted\">" + StrategyHelper.GetStrategyShortcut(strategy.Name, true) + "</span> ";
                        }
                        if (StrategyHelper.GetStrategyShortcut(strategy.Name, true).IndexOf("and", StringComparison.InvariantCultureIgnoreCase) > -1)
                        {
                            result += strategy.TriggerValue.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"));
                        }
                        else
                        {
                            if (decimals == 0)
                            {
                                if (!SystemHelper.IsInteger(strategy.EntryValue))
                                {
                                    result += strategy.EntryValue.ToString(new System.Globalization.CultureInfo("en-US"));
                                }
                                else
                                {
                                    result += strategy.EntryValue.ToString("#,#0", new System.Globalization.CultureInfo("en-US"));
                                }
                            }
                            else
                            {
                                result += strategy.EntryValue.ToString("#,#0." + decimalFormat, new System.Globalization.CultureInfo("en-US"));
                            }
                        }
                    }
                }
            }
            else
            {
                if (StrategyHelper.GetStrategyShortcut(strategyText, true).IndexOf("bb", StringComparison.InvariantCultureIgnoreCase) > -1)
                {
                    result = bbValue.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"));
                }
                else
                {
                    if (simpleValue == Constants.MinTrendChange)
                    {
                        if (summary.DCATriggers.ContainsKey(buyLevel + 1))
                        {
                            simpleValue = summary.DCATriggers[buyLevel + 1];
                        }
                    }
                    result = simpleValue.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) + "%";
                }
            }
            return(result);
        }
        public static string GetStrategyText(Summary summary, List <Strategy> strategies, string strategyText, bool isTrue, bool isTrailingBuyActive)
        {
            bool  isValidStrategy = false;
            Regex regx            = new Regex(@"[ABCDEFGHIJKLMNOPQRSTUVWXYZ]", RegexOptions.Compiled);

            if (strategies.Count > 0)
            {
                foreach (Strategy strategy in strategies)
                {
                    string textClass = (strategy.IsTrue) ? "label-success" : "label-danger";
                    isValidStrategy = StrategyHelper.IsValidStrategy(strategy.Name);
                    if (!isValidStrategy)
                    {
                        if (strategy.Name.Contains("TRIGGERED"))
                        // remove levels already triggered, to show only currently waiting trigger
                        {
                            strategyText += "";
                        }
                        else if (strategy.Name.Contains("STATS"))
                        // Avoid displaying advanced buy stats and completed level formulas
                        {
                            strategy.Name = "";
                        }
                        else if (strategy.Name.Contains("FORMULA"))
                        // Avoid displaying formula details
                        {
                            if (strategy.Name.Contains("LEVEL"))
                            {
                                string level = strategy.Name.Substring(5, 1);
                                strategyText += "<span class=\"label label-warning\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"LEVEL FORMULA\">L " + level + "</span> ";
                            }
                            else
                            {
                                strategyText += "<span class=\"label label-warning\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"CONDITIONAL FORMULA\">FORM</span> ";
                            }
                        }
                        else
                        {
                            strategyText += "<span class=\"label label-warning\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"" + strategy.Name + "\">" + StrategyHelper.GetStrategyShortcut(strategy.Name, false) + "</span> ";
                        }
                    }
                    else
                    {
                        strategyText += "<span class=\"label " + textClass + "\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"" + strategy.Name + "\">" + StrategyHelper.GetStrategyShortcut(strategy.Name, false) + "</span> ";
                    }
                }

                if (isTrailingBuyActive)
                {
                    strategyText += " <i class=\"fa fa-flag text-success\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"Trailing active!\"></i>";
                }
            }
            else
            {
                if (isTrue)
                {
                    strategyText = "<span class=\"label label-success\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"" + strategyText + "\">" + StrategyHelper.GetStrategyShortcut(strategyText, true) + "</span> ";

                    if (isTrailingBuyActive)
                    {
                        strategyText += " <i class=\"fa fa-flag text-success\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"Trailing active!\"></i>";
                    }
                }
                else
                {
                    isValidStrategy = StrategyHelper.IsValidStrategy(strategyText);
                    if (isValidStrategy)
                    {
                        strategyText = "<span class=\"label label-danger\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"" + strategyText + "\">" + StrategyHelper.GetStrategyShortcut(strategyText, true) + "</span> ";
                    }
                    else if (strategyText.Equals("") && isValidStrategy == false)
                    {
                        strategyText = "<span class=\"label label-muted\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"Not Applicable: Not using DCA!\"></span>";
                    }
                    else
                    {
                        strategyText = "<span class=\"label label-warning\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"" + strategyText + "\">" + StrategyHelper.GetStrategyShortcut(strategyText, false) + "</span> ";
                    }
                }
            }
            return(strategyText);
        }
 public static bool IsValidStrategy(string strategyName)
 {
     return(StrategyHelper.IsValidStrategy(strategyName, false));
 }