New NumericUpDown
상속: System.Windows.Forms.NumericUpDown
        public StrategyProperties()
        {
            PnlAveraging  = new FancyPanel(Language.T("Handling of Additional Entry Signals"), LayoutColors.ColorSlotCaptionBackAveraging);
            PnlAmounts    = new FancyPanel(Language.T("Trading Size"), LayoutColors.ColorSlotCaptionBackAveraging);
            PnlProtection = new FancyPanel(Language.T("Permanent Protection"), LayoutColors.ColorSlotCaptionBackAveraging);
            BalanceChart  = new SmallBalanceChart();

            LblPercent1 = new Label();
            LblPercent2 = new Label();
            LblPercent3 = new Label();

            LblSameDirAction = new Label();
            LblOppDirAction  = new Label();

            CbxSameDirAction        = new ComboBox();
            CbxOppDirAction         = new ComboBox();
            NUDMaxOpenLots          = new NUD();
            RbConstantUnits         = new RadioButton();
            RbVariableUnits         = new RadioButton();
            NUDEntryLots            = new NUD();
            NUDAddingLots           = new NUD();
            NUDReducingLots         = new NUD();
            LblMaxOpenLots          = new Label();
            LblEntryLots            = new Label();
            LblAddingLots           = new Label();
            LblReducingLots         = new Label();
            CbxUseMartingale        = new CheckBox();
            NUDMartingaleMultiplier = new NUD();

            ChbPermaSL     = new CheckBox();
            CbxPermaSLType = new ComboBox();
            NUDPermaSL     = new NUD();
            ChbPermaTP     = new CheckBox();
            CbxPermaTPType = new ComboBox();
            NUDPermaTP     = new NUD();
            ChbBreakEven   = new CheckBox();
            NUDBreakEven   = new NUD();

            BtnAccept  = new Button();
            BtnDefault = new Button();
            BtnCancel  = new Button();

            ColorText = LayoutColors.ColorControlText;

            MaximizeBox     = false;
            MinimizeBox     = false;
            ShowInTaskbar   = false;
            Icon            = Data.Icon;
            BackColor       = LayoutColors.ColorFormBack;
            FormBorderStyle = FormBorderStyle.FixedDialog;
            AcceptButton    = BtnAccept;
            Text            = Language.T("Strategy Properties");

            PnlAveraging.Parent  = this;
            PnlAmounts.Parent    = this;
            PnlProtection.Parent = this;
            BalanceChart.Parent  = this;
            BalanceChart.SetChartData();

            var toolTip = new ToolTip();

            // Label Same dir action
            LblSameDirAction.Parent    = PnlAveraging;
            LblSameDirAction.ForeColor = ColorText;
            LblSameDirAction.BackColor = Color.Transparent;
            LblSameDirAction.AutoSize  = true;
            LblSameDirAction.Text      = Language.T("Next same direction signal behavior");

            // Label Opposite dir action
            LblOppDirAction.Parent    = PnlAveraging;
            LblOppDirAction.ForeColor = ColorText;
            LblOppDirAction.BackColor = Color.Transparent;
            LblOppDirAction.AutoSize  = true;
            LblOppDirAction.Text      = Language.T("Next opposite direction signal behavior");

            // ComboBox SameDirAction
            CbxSameDirAction.Parent        = PnlAveraging;
            CbxSameDirAction.Name          = "cbxSameDirAction";
            CbxSameDirAction.DropDownStyle = ComboBoxStyle.DropDownList;
            var sameItems = new[] { Language.T("Nothing"), Language.T("Winner"), Language.T("Add") };

            foreach (var item in sameItems)
            {
                CbxSameDirAction.Items.Add(item);
            }
            CbxSameDirAction.SelectedIndex = 0;
            toolTip.SetToolTip(CbxSameDirAction,
                               Language.T("Nothing - cancels the additional orders.") + Environment.NewLine +
                               Language.T("Winner - adds to a winning position.") + Environment.NewLine +
                               Language.T("Add - adds to all positions."));

            // ComboBox OppDirAction
            CbxOppDirAction.Parent        = PnlAveraging;
            CbxOppDirAction.Name          = "cbxOppDirAction";
            CbxOppDirAction.DropDownStyle = ComboBoxStyle.DropDownList;
            var oppItems = new[] { Language.T("Nothing"), Language.T("Reduce"), Language.T("Close"), Language.T("Reverse") };

            foreach (var item in oppItems)
            {
                CbxOppDirAction.Items.Add(item);
            }
            CbxOppDirAction.SelectedIndex = 0;
            toolTip.SetToolTip(CbxOppDirAction,
                               Language.T("Nothing - cancels the additional orders.") + Environment.NewLine +
                               Language.T("Reduce - reduces or closes a position.") + Environment.NewLine +
                               Language.T("Close - closes the position.") + Environment.NewLine +
                               Language.T("Reverse - reverses the position."));

            // Label MaxOpen Lots
            LblMaxOpenLots.Parent    = PnlAmounts;
            LblMaxOpenLots.ForeColor = ColorText;
            LblMaxOpenLots.BackColor = Color.Transparent;
            LblMaxOpenLots.AutoSize  = true;
            LblMaxOpenLots.Text      = Language.T("Maximum number of open lots");

            // NumericUpDown MaxOpen Lots
            NUDMaxOpenLots.Parent = PnlAmounts;
            NUDMaxOpenLots.Name   = "nudMaxOpenLots";
            NUDMaxOpenLots.BeginInit();
            NUDMaxOpenLots.Minimum       = 0.01M;
            NUDMaxOpenLots.Maximum       = 100;
            NUDMaxOpenLots.Increment     = 0.01M;
            NUDMaxOpenLots.Value         = 20;
            NUDMaxOpenLots.DecimalPlaces = 2;
            NUDMaxOpenLots.TextAlign     = HorizontalAlignment.Center;
            NUDMaxOpenLots.EndInit();

            // Radio Button Constant Units
            RbConstantUnits.Parent    = PnlAmounts;
            RbConstantUnits.ForeColor = ColorText;
            RbConstantUnits.BackColor = Color.Transparent;
            RbConstantUnits.Checked   = true;
            RbConstantUnits.AutoSize  = true;
            RbConstantUnits.Name      = "rbConstantUnits";
            RbConstantUnits.Text      = Language.T("Trade a constant number of lots");

            // Radio Button Variable Units
            RbVariableUnits.Parent    = PnlAmounts;
            RbVariableUnits.ForeColor = ColorText;
            RbVariableUnits.BackColor = Color.Transparent;
            RbVariableUnits.Checked   = false;
            RbVariableUnits.AutoSize  = false;
            RbVariableUnits.Name      = "rbVariableUnits";
            RbVariableUnits.Text      = Language.T("Trade percent of your account. The percentage values show the part of the account equity used to cover the required margin.");

            // Label Entry Lots
            LblEntryLots.Parent    = PnlAmounts;
            LblEntryLots.ForeColor = ColorText;
            LblEntryLots.BackColor = Color.Transparent;
            LblEntryLots.AutoSize  = true;
            LblEntryLots.Text      = Language.T("Number of entry lots for a new position");

            // NumericUpDown Entry Lots
            NUDEntryLots.Parent = PnlAmounts;
            NUDEntryLots.Name   = "nudEntryLots";
            NUDEntryLots.BeginInit();
            NUDEntryLots.Minimum       = 0.01M;
            NUDEntryLots.Maximum       = 100;
            NUDEntryLots.Increment     = 0.01M;
            NUDEntryLots.Value         = 1;
            NUDEntryLots.DecimalPlaces = 2;
            NUDEntryLots.TextAlign     = HorizontalAlignment.Center;
            NUDEntryLots.EndInit();

            // Label Entry Lots %
            LblPercent1.Parent    = PnlAmounts;
            LblPercent1.ForeColor = ColorText;
            LblPercent1.BackColor = Color.Transparent;

            // Label Adding Lots
            LblAddingLots.Parent    = PnlAmounts;
            LblAddingLots.ForeColor = ColorText;
            LblAddingLots.BackColor = Color.Transparent;
            LblAddingLots.AutoSize  = true;
            LblAddingLots.Text      = Language.T("In case of addition - number of lots to add");

            // NumericUpDown Adding Lots
            NUDAddingLots.Parent = PnlAmounts;
            NUDAddingLots.Name   = "nudAddingLots";
            NUDAddingLots.BeginInit();
            NUDAddingLots.Minimum       = 0.01M;
            NUDAddingLots.Maximum       = 100;
            NUDAddingLots.Increment     = 0.01M;
            NUDAddingLots.Value         = 1;
            NUDAddingLots.DecimalPlaces = 2;
            NUDAddingLots.TextAlign     = HorizontalAlignment.Center;
            NUDAddingLots.EndInit();

            // Label Adding Lots %
            LblPercent2.Parent    = PnlAmounts;
            LblPercent2.ForeColor = ColorText;
            LblPercent2.BackColor = Color.Transparent;

            // Label Reducing Lots
            LblReducingLots.Parent    = PnlAmounts;
            LblReducingLots.ForeColor = ColorText;
            LblReducingLots.BackColor = Color.Transparent;
            LblReducingLots.AutoSize  = true;
            LblReducingLots.Text      = Language.T("In case of reduction - number of lots to close");

            // NumericUpDown Reducing Lots
            NUDReducingLots.Parent = PnlAmounts;
            NUDReducingLots.Name   = "nudReducingLots";
            NUDReducingLots.BeginInit();
            NUDReducingLots.Minimum       = 0.01M;
            NUDReducingLots.Maximum       = 100;
            NUDReducingLots.Increment     = 0.01m;
            NUDReducingLots.DecimalPlaces = 2;
            NUDReducingLots.Value         = 1;
            NUDReducingLots.TextAlign     = HorizontalAlignment.Center;
            NUDReducingLots.EndInit();

            // CheckBox Use Martingale
            CbxUseMartingale.Name      = "cbxUseMartingale";
            CbxUseMartingale.Parent    = PnlAmounts;
            CbxUseMartingale.ForeColor = ColorText;
            CbxUseMartingale.BackColor = Color.Transparent;
            CbxUseMartingale.AutoCheck = true;
            CbxUseMartingale.AutoSize  = true;
            CbxUseMartingale.Checked   = false;
            CbxUseMartingale.Text      = Language.T("Martingale money management multiplier");

            // NumericUpDown Martingale Multiplier
            NUDMartingaleMultiplier.Parent = PnlAmounts;
            NUDMartingaleMultiplier.Name   = "nudMartingaleMultiplier";
            NUDMartingaleMultiplier.BeginInit();
            NUDMartingaleMultiplier.Minimum       = 0.01M;
            NUDMartingaleMultiplier.Maximum       = 10;
            NUDMartingaleMultiplier.Increment     = 0.01m;
            NUDMartingaleMultiplier.DecimalPlaces = 2;
            NUDMartingaleMultiplier.Value         = 2;
            NUDMartingaleMultiplier.TextAlign     = HorizontalAlignment.Center;
            NUDMartingaleMultiplier.EndInit();


            // Label Reducing Lots %
            LblPercent3.Parent    = PnlAmounts;
            LblPercent3.ForeColor = ColorText;
            LblPercent3.BackColor = Color.Transparent;

            // CheckBox Permanent Stop Loss
            ChbPermaSL.Name      = "chbPermaSL";
            ChbPermaSL.Parent    = PnlProtection;
            ChbPermaSL.ForeColor = ColorText;
            ChbPermaSL.BackColor = Color.Transparent;
            ChbPermaSL.AutoCheck = true;
            ChbPermaSL.AutoSize  = true;
            ChbPermaSL.Checked   = false;
            ChbPermaSL.Text      = Language.T("Permanent Stop Loss");

            // ComboBox cbxPermaSLType
            CbxPermaSLType.Parent        = PnlProtection;
            CbxPermaSLType.Name          = "cbxPermaSLType";
            CbxPermaSLType.Visible       = false;
            CbxPermaSLType.DropDownStyle = ComboBoxStyle.DropDownList;
            CbxPermaSLType.Items.Add(Language.T("Relative"));
            CbxPermaSLType.Items.Add(Language.T("Absolute"));
            CbxPermaSLType.SelectedIndex = 0;

            // NumericUpDown Permanent S/L
            NUDPermaSL.Name   = "nudPermaSL";
            NUDPermaSL.Parent = PnlProtection;
            NUDPermaSL.BeginInit();
            NUDPermaSL.Minimum   = 5;
            NUDPermaSL.Maximum   = 5000;
            NUDPermaSL.Increment = 1;
            NUDPermaSL.Value     = Data.InstrProperties.IsFiveDigits ? 1000 : 100;
            NUDPermaSL.TextAlign = HorizontalAlignment.Center;
            NUDPermaSL.EndInit();

            // CheckBox Permanent Take Profit
            ChbPermaTP.Name      = "chbPermaTP";
            ChbPermaTP.Parent    = PnlProtection;
            ChbPermaTP.ForeColor = ColorText;
            ChbPermaTP.BackColor = Color.Transparent;
            ChbPermaTP.AutoCheck = true;
            ChbPermaTP.AutoSize  = true;
            ChbPermaTP.Checked   = false;
            ChbPermaTP.Text      = Language.T("Permanent Take Profit");

            // ComboBox cbxPermaTPType
            CbxPermaTPType.Parent        = PnlProtection;
            CbxPermaTPType.Name          = "cbxPermaTPType";
            CbxPermaTPType.Visible       = false;
            CbxPermaTPType.DropDownStyle = ComboBoxStyle.DropDownList;
            CbxPermaTPType.Items.Add(Language.T("Relative"));
            CbxPermaTPType.Items.Add(Language.T("Absolute"));
            CbxPermaTPType.SelectedIndex = 0;

            // NumericUpDown Permanent Take Profit
            NUDPermaTP.Parent = PnlProtection;
            NUDPermaTP.Name   = "nudPermaTP";
            NUDPermaTP.BeginInit();
            NUDPermaTP.Minimum   = 5;
            NUDPermaTP.Maximum   = 5000;
            NUDPermaTP.Increment = 1;
            NUDPermaTP.Value     = Data.InstrProperties.IsFiveDigits ? 1000 : 100;
            NUDPermaTP.TextAlign = HorizontalAlignment.Center;
            NUDPermaTP.EndInit();

            // CheckBox Break Even
            ChbBreakEven.Name      = "chbBreakEven";
            ChbBreakEven.Parent    = PnlProtection;
            ChbBreakEven.ForeColor = ColorText;
            ChbBreakEven.BackColor = Color.Transparent;
            ChbBreakEven.AutoCheck = true;
            ChbBreakEven.AutoSize  = true;
            ChbBreakEven.Checked   = false;
            ChbBreakEven.Text      = Language.T("Break Even");

            // NumericUpDown Break Even
            NUDBreakEven.Parent = PnlProtection;
            NUDBreakEven.Name   = "nudBreakEven";
            NUDBreakEven.BeginInit();
            NUDBreakEven.Minimum   = 5;
            NUDBreakEven.Maximum   = 5000;
            NUDBreakEven.Increment = 1;
            NUDBreakEven.Value     = Data.InstrProperties.IsFiveDigits ? 1000 : 100;
            NUDBreakEven.TextAlign = HorizontalAlignment.Center;
            NUDBreakEven.EndInit();

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

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

            //Button Accept
            BtnAccept.Parent                  = this;
            BtnAccept.Name                    = "btnAccept";
            BtnAccept.Text                    = Language.T("Accept");
            BtnAccept.DialogResult            = DialogResult.OK;
            BtnAccept.UseVisualStyleBackColor = true;
        }
        public StrategyProperties()
        {
            PnlAveraging = new FancyPanel(Language.T("Handling of Additional Entry Signals"), LayoutColors.ColorSlotCaptionBackAveraging);
            PnlAmounts = new FancyPanel(Language.T("Trading Size"), LayoutColors.ColorSlotCaptionBackAveraging);
            PnlProtection = new FancyPanel(Language.T("Permanent Protection"), LayoutColors.ColorSlotCaptionBackAveraging);
            BalanceChart = new SmallBalanceChart();

            LblPercent1 = new Label();
            LblPercent2 = new Label();
            LblPercent3 = new Label();

            LblSameDirAction = new Label();
            LblOppDirAction = new Label();

            CbxSameDirAction = new ComboBox();
            CbxOppDirAction = new ComboBox();
            NUDMaxOpenLots = new NUD();
            RbConstantUnits = new RadioButton();
            RbVariableUnits = new RadioButton();
            NUDEntryLots = new NUD();
            NUDAddingLots = new NUD();
            NUDReducingLots = new NUD();
            LblMaxOpenLots = new Label();
            LblEntryLots = new Label();
            LblAddingLots = new Label();
            LblReducingLots = new Label();
            CbxUseMartingale = new CheckBox();
            NUDMartingaleMultiplier = new NUD();

            ChbPermaSL = new CheckBox();
            CbxPermaSLType = new ComboBox();
            NUDPermaSL = new NUD();
            ChbPermaTP = new CheckBox();
            CbxPermaTPType = new ComboBox();
            NUDPermaTP = new NUD();
            ChbBreakEven = new CheckBox();
            NUDBreakEven = new NUD();

            BtnAccept = new Button();
            BtnDefault = new Button();
            BtnCancel = new Button();

            ColorText = LayoutColors.ColorControlText;

            MaximizeBox = false;
            MinimizeBox = false;
            ShowInTaskbar = false;
            Icon = Data.Icon;
            BackColor = LayoutColors.ColorFormBack;
            FormBorderStyle = FormBorderStyle.FixedDialog;
            AcceptButton = BtnAccept;
            Text = Language.T("Strategy Properties");

            PnlAveraging.Parent = this;
            PnlAmounts.Parent = this;
            PnlProtection.Parent = this;
            BalanceChart.Parent = this;
            BalanceChart.SetChartData();

            var toolTip = new ToolTip();

            // Label Same dir action
            LblSameDirAction.Parent = PnlAveraging;
            LblSameDirAction.ForeColor = ColorText;
            LblSameDirAction.BackColor = Color.Transparent;
            LblSameDirAction.AutoSize = true;
            LblSameDirAction.Text = Language.T("Next same direction signal behavior");

            // Label Opposite dir action
            LblOppDirAction.Parent = PnlAveraging;
            LblOppDirAction.ForeColor = ColorText;
            LblOppDirAction.BackColor = Color.Transparent;
            LblOppDirAction.AutoSize = true;
            LblOppDirAction.Text = Language.T("Next opposite direction signal behavior");

            // ComboBox SameDirAction
            CbxSameDirAction.Parent = PnlAveraging;
            CbxSameDirAction.Name = "cbxSameDirAction";
            CbxSameDirAction.DropDownStyle = ComboBoxStyle.DropDownList;
            var sameItems = new[] {Language.T("Nothing"), Language.T("Winner"), Language.T("Add")};
            foreach (var item in sameItems)
                CbxSameDirAction.Items.Add(item);
            CbxSameDirAction.SelectedIndex = 0;
            toolTip.SetToolTip(CbxSameDirAction,
                               Language.T("Nothing - cancels the additional orders.") + Environment.NewLine +
                               Language.T("Winner - adds to a winning position.") + Environment.NewLine +
                               Language.T("Add - adds to all positions."));

            // ComboBox OppDirAction
            CbxOppDirAction.Parent = PnlAveraging;
            CbxOppDirAction.Name = "cbxOppDirAction";
            CbxOppDirAction.DropDownStyle = ComboBoxStyle.DropDownList;
            var oppItems = new[] { Language.T("Nothing"), Language.T("Reduce"), Language.T("Close"), Language.T("Reverse") };
            foreach (var item in oppItems)
                CbxOppDirAction.Items.Add(item);
            CbxOppDirAction.SelectedIndex = 0;
            toolTip.SetToolTip(CbxOppDirAction,
                               Language.T("Nothing - cancels the additional orders.") + Environment.NewLine +
                               Language.T("Reduce - reduces or closes a position.") + Environment.NewLine +
                               Language.T("Close - closes the position.") + Environment.NewLine +
                               Language.T("Reverse - reverses the position."));

            // Label MaxOpen Lots
            LblMaxOpenLots.Parent = PnlAmounts;
            LblMaxOpenLots.ForeColor = ColorText;
            LblMaxOpenLots.BackColor = Color.Transparent;
            LblMaxOpenLots.AutoSize = true;
            LblMaxOpenLots.Text = Language.T("Maximum number of open lots");

            // NumericUpDown MaxOpen Lots
            NUDMaxOpenLots.Parent = PnlAmounts;
            NUDMaxOpenLots.Name = "nudMaxOpenLots";
            NUDMaxOpenLots.BeginInit();
            NUDMaxOpenLots.Minimum = 0.01M;
            NUDMaxOpenLots.Maximum = 100;
            NUDMaxOpenLots.Increment = 0.01M;
            NUDMaxOpenLots.Value = 20;
            NUDMaxOpenLots.DecimalPlaces = 2;
            NUDMaxOpenLots.TextAlign = HorizontalAlignment.Center;
            NUDMaxOpenLots.EndInit();

            // Radio Button Constant Units
            RbConstantUnits.Parent = PnlAmounts;
            RbConstantUnits.ForeColor = ColorText;
            RbConstantUnits.BackColor = Color.Transparent;
            RbConstantUnits.Checked = true;
            RbConstantUnits.AutoSize = true;
            RbConstantUnits.Name = "rbConstantUnits";
            RbConstantUnits.Text = Language.T("Trade a constant number of lots");

            // Radio Button Variable Units
            RbVariableUnits.Parent = PnlAmounts;
            RbVariableUnits.ForeColor = ColorText;
            RbVariableUnits.BackColor = Color.Transparent;
            RbVariableUnits.Checked = false;
            RbVariableUnits.AutoSize = false;
            RbVariableUnits.Name = "rbVariableUnits";
            RbVariableUnits.Text = Language.T("Trade percent of your account. The percentage values show the part of the account equity used to cover the required margin.");

            // Label Entry Lots
            LblEntryLots.Parent = PnlAmounts;
            LblEntryLots.ForeColor = ColorText;
            LblEntryLots.BackColor = Color.Transparent;
            LblEntryLots.AutoSize = true;
            LblEntryLots.Text = Language.T("Number of entry lots for a new position");

            // NumericUpDown Entry Lots
            NUDEntryLots.Parent = PnlAmounts;
            NUDEntryLots.Name = "nudEntryLots";
            NUDEntryLots.BeginInit();
            NUDEntryLots.Minimum = 0.01M;
            NUDEntryLots.Maximum = 100;
            NUDEntryLots.Increment = 0.01M;
            NUDEntryLots.Value = 1;
            NUDEntryLots.DecimalPlaces = 2;
            NUDEntryLots.TextAlign = HorizontalAlignment.Center;
            NUDEntryLots.EndInit();

            // Label Entry Lots %
            LblPercent1.Parent = PnlAmounts;
            LblPercent1.ForeColor = ColorText;
            LblPercent1.BackColor = Color.Transparent;

            // Label Adding Lots
            LblAddingLots.Parent = PnlAmounts;
            LblAddingLots.ForeColor = ColorText;
            LblAddingLots.BackColor = Color.Transparent;
            LblAddingLots.AutoSize = true;
            LblAddingLots.Text = Language.T("In case of addition - number of lots to add");

            // NumericUpDown Adding Lots
            NUDAddingLots.Parent = PnlAmounts;
            NUDAddingLots.Name = "nudAddingLots";
            NUDAddingLots.BeginInit();
            NUDAddingLots.Minimum = 0.01M;
            NUDAddingLots.Maximum = 100;
            NUDAddingLots.Increment = 0.01M;
            NUDAddingLots.Value = 1;
            NUDAddingLots.DecimalPlaces = 2;
            NUDAddingLots.TextAlign = HorizontalAlignment.Center;
            NUDAddingLots.EndInit();

            // Label Adding Lots %
            LblPercent2.Parent = PnlAmounts;
            LblPercent2.ForeColor = ColorText;
            LblPercent2.BackColor = Color.Transparent;

            // Label Reducing Lots
            LblReducingLots.Parent = PnlAmounts;
            LblReducingLots.ForeColor = ColorText;
            LblReducingLots.BackColor = Color.Transparent;
            LblReducingLots.AutoSize = true;
            LblReducingLots.Text = Language.T("In case of reduction - number of lots to close");

            // NumericUpDown Reducing Lots
            NUDReducingLots.Parent = PnlAmounts;
            NUDReducingLots.Name = "nudReducingLots";
            NUDReducingLots.BeginInit();
            NUDReducingLots.Minimum = 0.01M;
            NUDReducingLots.Maximum = 100;
            NUDReducingLots.Increment = 0.01m;
            NUDReducingLots.DecimalPlaces = 2;
            NUDReducingLots.Value = 1;
            NUDReducingLots.TextAlign = HorizontalAlignment.Center;
            NUDReducingLots.EndInit();

            // CheckBox Use Martingale
            CbxUseMartingale.Name = "cbxUseMartingale";
            CbxUseMartingale.Parent = PnlAmounts;
            CbxUseMartingale.ForeColor = ColorText;
            CbxUseMartingale.BackColor = Color.Transparent;
            CbxUseMartingale.AutoCheck = true;
            CbxUseMartingale.AutoSize = true;
            CbxUseMartingale.Checked = false;
            CbxUseMartingale.Text = Language.T("Martingale money management multiplier");

            // NumericUpDown Martingale Multiplier
            NUDMartingaleMultiplier.Parent = PnlAmounts;
            NUDMartingaleMultiplier.Name = "nudMartingaleMultiplier";
            NUDMartingaleMultiplier.BeginInit();
            NUDMartingaleMultiplier.Minimum = 0.01M;
            NUDMartingaleMultiplier.Maximum = 10;
            NUDMartingaleMultiplier.Increment = 0.01m;
            NUDMartingaleMultiplier.DecimalPlaces = 2;
            NUDMartingaleMultiplier.Value = 2;
            NUDMartingaleMultiplier.TextAlign = HorizontalAlignment.Center;
            NUDMartingaleMultiplier.EndInit();

            // Label Reducing Lots %
            LblPercent3.Parent = PnlAmounts;
            LblPercent3.ForeColor = ColorText;
            LblPercent3.BackColor = Color.Transparent;

            // CheckBox Permanent Stop Loss
            ChbPermaSL.Name = "chbPermaSL";
            ChbPermaSL.Parent = PnlProtection;
            ChbPermaSL.ForeColor = ColorText;
            ChbPermaSL.BackColor = Color.Transparent;
            ChbPermaSL.AutoCheck = true;
            ChbPermaSL.AutoSize = true;
            ChbPermaSL.Checked = false;
            ChbPermaSL.Text = Language.T("Permanent Stop Loss");

            // ComboBox cbxPermaSLType
            CbxPermaSLType.Parent = PnlProtection;
            CbxPermaSLType.Name = "cbxPermaSLType";
            CbxPermaSLType.Visible = false;
            CbxPermaSLType.DropDownStyle = ComboBoxStyle.DropDownList;
            CbxPermaSLType.Items.Add(Language.T("Relative"));
            CbxPermaSLType.Items.Add(Language.T("Absolute"));
            CbxPermaSLType.SelectedIndex = 0;

            // NumericUpDown Permanent S/L
            NUDPermaSL.Name = "nudPermaSL";
            NUDPermaSL.Parent = PnlProtection;
            NUDPermaSL.BeginInit();
            NUDPermaSL.Minimum = 5;
            NUDPermaSL.Maximum = 5000;
            NUDPermaSL.Increment = 1;
            NUDPermaSL.Value = Data.InstrProperties.IsFiveDigits ? 1000 : 100;
            NUDPermaSL.TextAlign = HorizontalAlignment.Center;
            NUDPermaSL.EndInit();

            // CheckBox Permanent Take Profit
            ChbPermaTP.Name = "chbPermaTP";
            ChbPermaTP.Parent = PnlProtection;
            ChbPermaTP.ForeColor = ColorText;
            ChbPermaTP.BackColor = Color.Transparent;
            ChbPermaTP.AutoCheck = true;
            ChbPermaTP.AutoSize = true;
            ChbPermaTP.Checked = false;
            ChbPermaTP.Text = Language.T("Permanent Take Profit");

            // ComboBox cbxPermaTPType
            CbxPermaTPType.Parent = PnlProtection;
            CbxPermaTPType.Name = "cbxPermaTPType";
            CbxPermaTPType.Visible = false;
            CbxPermaTPType.DropDownStyle = ComboBoxStyle.DropDownList;
            CbxPermaTPType.Items.Add(Language.T("Relative"));
            CbxPermaTPType.Items.Add(Language.T("Absolute"));
            CbxPermaTPType.SelectedIndex = 0;

            // NumericUpDown Permanent Take Profit
            NUDPermaTP.Parent = PnlProtection;
            NUDPermaTP.Name = "nudPermaTP";
            NUDPermaTP.BeginInit();
            NUDPermaTP.Minimum = 5;
            NUDPermaTP.Maximum = 5000;
            NUDPermaTP.Increment = 1;
            NUDPermaTP.Value = Data.InstrProperties.IsFiveDigits ? 1000 : 100;
            NUDPermaTP.TextAlign = HorizontalAlignment.Center;
            NUDPermaTP.EndInit();

            // CheckBox Break Even
            ChbBreakEven.Name = "chbBreakEven";
            ChbBreakEven.Parent = PnlProtection;
            ChbBreakEven.ForeColor = ColorText;
            ChbBreakEven.BackColor = Color.Transparent;
            ChbBreakEven.AutoCheck = true;
            ChbBreakEven.AutoSize = true;
            ChbBreakEven.Checked = false;
            ChbBreakEven.Text = Language.T("Break Even");

            // NumericUpDown Break Even
            NUDBreakEven.Parent = PnlProtection;
            NUDBreakEven.Name = "nudBreakEven";
            NUDBreakEven.BeginInit();
            NUDBreakEven.Minimum = 5;
            NUDBreakEven.Maximum = 5000;
            NUDBreakEven.Increment = 1;
            NUDBreakEven.Value = Data.InstrProperties.IsFiveDigits ? 1000 : 100;
            NUDBreakEven.TextAlign = HorizontalAlignment.Center;
            NUDBreakEven.EndInit();

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

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

            //Button Accept
            BtnAccept.Parent = this;
            BtnAccept.Name = "btnAccept";
            BtnAccept.Text = Language.T("Accept");
            BtnAccept.DialogResult = DialogResult.OK;
            BtnAccept.UseVisualStyleBackColor = true;
        }
예제 #3
0
        public Strategy_Properties()
        {
            pnlAveraging         = new Fancy_Panel(Language.T("Handling of Additional Entry Signals"), LayoutColors.ColorSlotCaptionBackAveraging);
            pnlAmounts           = new Fancy_Panel(Language.T("Trading Size"), LayoutColors.ColorSlotCaptionBackAveraging);
            pnlProtection        = new Fancy_Panel(Language.T("Permanent Protection"), LayoutColors.ColorSlotCaptionBackAveraging);
            pnlSmallBalanceChart = new Small_Balance_Chart();

            lblPercent1 = new Label();
            lblPercent2 = new Label();
            lblPercent3 = new Label();

            lblSameDirAction = new Label();
            lblOppDirAction  = new Label();

            cbxSameDirAction = new ComboBox();
            cbxOppDirAction  = new ComboBox();
            nudMaxOpenLots   = new NUD();
            rbConstantUnits  = new RadioButton();
            rbVariableUnits  = new RadioButton();
            nudEntryLots     = new NUD();
            nudAddingLots    = new NUD();
            nudReducingLots  = new NUD();
            lblMaxOpenLots   = new Label();
            lblEntryLots     = new Label();
            lblAddingLots    = new Label();
            lblReducingLots  = new Label();

            chbPermaSL     = new CheckBox();
            cbxPermaSLType = new ComboBox();
            nudPermaSL     = new NUD();
            chbPermaTP     = new CheckBox();
            cbxPermaTPType = new ComboBox();
            nudPermaTP     = new NUD();

            btnAccept  = new Button();
            btnDefault = new Button();
            btnCancel  = new Button();

            font      = this.Font;
            colorText = LayoutColors.ColorControlText;

            MaximizeBox     = false;
            MinimizeBox     = false;
            ShowInTaskbar   = false;
            Icon            = Data.Icon;
            BackColor       = LayoutColors.ColorFormBack;
            FormBorderStyle = FormBorderStyle.FixedDialog;
            AcceptButton    = btnAccept;
            Text            = Language.T("Strategy Properties");

            pnlAveraging.Parent         = this;
            pnlAmounts.Parent           = this;
            pnlProtection.Parent        = this;
            pnlSmallBalanceChart.Parent = this;
            pnlSmallBalanceChart.SetChartData();

            // Label Same dir action
            lblSameDirAction.Parent    = pnlAveraging;
            lblSameDirAction.ForeColor = colorText;
            lblSameDirAction.BackColor = Color.Transparent;
            lblSameDirAction.AutoSize  = true;
            lblSameDirAction.Text      = Language.T("Next same direction signal behavior");

            // Label Opposite dir action
            lblOppDirAction.Parent    = pnlAveraging;
            lblOppDirAction.ForeColor = colorText;
            lblOppDirAction.BackColor = Color.Transparent;
            lblOppDirAction.AutoSize  = true;
            lblOppDirAction.Text      = Language.T("Next opposite direction signal behavior");

            // ComboBox SameDirAction
            cbxSameDirAction.Parent        = pnlAveraging;
            cbxSameDirAction.Name          = "cbxSameDirAction";
            cbxSameDirAction.DropDownStyle = ComboBoxStyle.DropDownList;
            cbxSameDirAction.Items.AddRange(new string[] { Language.T("Nothing"), Language.T("Winner"), Language.T("Add") });
            cbxSameDirAction.SelectedIndex = 0;
            toolTip.SetToolTip(cbxSameDirAction,
                               Language.T("Nothing - cancels the additional orders.") + Environment.NewLine +
                               Language.T("Winner - adds to a winning position.") + Environment.NewLine +
                               Language.T("Add - adds to all positions."));

            // ComboBox OppDirAction
            cbxOppDirAction.Parent        = pnlAveraging;
            cbxOppDirAction.Name          = "cbxOppDirAction";
            cbxOppDirAction.DropDownStyle = ComboBoxStyle.DropDownList;
            cbxOppDirAction.Items.AddRange(new string[] { Language.T("Nothing"), Language.T("Reduce"), Language.T("Close"), Language.T("Reverse") });
            cbxOppDirAction.SelectedIndex = 0;
            toolTip.SetToolTip(cbxOppDirAction,
                               Language.T("Nothing - cancels the additional orders.") + Environment.NewLine +
                               Language.T("Reduce - reduces or closes a position.") + Environment.NewLine +
                               Language.T("Close - closes the position.") + Environment.NewLine +
                               Language.T("Reverse - reverses the position."));

            // Label MaxOpen Lots
            lblMaxOpenLots.Parent    = pnlAmounts;
            lblMaxOpenLots.ForeColor = colorText;
            lblMaxOpenLots.BackColor = Color.Transparent;
            lblMaxOpenLots.AutoSize  = true;
            lblMaxOpenLots.Text      = Language.T("Maximum number of open lots");

            // NumericUpDown MaxOpen Lots
            nudMaxOpenLots.Parent = pnlAmounts;
            nudMaxOpenLots.Name   = "nudMaxOpenLots";
            nudMaxOpenLots.BeginInit();
            nudMaxOpenLots.Minimum       = 0.01M;
            nudMaxOpenLots.Maximum       = 100;
            nudMaxOpenLots.Increment     = 0.01M;
            nudMaxOpenLots.Value         = 20;
            nudMaxOpenLots.DecimalPlaces = 2;
            nudMaxOpenLots.TextAlign     = HorizontalAlignment.Center;
            nudMaxOpenLots.EndInit();

            // Radio Button Constant Units
            rbConstantUnits.Parent    = pnlAmounts;
            rbConstantUnits.ForeColor = colorText;
            rbConstantUnits.BackColor = Color.Transparent;
            rbConstantUnits.Checked   = true;
            rbConstantUnits.AutoSize  = true;
            rbConstantUnits.Name      = "rbConstantUnits";
            rbConstantUnits.Text      = Language.T("Trade a constant number of lots");

            // Radio Button Variable Units
            rbVariableUnits.Parent    = pnlAmounts;
            rbVariableUnits.ForeColor = colorText;
            rbVariableUnits.BackColor = Color.Transparent;
            rbVariableUnits.Checked   = false;
            rbVariableUnits.AutoSize  = false;
            rbVariableUnits.Name      = "rbVariableUnits";
            rbVariableUnits.Text      = Language.T("Trade percent of your account. The percentage values show the part of the account equity used to cover the required margin.");

            // Label Entry Lots
            lblEntryLots.Parent    = pnlAmounts;
            lblEntryLots.ForeColor = colorText;
            lblEntryLots.BackColor = Color.Transparent;
            lblEntryLots.AutoSize  = true;
            lblEntryLots.Text      = Language.T("Number of entry lots for a new position");

            // NumericUpDown Entry Lots
            nudEntryLots.Parent = pnlAmounts;
            nudEntryLots.Name   = "nudEntryLots";
            nudEntryLots.BeginInit();
            nudEntryLots.Minimum       = 0.01M;
            nudEntryLots.Maximum       = 100;
            nudEntryLots.Increment     = 0.01M;
            nudEntryLots.Value         = 1;
            nudEntryLots.DecimalPlaces = 2;
            nudEntryLots.TextAlign     = HorizontalAlignment.Center;
            nudEntryLots.EndInit();

            // Label Entry Lots %
            lblPercent1.Parent    = pnlAmounts;
            lblPercent1.ForeColor = colorText;
            lblPercent1.BackColor = Color.Transparent;

            // Label Adding Lots
            lblAddingLots.Parent    = pnlAmounts;
            lblAddingLots.ForeColor = colorText;
            lblAddingLots.BackColor = Color.Transparent;
            lblAddingLots.AutoSize  = true;
            lblAddingLots.Text      = Language.T("In case of addition - number of lots to add");

            // NumericUpDown Adding Lots
            nudAddingLots.Parent = pnlAmounts;
            nudAddingLots.Name   = "nudAddingLots";
            nudAddingLots.BeginInit();
            nudAddingLots.Minimum       = 0.01M;
            nudAddingLots.Maximum       = 100;
            nudAddingLots.Increment     = 0.01M;
            nudAddingLots.Value         = 1;
            nudAddingLots.DecimalPlaces = 2;
            nudAddingLots.TextAlign     = HorizontalAlignment.Center;
            nudAddingLots.EndInit();

            // Label Adding Lots %
            lblPercent2.Parent    = pnlAmounts;
            lblPercent2.ForeColor = colorText;
            lblPercent2.BackColor = Color.Transparent;

            // Label Reducing Lots
            lblReducingLots.Parent    = pnlAmounts;
            lblReducingLots.ForeColor = colorText;
            lblReducingLots.BackColor = Color.Transparent;
            lblReducingLots.AutoSize  = true;
            lblReducingLots.Text      = Language.T("In case of reduction - number of lots to close");

            // NumericUpDown Reducing Lots
            nudReducingLots.Parent = pnlAmounts;
            nudReducingLots.Name   = "nudReducingLots";
            nudReducingLots.BeginInit();
            nudReducingLots.Minimum       = 0.01M;
            nudReducingLots.Maximum       = 100;
            nudReducingLots.Increment     = 0.01m;
            nudReducingLots.DecimalPlaces = 2;
            nudReducingLots.Value         = 1;
            nudReducingLots.TextAlign     = HorizontalAlignment.Center;
            nudReducingLots.EndInit();

            // Label Reducing Lots %
            lblPercent3.Parent    = pnlAmounts;
            lblPercent3.ForeColor = colorText;
            lblPercent3.BackColor = Color.Transparent;

            // CheckBox Permanent Stop Loss
            chbPermaSL.Name      = "chbPermaSL";
            chbPermaSL.Parent    = pnlProtection;
            chbPermaSL.ForeColor = colorText;
            chbPermaSL.BackColor = Color.Transparent;
            chbPermaSL.AutoCheck = true;
            chbPermaSL.AutoSize  = true;
            chbPermaSL.Checked   = false;
            chbPermaSL.Text      = Language.T("Permanent Stop Loss");

            // ComboBox cbxPermaSLType
            cbxPermaSLType.Parent        = pnlProtection;
            cbxPermaSLType.Name          = "cbxPermaSLType";
            cbxPermaSLType.DropDownStyle = ComboBoxStyle.DropDownList;
            cbxPermaSLType.Items.AddRange(new string[] { Language.T("Relative"), Language.T("Absolute") });
            cbxPermaSLType.SelectedIndex = 0;

            // NumericUpDown Permanent S/L
            nudPermaSL.Name   = "nudPermaSL";
            nudPermaSL.Parent = pnlProtection;
            nudPermaSL.BeginInit();
            nudPermaSL.Minimum   = 5;
            nudPermaSL.Maximum   = 5000;
            nudPermaSL.Increment = 1;
            nudPermaSL.Value     = (Data.InstrProperties.Digits == 5 || Data.InstrProperties.Digits == 3) ? 1000 : 100;
            nudPermaSL.TextAlign = HorizontalAlignment.Center;
            nudPermaSL.EndInit();

            // CheckBox Permanent Take Profit
            chbPermaTP.Name      = "chbPermaTP";
            chbPermaTP.Parent    = pnlProtection;
            chbPermaTP.ForeColor = colorText;
            chbPermaTP.BackColor = Color.Transparent;
            chbPermaTP.AutoCheck = true;
            chbPermaTP.AutoSize  = true;
            chbPermaTP.Checked   = false;
            chbPermaTP.Text      = Language.T("Permanent Take Profit");

            // ComboBox cbxPermaTPType
            cbxPermaTPType.Parent        = pnlProtection;
            cbxPermaTPType.Name          = "cbxPermaTPType";
            cbxPermaTPType.DropDownStyle = ComboBoxStyle.DropDownList;
            cbxPermaTPType.Items.AddRange(new string[] { Language.T("Relative"), Language.T("Absolute") });
            cbxPermaTPType.SelectedIndex = 0;

            // NumericUpDown Permanent Take Profit
            nudPermaTP.Parent = pnlProtection;
            nudPermaTP.Name   = "nudPermaTP";
            nudPermaTP.BeginInit();
            nudPermaTP.Minimum   = 5;
            nudPermaTP.Maximum   = 5000;
            nudPermaTP.Increment = 1;
            nudPermaTP.Value     = (Data.InstrProperties.Digits == 5 || Data.InstrProperties.Digits == 3) ? 1000 : 100;
            nudPermaTP.TextAlign = HorizontalAlignment.Center;
            nudPermaTP.EndInit();

            //Button Default
            btnDefault.Parent = this;
            btnDefault.Name   = "btnDefault";
            btnDefault.Text   = Language.T("Default");
            btnDefault.Click += new EventHandler(BtnDefault_Click);
            btnDefault.UseVisualStyleBackColor = true;

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

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

            return;
        }
        public Strategy_Properties()
        {
            pnlAveraging  = new Fancy_Panel(Language.T("Handling of Additional Entry Signals"), LayoutColors.ColorSlotCaptionBackAveraging);
            pnlAmounts    = new Fancy_Panel(Language.T("Trading Size"), LayoutColors.ColorSlotCaptionBackAveraging);
            pnlProtection = new Fancy_Panel(Language.T("Permanent Protection"), LayoutColors.ColorSlotCaptionBackAveraging);
            pnlSmallBalanceChart = new Small_Balance_Chart();

            lblPercent1  = new Label();
            lblPercent2  = new Label();
            lblPercent3  = new Label();

            lblSameDirAction = new Label();
            lblOppDirAction  = new Label();

            cbxSameDirAction = new ComboBox();
            cbxOppDirAction  = new ComboBox();
            nudMaxOpenLots   = new NUD();
            rbConstantUnits  = new RadioButton();
            rbVariableUnits  = new RadioButton();
            nudEntryLots     = new NUD();
            nudAddingLots    = new NUD();
            nudReducingLots  = new NUD();
            lblMaxOpenLots   = new Label();
            lblEntryLots     = new Label();
            lblAddingLots    = new Label();
            lblReducingLots  = new Label();

            chbPermaSL = new CheckBox();
            cbxPermaSLType = new ComboBox();
            nudPermaSL = new NUD();
            chbPermaTP = new CheckBox();
            cbxPermaTPType = new ComboBox();
            nudPermaTP = new NUD();
            chbBreakEven = new CheckBox();
            nudBreakEven = new NUD();

            btnAccept  = new Button();
            btnDefault = new Button();
            btnCancel  = new Button();

            font      = this.Font;
            colorText = LayoutColors.ColorControlText;

            MaximizeBox     = false;
            MinimizeBox     = false;
            ShowInTaskbar   = false;
            Icon            = Data.Icon;
            BackColor       = LayoutColors.ColorFormBack;
            FormBorderStyle = FormBorderStyle.FixedDialog;
            AcceptButton    = btnAccept;
            Text            = Language.T("Strategy Properties");

            pnlAveraging.Parent  = this;
            pnlAmounts.Parent    = this;
            pnlProtection.Parent = this;
            pnlSmallBalanceChart.Parent = this;
            pnlSmallBalanceChart.SetChartData();

            // Label Same dir action
            lblSameDirAction.Parent    = pnlAveraging;
            lblSameDirAction.ForeColor = colorText;
            lblSameDirAction.BackColor = Color.Transparent;
            lblSameDirAction.AutoSize  = true;
            lblSameDirAction.Text      = Language.T("Next same direction signal behavior");

            // Label Opposite dir action
            lblOppDirAction.Parent    = pnlAveraging;
            lblOppDirAction.ForeColor = colorText;
            lblOppDirAction.BackColor = Color.Transparent;
            lblOppDirAction.AutoSize  = true;
            lblOppDirAction.Text      = Language.T("Next opposite direction signal behavior");

            // ComboBox SameDirAction
            cbxSameDirAction.Parent        = pnlAveraging;
            cbxSameDirAction.Name          = "cbxSameDirAction";
            cbxSameDirAction.DropDownStyle = ComboBoxStyle.DropDownList;
            cbxSameDirAction.Items.AddRange(new string[] { Language.T("Nothing"), Language.T("Winner"), Language.T("Add") });
            cbxSameDirAction.SelectedIndex = 0;
            toolTip.SetToolTip(cbxSameDirAction,
                Language.T("Nothing - cancels the additional orders.") + Environment.NewLine +
                Language.T("Winner - adds to a winning position.")     + Environment.NewLine +
                Language.T("Add - adds to all positions."));

            // ComboBox OppDirAction
            cbxOppDirAction.Parent        = pnlAveraging;
            cbxOppDirAction.Name          = "cbxOppDirAction";
            cbxOppDirAction.DropDownStyle = ComboBoxStyle.DropDownList;
            cbxOppDirAction.Items.AddRange(new string[] { Language.T("Nothing"), Language.T("Reduce"), Language.T("Close"), Language.T("Reverse") });
            cbxOppDirAction.SelectedIndex = 0;
            toolTip.SetToolTip(cbxOppDirAction,
                Language.T("Nothing - cancels the additional orders.") + Environment.NewLine +
                Language.T("Reduce - reduces or closes a position.")   + Environment.NewLine +
                Language.T("Close - closes the position.")             + Environment.NewLine +
                Language.T("Reverse - reverses the position."));

            // Label MaxOpen Lots
            lblMaxOpenLots.Parent    = pnlAmounts;
            lblMaxOpenLots.ForeColor = colorText;
            lblMaxOpenLots.BackColor = Color.Transparent;
            lblMaxOpenLots.AutoSize  = true;
            lblMaxOpenLots.Text      = Language.T("Maximum number of open lots");

            // NumericUpDown MaxOpen Lots
            nudMaxOpenLots.Parent    = pnlAmounts;
            nudMaxOpenLots.Name      = "nudMaxOpenLots";
            nudMaxOpenLots.BeginInit();
            nudMaxOpenLots.Minimum   = 0.01M;
            nudMaxOpenLots.Maximum   = 100;
            nudMaxOpenLots.Increment = 0.01M;
            nudMaxOpenLots.Value     = 20;
            nudMaxOpenLots.DecimalPlaces = 2;
            nudMaxOpenLots.TextAlign = HorizontalAlignment.Center;
            nudMaxOpenLots.EndInit();

            // Radio Button Constant Units
            rbConstantUnits.Parent    = pnlAmounts;
            rbConstantUnits.ForeColor = colorText;
            rbConstantUnits.BackColor = Color.Transparent;
            rbConstantUnits.Checked   = true;
            rbConstantUnits.AutoSize  = true;
            rbConstantUnits.Name      = "rbConstantUnits";
            rbConstantUnits.Text      = Language.T("Trade a constant number of lots");

            // Radio Button Variable Units
            rbVariableUnits.Parent    = pnlAmounts;
            rbVariableUnits.ForeColor = colorText;
            rbVariableUnits.BackColor = Color.Transparent;
            rbVariableUnits.Checked   = false;
            rbVariableUnits.AutoSize  = false;
            rbVariableUnits.Name      = "rbVariableUnits";
            rbVariableUnits.Text      = Language.T("Trade percent of your account. The percentage values show the part of the account equity used to cover the required margin.");

            // Label Entry Lots
            lblEntryLots.Parent    = pnlAmounts;
            lblEntryLots.ForeColor = colorText;
            lblEntryLots.BackColor = Color.Transparent;
            lblEntryLots.AutoSize  = true;
            lblEntryLots.Text      = Language.T("Number of entry lots for a new position");

            // NumericUpDown Entry Lots
            nudEntryLots.Parent    = pnlAmounts;
            nudEntryLots.Name      = "nudEntryLots";
            nudEntryLots.BeginInit();
            nudEntryLots.Minimum   = 0.01M;
            nudEntryLots.Maximum   = 100;
            nudEntryLots.Increment = 0.01M;
            nudEntryLots.Value     = 1;
            nudEntryLots.DecimalPlaces = 2;
            nudEntryLots.TextAlign = HorizontalAlignment.Center;
            nudEntryLots.EndInit();

            // Label Entry Lots %
            lblPercent1.Parent    = pnlAmounts;
            lblPercent1.ForeColor = colorText;
            lblPercent1.BackColor = Color.Transparent;

            // Label Adding Lots
            lblAddingLots.Parent    = pnlAmounts;
            lblAddingLots.ForeColor = colorText;
            lblAddingLots.BackColor = Color.Transparent;
            lblAddingLots.AutoSize  = true;
            lblAddingLots.Text      = Language.T("In case of addition - number of lots to add");

            // NumericUpDown Adding Lots
            nudAddingLots.Parent    = pnlAmounts;
            nudAddingLots.Name      = "nudAddingLots";
            nudAddingLots.BeginInit();
            nudAddingLots.Minimum   = 0.01M;
            nudAddingLots.Maximum   = 100;
            nudAddingLots.Increment = 0.01M;
            nudAddingLots.Value     = 1;
            nudAddingLots.DecimalPlaces = 2;
            nudAddingLots.TextAlign = HorizontalAlignment.Center;
            nudAddingLots.EndInit();

            // Label Adding Lots %
            lblPercent2.Parent    = pnlAmounts;
            lblPercent2.ForeColor = colorText;
            lblPercent2.BackColor = Color.Transparent;

            // Label Reducing Lots
            lblReducingLots.Parent    = pnlAmounts;
            lblReducingLots.ForeColor = colorText;
            lblReducingLots.BackColor = Color.Transparent;
            lblReducingLots.AutoSize  = true;
            lblReducingLots.Text      = Language.T("In case of reduction - number of lots to close");

            // NumericUpDown Reducing Lots
            nudReducingLots.Parent    = pnlAmounts;
            nudReducingLots.Name      = "nudReducingLots";
            nudReducingLots.BeginInit();
            nudReducingLots.Minimum   = 0.01M;
            nudReducingLots.Maximum   = 100;
            nudReducingLots.Increment = 0.01m;
            nudReducingLots.DecimalPlaces = 2;
            nudReducingLots.Value     = 1;
            nudReducingLots.TextAlign = HorizontalAlignment.Center;
            nudReducingLots.EndInit();

            // Label Reducing Lots %
            lblPercent3.Parent    = pnlAmounts;
            lblPercent3.ForeColor = colorText;
            lblPercent3.BackColor = Color.Transparent;

            // CheckBox Permanent Stop Loss
            chbPermaSL.Name      = "chbPermaSL";
            chbPermaSL.Parent    = pnlProtection;
            chbPermaSL.ForeColor = colorText;
            chbPermaSL.BackColor = Color.Transparent;
            chbPermaSL.AutoCheck = true;
            chbPermaSL.AutoSize  = true;
            chbPermaSL.Checked   = false;
            chbPermaSL.Text      = Language.T("Permanent Stop Loss");

            // ComboBox cbxPermaSLType
            cbxPermaSLType.Parent  = pnlProtection;
            cbxPermaSLType.Name    = "cbxPermaSLType";
            cbxPermaSLType.Visible = false;
            cbxPermaSLType.DropDownStyle = ComboBoxStyle.DropDownList;
            cbxPermaSLType.Items.AddRange(new string[] { Language.T("Relative"), Language.T("Absolute") });
            cbxPermaSLType.SelectedIndex = 0;

            // NumericUpDown Permanent S/L
            nudPermaSL.Name      = "nudPermaSL";
            nudPermaSL.Parent    = pnlProtection;
            nudPermaSL.BeginInit();
            nudPermaSL.Minimum   = 5;
            nudPermaSL.Maximum   = 5000;
            nudPermaSL.Increment = 1;
            nudPermaSL.Value     = Data.InstrProperties.IsFiveDigits ? 1000 : 100;
            nudPermaSL.TextAlign = HorizontalAlignment.Center;
            nudPermaSL.EndInit();

            // CheckBox Permanent Take Profit
            chbPermaTP.Name      = "chbPermaTP";
            chbPermaTP.Parent    = pnlProtection;
            chbPermaTP.ForeColor = colorText;
            chbPermaTP.BackColor = Color.Transparent;
            chbPermaTP.AutoCheck = true;
            chbPermaTP.AutoSize  = true;
            chbPermaTP.Checked   = false;
            chbPermaTP.Text      = Language.T("Permanent Take Profit");

            // ComboBox cbxPermaTPType
            cbxPermaTPType.Parent  = pnlProtection;
            cbxPermaTPType.Name    = "cbxPermaTPType";
            cbxPermaTPType.Visible = false;
            cbxPermaTPType.DropDownStyle = ComboBoxStyle.DropDownList;
            cbxPermaTPType.Items.AddRange(new string[] { Language.T("Relative"), Language.T("Absolute") });
            cbxPermaTPType.SelectedIndex = 0;

            // NumericUpDown Permanent Take Profit
            nudPermaTP.Parent    = pnlProtection;
            nudPermaTP.Name      = "nudPermaTP";
            nudPermaTP.BeginInit();
            nudPermaTP.Minimum   = 5;
            nudPermaTP.Maximum   = 5000;
            nudPermaTP.Increment = 1;
            nudPermaTP.Value     = Data.InstrProperties.IsFiveDigits ? 1000 : 100;
            nudPermaTP.TextAlign = HorizontalAlignment.Center;
            nudPermaTP.EndInit();

            // CheckBox Break Even
            chbBreakEven.Name      = "chbBreakEven";
            chbBreakEven.Parent    = pnlProtection;
            chbBreakEven.ForeColor = colorText;
            chbBreakEven.BackColor = Color.Transparent;
            chbBreakEven.AutoCheck = true;
            chbBreakEven.AutoSize  = true;
            chbBreakEven.Checked   = false;
            chbBreakEven.Text      = Language.T("Break Even");

            // NumericUpDown Break Even
            nudBreakEven.Parent    = pnlProtection;
            nudBreakEven.Name      = "nudBreakEven";
            nudBreakEven.BeginInit();
            nudBreakEven.Minimum   = 5;
            nudBreakEven.Maximum   = 5000;
            nudBreakEven.Increment = 1;
            nudBreakEven.Value     = Data.InstrProperties.IsFiveDigits ? 1000 : 100;
            nudBreakEven.TextAlign = HorizontalAlignment.Center;
            nudBreakEven.EndInit();

            //Button Default
            btnDefault.Parent = this;
            btnDefault.Name   = "btnDefault";
            btnDefault.Text   = Language.T("Default");
            btnDefault.Click += new EventHandler(BtnDefault_Click);
            btnDefault.UseVisualStyleBackColor = true;

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

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

            return;
        }
        /// <summary>
        /// Constructor
        /// </summary>
        public IndicatorDialog(int slotNumb, SlotTypes slotType, bool isDefined)
        {
            _slot = slotNumb;
            _slotType = slotType;

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

            TrvIndicators = new TreeView();
            BalanceChart = new SmallBalanceChart();
            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();
            ALblList = new Label[5];
            ACbxList = new ComboBox[5];
            ALblNumeric = new Label[6];
            ANudNumeric = new NUD[6];
            AChbCheck = 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;

            // pnlSmallBalanceChart
            BalanceChart.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 += LabelMouseEnter;
            LblIndicatorInfo.MouseLeave += LabelMouseLeave;

            // lblIndicatorWarning
            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 += LabelMouseEnter;
            LblIndicatorWarning.MouseLeave += LabelMouseLeave;

            // 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]
            ALblList[0] = new Label
                              {
                                  Parent = PnlParameters,
                                  TextAlign = ContentAlignment.BottomCenter,
                                  ForeColor = LayoutColors.ColorControlText,
                                  BackColor = Color.Transparent
                              };

            // ComboBox ACbxList[0]
            ACbxList[0] = new ComboBox {Parent = PnlParameters, DropDownStyle = ComboBoxStyle.DropDownList};
            ACbxList[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++)
            {
                ALblList[i] = new Label
                                  {
                                      Parent = PnlParameters,
                                      TextAlign = ContentAlignment.BottomCenter,
                                      ForeColor = LayoutColors.ColorControlText,
                                      BackColor = Color.Transparent
                                  };

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

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

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

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

            //Button Accept
            BtnAccept.Parent = this;
            BtnAccept.Text = Language.T("Accept");
            BtnAccept.DialogResult = DialogResult.OK;
            BtnAccept.Click += BtnOkClick;
            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 += BtnHelpClick;
            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 (isDefined)
            {
                TreeNode[] atrn = TrvIndicators.Nodes.Find(Data.Strategy.Slot[_slot].IndParam.IndicatorName, true);
                TrvIndicators.SelectedNode = atrn[0];
                UpdateFromIndicatorParam(Data.Strategy.Slot[_slot].IndParam);
                SetLogicalGroup();
                CalculateIndicator(false);
                BalanceChart.SetChartData();
                BalanceChart.InitChart();
                BalanceChart.Invalidate();
            }
            else
            {
                string defaultIndicator;
                if (slotType == SlotTypes.Open)
                    defaultIndicator = "Bar Opening";
                else if (slotType == SlotTypes.OpenFilter)
                    defaultIndicator = "Accelerator Oscillator";
                else if (slotType == SlotTypes.Close)
                    defaultIndicator = "Bar Closing";
                else
                    defaultIndicator = "Accelerator Oscillator";

                TreeNode[] atrn = TrvIndicators.Nodes.Find(defaultIndicator, 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 isDefined)
        {
            _slot     = slotNumb;
            _slotType = slotType;

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

            TrvIndicators = new TreeView();
            BalanceChart  = new SmallBalanceChart();
            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();
            ALblList            = new Label[5];
            ACbxList            = new ComboBox[5];
            ALblNumeric         = new Label[6];
            ANudNumeric         = new NUD[6];
            AChbCheck           = 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;

            // pnlSmallBalanceChart
            BalanceChart.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     += LabelMouseEnter;
            LblIndicatorInfo.MouseLeave     += LabelMouseLeave;

            // lblIndicatorWarning
            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     += LabelMouseEnter;
            LblIndicatorWarning.MouseLeave     += LabelMouseLeave;

            // 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]
            ALblList[0] = new Label
            {
                Parent    = PnlParameters,
                TextAlign = ContentAlignment.BottomCenter,
                ForeColor = LayoutColors.ColorControlText,
                BackColor = Color.Transparent
            };

            // ComboBox ACbxList[0]
            ACbxList[0] = new ComboBox {
                Parent = PnlParameters, DropDownStyle = ComboBoxStyle.DropDownList
            };
            ACbxList[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++)
            {
                ALblList[i] = new Label
                {
                    Parent    = PnlParameters,
                    TextAlign = ContentAlignment.BottomCenter,
                    ForeColor = LayoutColors.ColorControlText,
                    BackColor = Color.Transparent
                };

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

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

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

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

            //Button Accept
            BtnAccept.Parent                  = this;
            BtnAccept.Text                    = Language.T("Accept");
            BtnAccept.DialogResult            = DialogResult.OK;
            BtnAccept.Click                  += BtnOkClick;
            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 += BtnHelpClick;
            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 (isDefined)
            {
                TreeNode[] atrn = TrvIndicators.Nodes.Find(Data.Strategy.Slot[_slot].IndParam.IndicatorName, true);
                TrvIndicators.SelectedNode = atrn[0];
                UpdateFromIndicatorParam(Data.Strategy.Slot[_slot].IndParam);
                SetLogicalGroup();
                CalculateIndicator(false);
                BalanceChart.SetChartData();
                BalanceChart.InitChart();
                BalanceChart.Invalidate();
            }
            else
            {
                string defaultIndicator;
                if (slotType == SlotTypes.Open)
                {
                    defaultIndicator = "Bar Opening";
                }
                else if (slotType == SlotTypes.OpenFilter)
                {
                    defaultIndicator = "Accelerator Oscillator";
                }
                else if (slotType == SlotTypes.Close)
                {
                    defaultIndicator = "Bar Closing";
                }
                else
                {
                    defaultIndicator = "Accelerator Oscillator";
                }

                TreeNode[] atrn = TrvIndicators.Nodes.Find(defaultIndicator, 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 Indicator_Dialog(int slotNumb, SlotTypes slotType, bool isDefined)
        {
            this.slot      = slotNumb;
            this.slotType   = slotType;
            this.isDefined = isDefined;

            if (slotType == SlotTypes.Open)
            {
                slotCation      = Language.T("Opening Point of the Position");
                pnlParameters   = new Fancy_Panel(slotCation, LayoutColors.ColorSlotCaptionBackOpen);
                pnlTreeViewBase = new Fancy_Panel(Language.T("Indicators"), LayoutColors.ColorSlotCaptionBackOpen);
            }
            else if (slotType == SlotTypes.OpenFilter)
            {
                slotCation      = Language.T("Opening Logic Condition");
                pnlParameters   = new Fancy_Panel(slotCation, LayoutColors.ColorSlotCaptionBackOpenFilter);
                pnlTreeViewBase = new Fancy_Panel(Language.T("Indicators"), LayoutColors.ColorSlotCaptionBackOpenFilter);
            }
            else if (slotType == SlotTypes.Close)
            {
                slotCation      = Language.T("Closing Point of the Position");
                pnlParameters   = new Fancy_Panel(slotCation, LayoutColors.ColorSlotCaptionBackClose);
                pnlTreeViewBase = new Fancy_Panel(Language.T("Indicators"), LayoutColors.ColorSlotCaptionBackClose);
            }
            else
            {
                slotCation      = Language.T("Closing Logic Condition");
                pnlParameters   = new Fancy_Panel(slotCation, LayoutColors.ColorSlotCaptionBackCloseFilter);
                pnlTreeViewBase = new Fancy_Panel(Language.T("Indicators"), LayoutColors.ColorSlotCaptionBackCloseFilter);
            }

            trvIndicators        = new TreeView();
            pnlSmallBalanceChart = new Small_Balance_Chart();
            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();
            aLblList             = new Label[5];
            aCbxList             = new ComboBox[5];
            aLblNumeric          = new Label[6];
            aNudNumeric          = new NUD[6];
            aChbCheck            = 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 += new TreeNodeMouseClickEventHandler(TrvIndicators_NodeMouseDoubleClick);
            trvIndicators.KeyPress   += new KeyPressEventHandler(TrvIndicators_KeyPress);

            pnlParameters.Parent = this;

            // pnlSmallBalanceChart
            pnlSmallBalanceChart.Parent = this;

            // lblIndicatorInfo
            lblIndicatorInfo.Parent          = pnlParameters;
            lblIndicatorInfo.Size            = new Size(16, 16);
            lblIndicatorInfo.BackColor       = Color.Transparent;
            lblIndicatorInfo.BackgroundImage = Properties.Resources.information;
            lblIndicatorInfo.Click          += new EventHandler(LblIndicatorInfo_Click);
            lblIndicatorInfo.MouseEnter     += new EventHandler(Label_MouseEnter);
            lblIndicatorInfo.MouseLeave     += new EventHandler(Label_MouseLeave);

            // lblIndicatorWarning
            lblIndicatorWarning.Parent          = pnlParameters;
            lblIndicatorWarning.Size            = new Size(16, 16);
            lblIndicatorWarning.BackColor       = Color.Transparent;
            lblIndicatorWarning.BackgroundImage = Properties.Resources.warning;
            lblIndicatorWarning.Visible         = false;
            lblIndicatorWarning.Click          += new EventHandler(LblIndicatorWarning_Click);
            lblIndicatorWarning.MouseEnter     += new EventHandler(Label_MouseEnter);
            lblIndicatorWarning.MouseLeave     += new EventHandler(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]
            aLblList[0]           = new Label();
            aLblList[0].Parent    = pnlParameters;
            aLblList[0].TextAlign = ContentAlignment.BottomCenter;
            aLblList[0].ForeColor = LayoutColors.ColorControlText;
            aLblList[0].BackColor = Color.Transparent;

            // ComboBox aCbxList[0]
            aCbxList[0]               = new ComboBox();
            aCbxList[0].Parent        = pnlParameters;
            aCbxList[0].DropDownStyle = ComboBoxStyle.DropDownList;
            aCbxList[0].SelectedIndexChanged  += new EventHandler(Param_Changed);

            // Logical Group
            lblGroup = new Label();
            lblGroup.Parent    = pnlParameters;
            lblGroup.TextAlign = ContentAlignment.BottomCenter;
            lblGroup.ForeColor = LayoutColors.ColorControlText;
            lblGroup.BackColor = Color.Transparent;
            lblGroup.Text      = Language.T("Group");

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

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

                aCbxList[i]               = new ComboBox();
                aCbxList[i].Parent        = pnlParameters;
                aCbxList[i].Enabled       = false;
                aCbxList[i].SelectedIndexChanged += new EventHandler(Param_Changed);
                aCbxList[i].DropDownStyle = ComboBoxStyle.DropDownList;
            }

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

                aNudNumeric[i] = new NUD();
                aNudNumeric[i].Parent        = pnlParameters;
                aNudNumeric[i].TextAlign     = HorizontalAlignment.Center;
                aNudNumeric[i].Enabled       = false;
                aNudNumeric[i].ValueChanged += new EventHandler(Param_Changed);
            }

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

            //Button Accept
            btnAccept.Parent       = this;
            btnAccept.Text         = Language.T("Accept");
            btnAccept.DialogResult = DialogResult.OK;
            btnAccept.Click       += new EventHandler(BtnOk_Click);
            btnAccept.UseVisualStyleBackColor = true;

            //Button Default
            btnDefault.Parent      = this;
            btnDefault.Text        = Language.T("Default");
            btnDefault.Click      += new EventHandler(BtnDefault_Click);
            btnDefault.UseVisualStyleBackColor = true;

            //Button Help
            btnHelp.Parent         = this;
            btnHelp.Text           = Language.T("Help");
            btnHelp.Click         += new EventHandler(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 (isDefined)
            {
                TreeNode [] atrn = trvIndicators.Nodes.Find(Data.Strategy.Slot[slot].IndParam.IndicatorName, true);
                trvIndicators.SelectedNode = atrn[0];
                UpdateFromIndicatorParam(Data.Strategy.Slot[slot].IndParam);
                SetLogicalGroup();
                CalculateIndicator(false);
                pnlSmallBalanceChart.SetChartData();
                pnlSmallBalanceChart.InitChart();
                pnlSmallBalanceChart.Invalidate();
            }
            else
            {
                string defaultIndicator;
                if (slotType == SlotTypes.Open)
                    defaultIndicator = "Bar Opening";
                else if (slotType == SlotTypes.OpenFilter)
                    defaultIndicator = "Accelerator Oscillator";
                else if (slotType == SlotTypes.Close)
                    defaultIndicator = "Bar Closing";
                else
                    defaultIndicator = "Accelerator Oscillator";

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

            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());

            return;
        }
// ---------------------------------------------------------------------------

        /// <summary>
        /// Constructor
        /// </summary>
        public Indicator_Dialog(int slotNumb, SlotTypes slotType, bool isDefined)
        {
            this.slot      = slotNumb;
            this.slotType  = slotType;
            this.isDefined = isDefined;

            if (slotType == SlotTypes.Open)
            {
                slotCation      = Language.T("Opening Point of the Position");
                pnlParameters   = new Fancy_Panel(slotCation, LayoutColors.ColorSlotCaptionBackOpen);
                pnlTreeViewBase = new Fancy_Panel(Language.T("Indicators"), LayoutColors.ColorSlotCaptionBackOpen);
            }
            else if (slotType == SlotTypes.OpenFilter)
            {
                slotCation      = Language.T("Opening Logic Condition");
                pnlParameters   = new Fancy_Panel(slotCation, LayoutColors.ColorSlotCaptionBackOpenFilter);
                pnlTreeViewBase = new Fancy_Panel(Language.T("Indicators"), LayoutColors.ColorSlotCaptionBackOpenFilter);
            }
            else if (slotType == SlotTypes.Close)
            {
                slotCation      = Language.T("Closing Point of the Position");
                pnlParameters   = new Fancy_Panel(slotCation, LayoutColors.ColorSlotCaptionBackClose);
                pnlTreeViewBase = new Fancy_Panel(Language.T("Indicators"), LayoutColors.ColorSlotCaptionBackClose);
            }
            else
            {
                slotCation      = Language.T("Closing Logic Condition");
                pnlParameters   = new Fancy_Panel(slotCation, LayoutColors.ColorSlotCaptionBackCloseFilter);
                pnlTreeViewBase = new Fancy_Panel(Language.T("Indicators"), LayoutColors.ColorSlotCaptionBackCloseFilter);
            }

            trvIndicators        = new TreeView();
            pnlSmallBalanceChart = new Small_Balance_Chart();
            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();
            aLblList            = new Label[5];
            aCbxList            = new ComboBox[5];
            aLblNumeric         = new Label[6];
            aNudNumeric         = new NUD[6];
            aChbCheck           = 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 += new TreeNodeMouseClickEventHandler(TrvIndicators_NodeMouseDoubleClick);
            trvIndicators.KeyPress             += new KeyPressEventHandler(TrvIndicators_KeyPress);

            pnlParameters.Parent = this;

            // pnlSmallBalanceChart
            pnlSmallBalanceChart.Parent = this;

            // lblIndicatorInfo
            lblIndicatorInfo.Parent          = pnlParameters;
            lblIndicatorInfo.Size            = new Size(16, 16);
            lblIndicatorInfo.BackColor       = Color.Transparent;
            lblIndicatorInfo.BackgroundImage = Properties.Resources.information;
            lblIndicatorInfo.Click          += new EventHandler(LblIndicatorInfo_Click);
            lblIndicatorInfo.MouseEnter     += new EventHandler(Label_MouseEnter);
            lblIndicatorInfo.MouseLeave     += new EventHandler(Label_MouseLeave);

            // lblIndicatorWarning
            lblIndicatorWarning.Parent          = pnlParameters;
            lblIndicatorWarning.Size            = new Size(16, 16);
            lblIndicatorWarning.BackColor       = Color.Transparent;
            lblIndicatorWarning.BackgroundImage = Properties.Resources.warning;
            lblIndicatorWarning.Visible         = false;
            lblIndicatorWarning.Click          += new EventHandler(LblIndicatorWarning_Click);
            lblIndicatorWarning.MouseEnter     += new EventHandler(Label_MouseEnter);
            lblIndicatorWarning.MouseLeave     += new EventHandler(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]
            aLblList[0]           = new Label();
            aLblList[0].Parent    = pnlParameters;
            aLblList[0].TextAlign = ContentAlignment.BottomCenter;
            aLblList[0].ForeColor = LayoutColors.ColorControlText;
            aLblList[0].BackColor = Color.Transparent;

            // ComboBox aCbxList[0]
            aCbxList[0]                       = new ComboBox();
            aCbxList[0].Parent                = pnlParameters;
            aCbxList[0].DropDownStyle         = ComboBoxStyle.DropDownList;
            aCbxList[0].SelectedIndexChanged += new EventHandler(Param_Changed);

            // Logical Group
            lblGroup           = new Label();
            lblGroup.Parent    = pnlParameters;
            lblGroup.TextAlign = ContentAlignment.BottomCenter;
            lblGroup.ForeColor = LayoutColors.ColorControlText;
            lblGroup.BackColor = Color.Transparent;
            lblGroup.Text      = Language.T("Group");

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

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

                aCbxList[i]         = new ComboBox();
                aCbxList[i].Parent  = pnlParameters;
                aCbxList[i].Enabled = false;
                aCbxList[i].SelectedIndexChanged += new EventHandler(Param_Changed);
                aCbxList[i].DropDownStyle         = ComboBoxStyle.DropDownList;
            }

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

                aNudNumeric[i]               = new NUD();
                aNudNumeric[i].Parent        = pnlParameters;
                aNudNumeric[i].TextAlign     = HorizontalAlignment.Center;
                aNudNumeric[i].Enabled       = false;
                aNudNumeric[i].ValueChanged += new EventHandler(Param_Changed);
            }

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

            //Button Accept
            btnAccept.Parent                  = this;
            btnAccept.Text                    = Language.T("Accept");
            btnAccept.DialogResult            = DialogResult.OK;
            btnAccept.Click                  += new EventHandler(BtnOk_Click);
            btnAccept.UseVisualStyleBackColor = true;

            //Button Default
            btnDefault.Parent = this;
            btnDefault.Text   = Language.T("Default");
            btnDefault.Click += new EventHandler(BtnDefault_Click);
            btnDefault.UseVisualStyleBackColor = true;

            //Button Help
            btnHelp.Parent = this;
            btnHelp.Text   = Language.T("Help");
            btnHelp.Click += new EventHandler(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 (isDefined)
            {
                TreeNode [] atrn = trvIndicators.Nodes.Find(Data.Strategy.Slot[slot].IndParam.IndicatorName, true);
                trvIndicators.SelectedNode = atrn[0];
                UpdateFromIndicatorParam(Data.Strategy.Slot[slot].IndParam);
                SetLogicalGroup();
                CalculateIndicator(false);
                pnlSmallBalanceChart.SetChartData();
                pnlSmallBalanceChart.InitChart();
                pnlSmallBalanceChart.Invalidate();
            }
            else
            {
                string defaultIndicator;
                if (slotType == SlotTypes.Open)
                {
                    defaultIndicator = "Bar Opening";
                }
                else if (slotType == SlotTypes.OpenFilter)
                {
                    defaultIndicator = "Accelerator Oscillator";
                }
                else if (slotType == SlotTypes.Close)
                {
                    defaultIndicator = "Bar Closing";
                }
                else
                {
                    defaultIndicator = "Accelerator Oscillator";
                }

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

            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());
                }
            }

            return;
        }