/// <summary>
        ///     Constructor
        /// </summary>
        public IndicatorDialog(int slotNumb, SlotTypes slotType, bool isSlotDefined)
        {
            slot     = slotNumb;
            SlotType = slotType;

            if (slotType == SlotTypes.Open)
            {
                slotTitle     = Language.T("Opening Point of the Position");
                PnlParameters = new FancyPanel(slotTitle, LayoutColors.ColorSlotCaptionBackOpen,
                                               LayoutColors.ColorSlotCaptionText);
                PnlTreeViewBase = new FancyPanel(Language.T("Indicators"), LayoutColors.ColorSlotCaptionBackOpen,
                                                 LayoutColors.ColorSlotCaptionText);
            }
            else if (slotType == SlotTypes.OpenFilter)
            {
                slotTitle     = Language.T("Opening Logic Condition");
                PnlParameters = new FancyPanel(slotTitle, LayoutColors.ColorSlotCaptionBackOpenFilter,
                                               LayoutColors.ColorSlotCaptionText);
                PnlTreeViewBase = new FancyPanel(Language.T("Indicators"), LayoutColors.ColorSlotCaptionBackOpenFilter,
                                                 LayoutColors.ColorSlotCaptionText);
            }
            else if (slotType == SlotTypes.Close)
            {
                slotTitle     = Language.T("Closing Point of the Position");
                PnlParameters = new FancyPanel(slotTitle, LayoutColors.ColorSlotCaptionBackClose,
                                               LayoutColors.ColorSlotCaptionText);
                PnlTreeViewBase = new FancyPanel(Language.T("Indicators"), LayoutColors.ColorSlotCaptionBackClose,
                                                 LayoutColors.ColorSlotCaptionText);
            }
            else
            {
                slotTitle     = Language.T("Closing Logic Condition");
                PnlParameters = new FancyPanel(slotTitle, LayoutColors.ColorSlotCaptionBackCloseFilter,
                                               LayoutColors.ColorSlotCaptionText);
                PnlTreeViewBase = new FancyPanel(Language.T("Indicators"), LayoutColors.ColorSlotCaptionBackCloseFilter,
                                                 LayoutColors.ColorSlotCaptionText);
            }

            TrvIndicators = new TreeView();
            BtnAccept     = new Button();
            BtnHelp       = new Button();
            BtnDefault    = new Button();
            BtnCancel     = new Button();

            LblIndicatorInfo    = new Label();
            LblIndicatorWarning = new Label();
            LblIndicator        = new Label();
            LblGroup            = new Label();
            CbxGroup            = new ComboBox();
            ListLabel           = new Label[5];
            ListParam           = new ComboBox[5];
            NumLabel            = new Label[6];
            NumParam            = new NUD[6];
            CheckParam          = new CheckBox[2];

            BackColor       = LayoutColors.ColorFormBack;
            FormBorderStyle = FormBorderStyle.FixedDialog;
            Icon            = Data.Icon;
            MaximizeBox     = false;
            MinimizeBox     = false;
            ShowInTaskbar   = false;
            AcceptButton    = BtnAccept;
            CancelButton    = BtnCancel;
            Text            = Language.T("Logic and Parameters of the Indicators");

            // Panel TreeViewBase
            PnlTreeViewBase.Parent  = this;
            PnlTreeViewBase.Padding = new Padding(Border, (int)PnlTreeViewBase.CaptionHeight, Border, Border);

            // TreeView trvIndicators
            TrvIndicators.Parent                = PnlTreeViewBase;
            TrvIndicators.Dock                  = DockStyle.Fill;
            TrvIndicators.BackColor             = LayoutColors.ColorControlBack;
            TrvIndicators.ForeColor             = LayoutColors.ColorControlText;
            TrvIndicators.BorderStyle           = BorderStyle.None;
            TrvIndicators.NodeMouseDoubleClick += TrvIndicatorsNodeMouseDoubleClick;
            TrvIndicators.KeyPress             += TrvIndicatorsKeyPress;

            PnlParameters.Parent = this;

            // lblIndicatorInfo
            LblIndicatorInfo.Parent          = PnlParameters;
            LblIndicatorInfo.Size            = new Size(16, 16);
            LblIndicatorInfo.BackColor       = Color.Transparent;
            LblIndicatorInfo.BackgroundImage = Resources.information;
            LblIndicatorInfo.Click          += LblIndicatorInfoClick;
            LblIndicatorInfo.MouseEnter     += Label_MouseEnter;
            LblIndicatorInfo.MouseLeave     += Label_MouseLeave;

            // LAbel Indicator Warning
            LblIndicatorWarning.Parent          = PnlParameters;
            LblIndicatorWarning.Size            = new Size(16, 16);
            LblIndicatorWarning.BackColor       = Color.Transparent;
            LblIndicatorWarning.BackgroundImage = Resources.warning;
            LblIndicatorWarning.Visible         = false;
            LblIndicatorWarning.Click          += LblIndicatorWarningClick;
            LblIndicatorWarning.MouseEnter     += Label_MouseEnter;
            LblIndicatorWarning.MouseLeave     += Label_MouseLeave;

            // Label Indicator
            LblIndicator.Parent    = PnlParameters;
            LblIndicator.TextAlign = ContentAlignment.MiddleCenter;
            LblIndicator.Font      = new Font(Font.FontFamily, 14, FontStyle.Bold);
            LblIndicator.ForeColor = LayoutColors.ColorSlotIndicatorText;
            LblIndicator.BackColor = Color.Transparent;

            // Label aLblList[0]
            ListLabel[0] = new Label
            {
                Parent    = PnlParameters,
                TextAlign = ContentAlignment.BottomCenter,
                ForeColor = LayoutColors.ColorControlText,
                BackColor = Color.Transparent
            };

            // ComboBox aCbxList[0]
            ListParam[0] = new ComboBox {
                Parent = PnlParameters, DropDownStyle = ComboBoxStyle.DropDownList
            };
            ListParam[0].SelectedIndexChanged += ParamChanged;

            // Logical Group
            LblGroup = new Label
            {
                Parent    = PnlParameters,
                TextAlign = ContentAlignment.BottomCenter,
                ForeColor = LayoutColors.ColorControlText,
                BackColor = Color.Transparent,
                Text      = Language.T("Group")
            };

            CbxGroup = new ComboBox {
                Parent = PnlParameters
            };
            if (slotType == SlotTypes.OpenFilter)
            {
                CbxGroup.Items.AddRange(new object[] { "A", "B", "C", "D", "E", "F", "G", "H", "All" });
            }
            if (slotType == SlotTypes.CloseFilter)
            {
                CbxGroup.Items.AddRange(new object[] { "a", "b", "c", "d", "e", "f", "g", "h", "all" });
            }
            CbxGroup.SelectedIndexChanged += GroupChanged;
            CbxGroup.DropDownStyle         = ComboBoxStyle.DropDownList;
            toolTip.SetToolTip(CbxGroup, Language.T("The logical group of the slot."));

            // ListParams
            for (int i = 1; i < 5; i++)
            {
                ListLabel[i] = new Label
                {
                    Parent    = PnlParameters,
                    TextAlign = ContentAlignment.BottomCenter,
                    ForeColor = LayoutColors.ColorControlText,
                    BackColor = Color.Transparent
                };

                ListParam[i] = new ComboBox {
                    Parent = PnlParameters, Enabled = false
                };
                ListParam[i].SelectedIndexChanged += ParamChanged;
                ListParam[i].DropDownStyle         = ComboBoxStyle.DropDownList;
            }

            // NumParams
            for (int i = 0; i < 6; i++)
            {
                NumLabel[i] = new Label
                {
                    Parent    = PnlParameters,
                    TextAlign = ContentAlignment.MiddleRight,
                    ForeColor = LayoutColors.ColorControlText,
                    BackColor = Color.Transparent
                };

                NumParam[i] = new NUD
                {
                    Parent = PnlParameters, TextAlign = HorizontalAlignment.Center, Enabled = false
                };
                NumParam[i].ValueChanged += ParamChanged;
            }

            // CheckParams
            for (int i = 0; i < 2; i++)
            {
                CheckParam[i] = new CheckBox
                {
                    Parent     = PnlParameters,
                    CheckAlign = ContentAlignment.MiddleLeft,
                    TextAlign  = ContentAlignment.MiddleLeft
                };
                CheckParam[i].CheckedChanged += ParamChanged;
                CheckParam[i].ForeColor       = LayoutColors.ColorControlText;
                CheckParam[i].BackColor       = Color.Transparent;
                CheckParam[i].Enabled         = false;
            }

            // Button Accept
            BtnAccept.Parent                  = this;
            BtnAccept.Text                    = Language.T("Accept");
            BtnAccept.DialogResult            = DialogResult.OK;
            BtnAccept.UseVisualStyleBackColor = true;

            // Button Default
            BtnDefault.Parent = this;
            BtnDefault.Text   = Language.T("Default");
            BtnDefault.Click += BtnDefaultClick;
            BtnDefault.UseVisualStyleBackColor = true;

            // Button Help
            BtnHelp.Parent = this;
            BtnHelp.Text   = Language.T("Help");
            BtnHelp.Click += BtnHelp_Click;
            BtnHelp.UseVisualStyleBackColor = true;

            // Button Cancel
            BtnCancel.Parent                  = this;
            BtnCancel.Text                    = Language.T("Cancel");
            BtnCancel.DialogResult            = DialogResult.Cancel;
            BtnCancel.UseVisualStyleBackColor = true;

            SetTreeViewIndicators();

            // ComboBoxindicator index selection.
            if (isSlotDefined)
            {
                TreeNode[] atrn = TrvIndicators.Nodes.Find(Data.Strategy.Slot[slot].IndParam.IndicatorName, true);
                TrvIndicators.SelectedNode = atrn[0];
                UpdateFromIndicatorParam(Data.Strategy.Slot[slot].IndParam);
                SetLogicalGroup();
                CalculateIndicator();
            }
            else
            {
                string sDefaultIndicator;
                if (slotType == SlotTypes.Open)
                {
                    sDefaultIndicator = "Bar Opening";
                }
                else if (slotType == SlotTypes.OpenFilter)
                {
                    sDefaultIndicator = "Accelerator Oscillator";
                }
                else if (slotType == SlotTypes.Close)
                {
                    sDefaultIndicator = "Bar Closing";
                }
                else
                {
                    sDefaultIndicator = "Accelerator Oscillator";
                }

                TreeNode[] atrn = TrvIndicators.Nodes.Find(sDefaultIndicator, true);
                TrvIndicators.SelectedNode = atrn[0];
                TrvIndicatorsLoadIndicator();
            }

            OppSignalBehaviour = Data.Strategy.OppSignalAction;

            if (slotType == SlotTypes.Close && Data.Strategy.CloseFilters > 0)
            {
                for (int iSlot = Data.Strategy.CloseSlot + 1; iSlot < Data.Strategy.Slots; iSlot++)
                {
                    closingConditions.Add(Data.Strategy.Slot[iSlot].Clone());
                }
            }
        }
        /// <summary>
        ///     Constructor
        /// </summary>
        public IndicatorDialog(int slotNumb, SlotTypes slotType, bool isSlotDefined)
        {
            slot = slotNumb;
            SlotType = slotType;

            if (slotType == SlotTypes.Open)
            {
                slotTitle = Language.T("Opening Point of the Position");
                PnlParameters = new FancyPanel(slotTitle, LayoutColors.ColorSlotCaptionBackOpen,
                                               LayoutColors.ColorSlotCaptionText);
                PnlTreeViewBase = new FancyPanel(Language.T("Indicators"), LayoutColors.ColorSlotCaptionBackOpen,
                                                 LayoutColors.ColorSlotCaptionText);
            }
            else if (slotType == SlotTypes.OpenFilter)
            {
                slotTitle = Language.T("Opening Logic Condition");
                PnlParameters = new FancyPanel(slotTitle, LayoutColors.ColorSlotCaptionBackOpenFilter,
                                               LayoutColors.ColorSlotCaptionText);
                PnlTreeViewBase = new FancyPanel(Language.T("Indicators"), LayoutColors.ColorSlotCaptionBackOpenFilter,
                                                 LayoutColors.ColorSlotCaptionText);
            }
            else if (slotType == SlotTypes.Close)
            {
                slotTitle = Language.T("Closing Point of the Position");
                PnlParameters = new FancyPanel(slotTitle, LayoutColors.ColorSlotCaptionBackClose,
                                               LayoutColors.ColorSlotCaptionText);
                PnlTreeViewBase = new FancyPanel(Language.T("Indicators"), LayoutColors.ColorSlotCaptionBackClose,
                                                 LayoutColors.ColorSlotCaptionText);
            }
            else
            {
                slotTitle = Language.T("Closing Logic Condition");
                PnlParameters = new FancyPanel(slotTitle, LayoutColors.ColorSlotCaptionBackCloseFilter,
                                               LayoutColors.ColorSlotCaptionText);
                PnlTreeViewBase = new FancyPanel(Language.T("Indicators"), LayoutColors.ColorSlotCaptionBackCloseFilter,
                                                 LayoutColors.ColorSlotCaptionText);
            }

            TrvIndicators = new TreeView();
            BtnAccept = new Button();
            BtnHelp = new Button();
            BtnDefault = new Button();
            BtnCancel = new Button();

            LblIndicatorInfo = new Label();
            LblIndicatorWarning = new Label();
            LblIndicator = new Label();
            LblGroup = new Label();
            CbxGroup = new ComboBox();
            ListLabel = new Label[5];
            ListParam = new ComboBox[5];
            NumLabel = new Label[6];
            NumParam = new NUD[6];
            CheckParam = new CheckBox[2];

            BackColor = LayoutColors.ColorFormBack;
            FormBorderStyle = FormBorderStyle.FixedDialog;
            Icon = Data.Icon;
            MaximizeBox = false;
            MinimizeBox = false;
            ShowInTaskbar = false;
            AcceptButton = BtnAccept;
            CancelButton = BtnCancel;
            Text = Language.T("Logic and Parameters of the Indicators");

            // Panel TreeViewBase
            PnlTreeViewBase.Parent = this;
            PnlTreeViewBase.Padding = new Padding(Border, (int) PnlTreeViewBase.CaptionHeight, Border, Border);

            // TreeView trvIndicators
            TrvIndicators.Parent = PnlTreeViewBase;
            TrvIndicators.Dock = DockStyle.Fill;
            TrvIndicators.BackColor = LayoutColors.ColorControlBack;
            TrvIndicators.ForeColor = LayoutColors.ColorControlText;
            TrvIndicators.BorderStyle = BorderStyle.None;
            TrvIndicators.NodeMouseDoubleClick += TrvIndicatorsNodeMouseDoubleClick;
            TrvIndicators.KeyPress += TrvIndicatorsKeyPress;

            PnlParameters.Parent = this;

            // lblIndicatorInfo
            LblIndicatorInfo.Parent = PnlParameters;
            LblIndicatorInfo.Size = new Size(16, 16);
            LblIndicatorInfo.BackColor = Color.Transparent;
            LblIndicatorInfo.BackgroundImage = Resources.information;
            LblIndicatorInfo.Click += LblIndicatorInfoClick;
            LblIndicatorInfo.MouseEnter += Label_MouseEnter;
            LblIndicatorInfo.MouseLeave += Label_MouseLeave;

            // LAbel Indicator Warning
            LblIndicatorWarning.Parent = PnlParameters;
            LblIndicatorWarning.Size = new Size(16, 16);
            LblIndicatorWarning.BackColor = Color.Transparent;
            LblIndicatorWarning.BackgroundImage = Resources.warning;
            LblIndicatorWarning.Visible = false;
            LblIndicatorWarning.Click += LblIndicatorWarningClick;
            LblIndicatorWarning.MouseEnter += Label_MouseEnter;
            LblIndicatorWarning.MouseLeave += Label_MouseLeave;

            // Label Indicator
            LblIndicator.Parent = PnlParameters;
            LblIndicator.TextAlign = ContentAlignment.MiddleCenter;
            LblIndicator.Font = new Font(Font.FontFamily, 14, FontStyle.Bold);
            LblIndicator.ForeColor = LayoutColors.ColorSlotIndicatorText;
            LblIndicator.BackColor = Color.Transparent;

            // Label aLblList[0]
            ListLabel[0] = new Label
                {
                    Parent = PnlParameters,
                    TextAlign = ContentAlignment.BottomCenter,
                    ForeColor = LayoutColors.ColorControlText,
                    BackColor = Color.Transparent
                };

            // ComboBox aCbxList[0]
            ListParam[0] = new ComboBox {Parent = PnlParameters, DropDownStyle = ComboBoxStyle.DropDownList};
            ListParam[0].SelectedIndexChanged += ParamChanged;

            // Logical Group
            LblGroup = new Label
                {
                    Parent = PnlParameters,
                    TextAlign = ContentAlignment.BottomCenter,
                    ForeColor = LayoutColors.ColorControlText,
                    BackColor = Color.Transparent,
                    Text = Language.T("Group")
                };

            CbxGroup = new ComboBox {Parent = PnlParameters};
            if (slotType == SlotTypes.OpenFilter)
                CbxGroup.Items.AddRange(new object[] {"A", "B", "C", "D", "E", "F", "G", "H", "All"});
            if (slotType == SlotTypes.CloseFilter)
                CbxGroup.Items.AddRange(new object[] {"a", "b", "c", "d", "e", "f", "g", "h", "all"});
            CbxGroup.SelectedIndexChanged += GroupChanged;
            CbxGroup.DropDownStyle = ComboBoxStyle.DropDownList;
            toolTip.SetToolTip(CbxGroup, Language.T("The logical group of the slot."));

            // ListParams
            for (int i = 1; i < 5; i++)
            {
                ListLabel[i] = new Label
                    {
                        Parent = PnlParameters,
                        TextAlign = ContentAlignment.BottomCenter,
                        ForeColor = LayoutColors.ColorControlText,
                        BackColor = Color.Transparent
                    };

                ListParam[i] = new ComboBox {Parent = PnlParameters, Enabled = false};
                ListParam[i].SelectedIndexChanged += ParamChanged;
                ListParam[i].DropDownStyle = ComboBoxStyle.DropDownList;
            }

            // NumParams
            for (int i = 0; i < 6; i++)
            {
                NumLabel[i] = new Label
                    {
                        Parent = PnlParameters,
                        TextAlign = ContentAlignment.MiddleRight,
                        ForeColor = LayoutColors.ColorControlText,
                        BackColor = Color.Transparent
                    };

                NumParam[i] = new NUD
                    {Parent = PnlParameters, TextAlign = HorizontalAlignment.Center, Enabled = false};
                NumParam[i].ValueChanged += ParamChanged;
            }

            // CheckParams
            for (int i = 0; i < 2; i++)
            {
                CheckParam[i] = new CheckBox
                    {
                        Parent = PnlParameters,
                        CheckAlign = ContentAlignment.MiddleLeft,
                        TextAlign = ContentAlignment.MiddleLeft
                    };
                CheckParam[i].CheckedChanged += ParamChanged;
                CheckParam[i].ForeColor = LayoutColors.ColorControlText;
                CheckParam[i].BackColor = Color.Transparent;
                CheckParam[i].Enabled = false;
            }

            // Button Accept
            BtnAccept.Parent = this;
            BtnAccept.Text = Language.T("Accept");
            BtnAccept.DialogResult = DialogResult.OK;
            BtnAccept.UseVisualStyleBackColor = true;

            // Button Default
            BtnDefault.Parent = this;
            BtnDefault.Text = Language.T("Default");
            BtnDefault.Click += BtnDefaultClick;
            BtnDefault.UseVisualStyleBackColor = true;

            // Button Help
            BtnHelp.Parent = this;
            BtnHelp.Text = Language.T("Help");
            BtnHelp.Click += BtnHelp_Click;
            BtnHelp.UseVisualStyleBackColor = true;

            // Button Cancel
            BtnCancel.Parent = this;
            BtnCancel.Text = Language.T("Cancel");
            BtnCancel.DialogResult = DialogResult.Cancel;
            BtnCancel.UseVisualStyleBackColor = true;

            SetTreeViewIndicators();

            // ComboBoxindicator index selection.
            if (isSlotDefined)
            {
                TreeNode[] atrn = TrvIndicators.Nodes.Find(Data.Strategy.Slot[slot].IndParam.IndicatorName, true);
                TrvIndicators.SelectedNode = atrn[0];
                UpdateFromIndicatorParam(Data.Strategy.Slot[slot].IndParam);
                SetLogicalGroup();
                CalculateIndicator();
            }
            else
            {
                string sDefaultIndicator;
                if (slotType == SlotTypes.Open)
                    sDefaultIndicator = "Bar Opening";
                else if (slotType == SlotTypes.OpenFilter)
                    sDefaultIndicator = "Accelerator Oscillator";
                else if (slotType == SlotTypes.Close)
                    sDefaultIndicator = "Bar Closing";
                else
                    sDefaultIndicator = "Accelerator Oscillator";

                TreeNode[] atrn = TrvIndicators.Nodes.Find(sDefaultIndicator, true);
                TrvIndicators.SelectedNode = atrn[0];
                TrvIndicatorsLoadIndicator();
            }

            OppSignalBehaviour = Data.Strategy.OppSignalAction;

            if (slotType == SlotTypes.Close && Data.Strategy.CloseFilters > 0)
                for (int iSlot = Data.Strategy.CloseSlot + 1; iSlot < Data.Strategy.Slots; iSlot++)
                    closingConditions.Add(Data.Strategy.Slot[iSlot].Clone());
        }