Forex_Strategy_Builder.Strategy.StrategySlotsHTMLReport C# (CSharp) Method

StrategySlotsHTMLReport() private method

Generates a HTML report about the strategy slots
private StrategySlotsHTMLReport ( ) : StringBuilder
return StringBuilder
        StringBuilder StrategySlotsHTMLReport()
        {
            StringBuilder sb = new StringBuilder();

            // Strategy Properties
            string sameDir = Language.T(Data.Strategy.SameSignalAction.ToString());
            string oppDir  = Language.T(Data.Strategy.OppSignalAction.ToString());
            string permaSL = Data.Strategy.UsePermanentSL ? (Data.Strategy.PermanentSLType == PermanentProtectionType.Absolute ? "(Abs) " : "") + Data.Strategy.PermanentSL.ToString() : Language.T("None");
            string permaTP = Data.Strategy.UsePermanentTP ? (Data.Strategy.PermanentTPType == PermanentProtectionType.Absolute ? "(Abs) " : "") + Data.Strategy.PermanentTP.ToString() : Language.T("None");
            sb.AppendLine("<div class=\"fsb_strategy_slot\" style=\"border: solid 2px #966\">");
            sb.AppendLine("\t<div class=\"fsb_properties_slot\">" + Language.T("Strategy Properties") + "</div>");
            sb.AppendLine("\t<table style=\"margin-left: auto; margin-right: auto;\">");
            sb.AppendLine("\t\t<tr><td>" + Language.T("Same direction signal")     + "</td><td> - " + sameDir + "</td></tr>");
            sb.AppendLine("\t\t<tr><td>" + Language.T("Opposite direction signal") + "</td><td> - " + oppDir  + "</td></tr>");
            sb.AppendLine("\t\t<tr><td>" + Language.T("Permanent Stop Loss")       + "</td><td> - " + permaSL + "</td></tr>");
            sb.AppendLine("\t\t<tr><td>" + Language.T("Permanent Take Profit")     + "</td><td> - " + permaTP + "</td></tr>");
            sb.AppendLine("\t</table>");
            sb.AppendLine("</div>");

            // Add the slots
            for (int slot = 0; slot < Data.Strategy.Slots; slot++)
            {
                IndicatorSlot indSlot = Slot[slot];
                string slotType = "";
                switch (indSlot.SlotType)
                {
                    case SlotTypes.Open:
                        sb.AppendLine("<div class=\"fsb_strategy_slot\" style=\"border: solid 2px #693\">");
                        slotType = "\t<div class=\"fsb_open_slot\">" + Language.T("Opening Point of the Position") + "</div>";
                        break;
                    case SlotTypes.OpenFilter:
                        sb.AppendLine("<div class=\"fsb_strategy_slot\" style=\"border: solid 2px #699\">");
                        slotType = "\t<div class=\"fsb_open_filter_slot\">" + Language.T("Opening Logic Condition") + "</div>";
                        break;
                    case SlotTypes.Close:
                        sb.AppendLine("<div class=\"fsb_strategy_slot\" style=\"border: solid 2px #d63\">");
                        slotType = "\t<div class=\"fsb_close_slot\">" + Language.T("Closing Point of the Position") + "</div>";
                        break;
                    case SlotTypes.CloseFilter:
                        sb.AppendLine("<div class=\"fsb_strategy_slot\" style=\"border: solid 2px #d99\">");
                        slotType = "\t<div class=\"fsb_close_filter_slot\">" + Language.T("Closing Logic Condition") + "</div>";
                        break;
                    default:
                        break;
                }

                sb.AppendLine(slotType);
                sb.AppendLine("\t<div class=\"fsb_str_indicator\">" + indSlot.IndicatorName + "</div>");

                // Add the logic
                foreach (ListParam listParam in indSlot.IndParam.ListParam)
                    if (listParam.Enabled && listParam.Caption == "Logic")
                        sb.AppendLine("\t<div class=\"fsb_str_logic\">" +
                            (Configs.UseLogicalGroups && (indSlot.SlotType == SlotTypes.OpenFilter || indSlot.SlotType == SlotTypes.CloseFilter) ?
                            "<span style=\"float: left; margin-left: 5px; margin-right: -25px\">" + "[" + indSlot.LogicalGroup + "]" + "</span>" : "") +
                            listParam.Text + "</div>");

                // Adds the parameters
                StringBuilder sbParams = new StringBuilder();

                // Add the list params
                foreach (ListParam listParam in indSlot.IndParam.ListParam)
                    if (listParam.Enabled && listParam.Caption != "Logic")
                        sbParams.AppendLine("\t\t<tr><td>" + listParam.Caption + "</td><td> - " + listParam.Text + "</td></tr>");

                // Add the num params
                foreach (NumericParam numParam in indSlot.IndParam.NumParam)
                    if (numParam.Enabled)
                        sbParams.AppendLine("\t\t<tr><td>" + numParam.Caption + "</td><td> - " + numParam.ValueToString + "</td></tr>");

                // Add the check params
                foreach (CheckParam checkParam in indSlot.IndParam.CheckParam)
                    if (checkParam.Enabled)
                        sbParams.AppendLine("\t\t<tr><td>" + checkParam.Caption + "</td><td> - " + (checkParam.Checked ? "Yes" : "No") + "</td></tr>");

                // Adds the params if there are any
                if (sbParams.Length > 0)
                {
                    sb.AppendLine("\t<table style=\"margin-left: auto; margin-right: auto;\">");
                    sb.AppendLine(sbParams.ToString());
                    sb.AppendLine("\t</table>");
                }

                sb.AppendLine("</div>");
            }

            return sb;
        }