Forex_Strategy_Builder.Trading_Charges.Trading_Charges C# (CSharp) Method

Trading_Charges() public method

Constructor
public Trading_Charges ( ) : System
return System
        public Trading_Charges()
        {
            pnlBase = new Fancy_Panel();

            lblSpread     = new Label();
            lblSwapLong   = new Label();
            lblSwapShort  = new Label();
            lblCommission = new Label();
            lblSlippage   = new Label();

            nudSpread     = new NumericUpDown();
            nudSwapLong   = new NumericUpDown();
            nudSwapShort  = new NumericUpDown();
            nudCommission = new NumericUpDown();
            nudSlippage   = new NumericUpDown();

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

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

            MaximizeBox     = false;
            MinimizeBox     = false;
            ShowInTaskbar   = false;
            Icon            = Data.Icon;
            FormBorderStyle = FormBorderStyle.FixedDialog;
            AcceptButton    = btnAccept;
            Text            = Language.T("Trading Charges") + " - " + Data.Symbol;

            // pnlBase
            pnlBase.Parent = this;

            // Label Spread
            lblSpread.Parent    = pnlBase;
            lblSpread.ForeColor = colorText;
            lblSpread.BackColor = Color.Transparent;
            lblSpread.AutoSize  = true;
            lblSpread.Text      = Language.T("Spread") + " [" + Language.T("pips") + "]";

            // Label Swap Long
            lblSwapLong.Parent    = pnlBase;
            lblSwapLong.ForeColor = colorText;
            lblSwapLong.BackColor = Color.Transparent;
            lblSwapLong.AutoSize  = true;
            lblSwapLong.Text      = Language.T("Swap number for a long position rollover") + " [" +
                (Data.InstrProperties.SwapType == Commission_Type.money ?
                Data.InstrProperties.PriceIn :
                Language.T(Data.InstrProperties.SwapType.ToString())) + "]" + Environment.NewLine +
                "(" +  Language.T("A positive value decreases your profit.") +")";

            // Label Swap Short
            lblSwapShort.Parent    = pnlBase;
            lblSwapShort.ForeColor = colorText;
            lblSwapShort.BackColor = Color.Transparent;
            lblSwapShort.AutoSize  = true;
            lblSwapShort.Text      = Language.T("Swap number for a short position rollover") + " [" +
                (Data.InstrProperties.SwapType == Commission_Type.money ?
                Data.InstrProperties.PriceIn :
                Language.T(Data.InstrProperties.SwapType.ToString())) + "]" + Environment.NewLine +
                "(" + Language.T("A negative value decreases your profit.") + ")";

            // Label Commission
            lblCommission.Parent    = pnlBase;
            lblCommission.ForeColor = colorText;
            lblCommission.BackColor = Color.Transparent;
            lblCommission.AutoSize  = true;
            lblCommission.Text = Language.T("Commission in") + " " +
                Data.InstrProperties.CommissionTypeToString  + " " +
                Data.InstrProperties.CommissionScopeToString + " " +
                Data.InstrProperties.CommissionTimeToString  +
                (Data.InstrProperties.CommissionType == Commission_Type.money ? " [" + Data.InstrProperties.PriceIn + "]" : "");

            // Label Slippage
            lblSlippage.Parent    = pnlBase;
            lblSlippage.ForeColor = colorText;
            lblSlippage.BackColor = Color.Transparent;
            lblSlippage.AutoSize  = true;
            lblSlippage.Text      = Language.T("Slippage") + " [" + Language.T("pips") + "]";

            // NumericUpDown Spread
            nudSpread.BeginInit();
            nudSpread.Parent        = pnlBase;
            nudSpread.Name          = Language.T("Spread");
            nudSpread.TextAlign     = HorizontalAlignment.Center;
            nudSpread.Minimum       = 0;
            nudSpread.Maximum       = 500;
            nudSpread.Increment     = 0.01M;
            nudSpread.DecimalPlaces = 2;
            nudSpread.Value         = 4;
            nudSpread.EndInit();
            toolTip.SetToolTip(nudSpread, Language.T("Difference between Bid and Ask prices."));

            // NumericUpDown Swap Long
            nudSwapLong.BeginInit();
            nudSwapLong.Parent        = pnlBase;
            nudSwapLong.Name          = "SwapLong";
            nudSwapLong.TextAlign     = HorizontalAlignment.Center;
            nudSwapLong.Minimum       = -500;
            nudSwapLong.Maximum       = 500;
            nudSwapLong.Increment     = 0.01M;
            nudSwapLong.DecimalPlaces = 2;
            nudSwapLong.Value         = 1;
            nudSwapLong.EndInit();
            toolTip.SetToolTip(nudSwapLong, Language.T("A position changes its average price with the selected number during a rollover."));

            // NumericUpDown Swap Short
            nudSwapShort.BeginInit();
            nudSwapShort.Parent        = pnlBase;
            nudSwapShort.Name          = "SwapShort";
            nudSwapShort.TextAlign     = HorizontalAlignment.Center;
            nudSwapShort.Minimum       = -500;
            nudSwapShort.Maximum       = 500;
            nudSwapShort.Increment     = 0.01M;
            nudSwapShort.DecimalPlaces = 2;
            nudSwapShort.Value         = -1;
            nudSwapShort.EndInit();
            toolTip.SetToolTip(nudSwapShort, Language.T("A position changes its average price with the selected number during a rollover."));

            // NumericUpDown Commission
            nudCommission.BeginInit();
            nudCommission.Parent        = pnlBase;
            nudCommission.Name          = Language.T("Commission");
            nudCommission.TextAlign     = HorizontalAlignment.Center;
            nudCommission.Minimum       = -500;
            nudCommission.Maximum       = 500;
            nudCommission.Increment     = 0.01M;
            nudCommission.DecimalPlaces = 2;
            nudCommission.Value         = 0;
            nudCommission.EndInit();

            // NumericUpDown Slippage
            nudSlippage.BeginInit();
            nudSlippage.Parent    = pnlBase;
            nudSlippage.Name      = "Slippage";
            nudSlippage.TextAlign = HorizontalAlignment.Center;
            nudSlippage.Minimum   = 0;
            nudSlippage.Maximum   = 200;
            nudSlippage.Increment = 1;
            nudSlippage.Value     = 0;
            nudSlippage.EndInit();
            toolTip.SetToolTip(nudSlippage, Language.T("Number of pips you lose due to an inaccurate order execution."));

            //Button btnEditInstrument
            btnEditInstrument.Parent = this;
            btnEditInstrument.Name   = "EditInstrument";
            btnEditInstrument.Text   = Language.T("More");
            btnEditInstrument.Click += new EventHandler(BtnEditInstrument_Click);
            btnEditInstrument.UseVisualStyleBackColor = true;

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

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

            return;
        }