Forex_Strategy_Builder.Strategy_Properties.Strategy_Properties C# (CSharp) Method

Strategy_Properties() public method

public Strategy_Properties ( ) : System
return System
        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;
        }