コード例 #1
0
        /// <summary>
        /// Make a form
        /// </summary>
        public StrategyPublish()
        {
            PnlBBCodeBase  = new FancyPanel();
            PnlInfoBase    = new FancyPanel();
            TxboxBBCode    = new TextBox();
            LblInformation = new Label();
            BtnClose       = new Button();
            BtnConnect     = new Button();

            // BBCode_viewer
            AcceptButton = BtnClose;
            BackColor    = LayoutColors.ColorFormBack;
            Icon         = Data.Icon;
            Controls.Add(BtnConnect);
            Controls.Add(BtnClose);
            Controls.Add(PnlBBCodeBase);
            Controls.Add(PnlInfoBase);
            MinimumSize = new Size(400, 400);
            Text        = Language.T("Publish a Strategy");

            PnlBBCodeBase.Padding = new Padding(4, 4, 2, 2);
            PnlInfoBase.Padding   = new Padding(4, 4, 2, 2);

            // TxboxBBCode
            TxboxBBCode.Parent        = PnlBBCodeBase;
            TxboxBBCode.BorderStyle   = BorderStyle.None;
            TxboxBBCode.Dock          = DockStyle.Fill;
            TxboxBBCode.BackColor     = LayoutColors.ColorControlBack;
            TxboxBBCode.ForeColor     = LayoutColors.ColorControlText;
            TxboxBBCode.Multiline     = true;
            TxboxBBCode.AcceptsReturn = true;
            TxboxBBCode.AcceptsTab    = true;
            TxboxBBCode.ScrollBars    = ScrollBars.Vertical;
            TxboxBBCode.KeyDown      += TxboxBBCode_KeyDown;
            TxboxBBCode.Text          = Data.Strategy.GenerateBBCode();

            // LblInformation
            LblInformation.Parent    = PnlInfoBase;
            LblInformation.Dock      = DockStyle.Fill;
            LblInformation.BackColor = Color.Transparent;
            LblInformation.ForeColor = LayoutColors.ColorControlText;
            string strInfo = Language.T("Publishing a strategy in the program's forum:") + Environment.NewLine +
                             "1) " + Language.T("Open a new topic in the forum;") + Environment.NewLine +
                             "2) " + Language.T("Copy / Paste the following code;") + Environment.NewLine +
                             "3) " + Language.T("Describe the strategy.");

            LblInformation.Text = strInfo;

            // BtnClose
            BtnClose.Text   = Language.T("Close");
            BtnClose.Click += BtnCloseClick;
            BtnClose.UseVisualStyleBackColor = true;

            // BtnConnect
            BtnConnect.Text   = Language.T("Connect to") + " http://forexsb.com/forum";
            BtnConnect.Click += BtnConnectClick;
            BtnConnect.UseVisualStyleBackColor = true;
        }
コード例 #2
0
        /// <summary>
        /// Make a form
        /// </summary>
        public StrategyPublish()
        {
            PnlBBCodeBase = new FancyPanel();
            PnlInfoBase = new FancyPanel();
            TxboxBBCode = new TextBox();
            LblInformation = new Label();
            BtnClose = new Button();
            BtnConnect = new Button();

            // BBCode_viewer
            AcceptButton = BtnClose;
            BackColor = LayoutColors.ColorFormBack;
            Icon = Data.Icon;
            Controls.Add(BtnConnect);
            Controls.Add(BtnClose);
            Controls.Add(PnlBBCodeBase);
            Controls.Add(PnlInfoBase);
            MinimumSize = new Size(400, 400);
            Text = Language.T("Publish a Strategy");

            PnlBBCodeBase.Padding = new Padding(4, 4, 2, 2);
            PnlInfoBase.Padding = new Padding(4, 4, 2, 2);

            // TxboxBBCode
            TxboxBBCode.Parent = PnlBBCodeBase;
            TxboxBBCode.BorderStyle = BorderStyle.None;
            TxboxBBCode.Dock = DockStyle.Fill;
            TxboxBBCode.BackColor = LayoutColors.ColorControlBack;
            TxboxBBCode.ForeColor = LayoutColors.ColorControlText;
            TxboxBBCode.Multiline = true;
            TxboxBBCode.AcceptsReturn = true;
            TxboxBBCode.AcceptsTab = true;
            TxboxBBCode.ScrollBars = ScrollBars.Vertical;
            TxboxBBCode.KeyDown += TxboxBBCode_KeyDown;
            TxboxBBCode.Text = Data.Strategy.GenerateBBCode();

            // LblInformation
            LblInformation.Parent = PnlInfoBase;
            LblInformation.Dock = DockStyle.Fill;
            LblInformation.BackColor = Color.Transparent;
            LblInformation.ForeColor = LayoutColors.ColorControlText;
            string strInfo = Language.T("Publishing a strategy in the program's forum:") + Environment.NewLine +
                             "1) " + Language.T("Open a new topic in the forum;") + Environment.NewLine +
                             "2) " + Language.T("Copy / Paste the following code;") + Environment.NewLine +
                             "3) " + Language.T("Describe the strategy.");
            LblInformation.Text = strInfo;

            // BtnClose
            BtnClose.Text = Language.T("Close");
            BtnClose.Click += BtnCloseClick;
            BtnClose.UseVisualStyleBackColor = true;

            // BtnConnect
            BtnConnect.Text = Language.T("Connect to") + " http://forexsb.com/forum";
            BtnConnect.Click += BtnConnectClick;
            BtnConnect.UseVisualStyleBackColor = true;
        }
コード例 #3
0
        /// <summary>
        /// Public Constructor
        /// </summary>
        public FancyMessageBox(string text, string title)
        {
            BoxHeight    = 230;
            BoxWidth     = 380;
            PanelBase    = new FancyPanel();
            PanelControl = new Panel();
            HTMLViewer   = new WebBrowser();
            ButtonClose  = new Button();

            Text          = title;
            Icon          = Data.Icon;
            MaximizeBox   = false;
            MinimizeBox   = false;
            ShowInTaskbar = false;
            TopMost       = true;
            AcceptButton  = ButtonClose;

            PanelBase.Parent = this;

            HTMLViewer.Parent              = PanelBase;
            HTMLViewer.AllowNavigation     = false;
            HTMLViewer.AllowWebBrowserDrop = false;
            HTMLViewer.DocumentText        = GetHTMLContent(text, title);
            HTMLViewer.Dock    = DockStyle.Fill;
            HTMLViewer.TabStop = false;
            HTMLViewer.IsWebBrowserContextMenuEnabled = false;
            HTMLViewer.WebBrowserShortcutsEnabled     = true;

            PanelControl.Parent    = this;
            PanelControl.Dock      = DockStyle.Bottom;
            PanelControl.BackColor = Color.Transparent;

            ButtonClose.Parent = PanelControl;
            ButtonClose.Text   = Language.T("Close");
            ButtonClose.Name   = "Close";
            ButtonClose.Click += BtnCloseClick;
            ButtonClose.UseVisualStyleBackColor = true;
        }
コード例 #4
0
        /// <summary>
        /// Public Constructor
        /// </summary>
        public FancyMessageBox(string text, string title)
        {
            BoxHeight = 230;
            BoxWidth = 380;
            PanelBase = new FancyPanel();
            PanelControl = new Panel();
            HTMLViewer = new WebBrowser();
            ButtonClose = new Button();

            Text = title;
            Icon = Data.Icon;
            MaximizeBox = false;
            MinimizeBox = false;
            ShowInTaskbar = false;
            TopMost = true;
            AcceptButton = ButtonClose;

            PanelBase.Parent = this;

            HTMLViewer.Parent = PanelBase;
            HTMLViewer.AllowNavigation = false;
            HTMLViewer.AllowWebBrowserDrop = false;
            HTMLViewer.DocumentText = GetHTMLContent(text, title);
            HTMLViewer.Dock = DockStyle.Fill;
            HTMLViewer.TabStop = false;
            HTMLViewer.IsWebBrowserContextMenuEnabled = false;
            HTMLViewer.WebBrowserShortcutsEnabled = true;

            PanelControl.Parent = this;
            PanelControl.Dock = DockStyle.Bottom;
            PanelControl.BackColor = Color.Transparent;

            ButtonClose.Parent = PanelControl;
            ButtonClose.Text = Language.T("Close");
            ButtonClose.Name = "Close";
            ButtonClose.Click += BtnCloseClick;
            ButtonClose.UseVisualStyleBackColor = true;
        }
コード例 #5
0
        public AboutScreen()
        {
            PnlBase     = new FancyPanel();
            Label1      = new Label();
            Label2      = new Label();
            Label3      = new Label();
            Label4      = new Label();
            Label5      = new Label();
            Label6      = new Label();
            PictureBox1 = new PictureBox();
            LlWebsite   = new LinkLabel();
            LlForum     = new LinkLabel();
            LlEmail     = new LinkLabel();
            LlCredits   = new LinkLabel();
            BtnOk       = new Button();

            // Panel Base
            PnlBase.Parent = this;

            // pictureBox1
            PictureBox1.TabStop   = false;
            PictureBox1.BackColor = Color.Transparent;
            PictureBox1.Image     = Resources.Logo;

            // label1
            Label1.AutoSize  = true;
            Label1.Font      = new Font("Microsoft Sans Serif", 16F, FontStyle.Bold);
            Label1.ForeColor = LayoutColors.ColorControlText;
            Label1.BackColor = Color.Transparent;
            Label1.Text      = Data.ProgramName;

            string stage = String.Empty;

            if (Data.IsProgramBeta)
            {
                stage = " " + Language.T("Beta");
            }
            else if (Data.IsProgramRC)
            {
                stage = " " + "RC";
            }

            // label2
            Label2.AutoSize  = true;
            Label2.Font      = new Font("Microsoft Sans Serif", 12F);
            Label2.ForeColor = LayoutColors.ColorControlText;
            Label2.BackColor = Color.Transparent;
            Label2.Text      = Language.T("Version") + ": " + Data.ProgramVersion + stage;

            // label3
            Label3.AutoSize  = true;
            Label3.Font      = new Font("Microsoft Sans Serif", 10F);
            Label3.ForeColor = LayoutColors.ColorControlText;
            Label3.BackColor = Color.Transparent;
            Label3.Text      = "Copyright © 2006 - 2012 Miroslav Popov" + Environment.NewLine + Language.T("Distributor") +
                               " - Forex Software Ltd." + Environment.NewLine + Environment.NewLine +
                               Language.T("This is a freeware program!");

            // label4
            Label4.AutoSize  = true;
            Label4.ForeColor = LayoutColors.ColorControlText;
            Label4.BackColor = Color.Transparent;
            Label4.Text      = Language.T("Website") + ":";

            // label5
            Label5.AutoSize  = true;
            Label5.ForeColor = LayoutColors.ColorControlText;
            Label5.BackColor = Color.Transparent;
            Label5.Text      = Language.T("Support forum") + ":";

            // label6
            Label6.AutoSize  = true;
            Label6.ForeColor = LayoutColors.ColorControlText;
            Label6.BackColor = Color.Transparent;
            Label6.Text      = Language.T("Contacts") + ":";

            // llWebsite
            LlWebsite.AutoSize     = true;
            LlWebsite.TabStop      = true;
            LlWebsite.BackColor    = Color.Transparent;
            LlWebsite.Text         = "http://forexsb.com";
            LlWebsite.Tag          = "http://forexsb.com/";
            LlWebsite.LinkClicked += WebsiteLinkClicked;

            // llForum
            LlForum.AutoSize     = true;
            LlForum.TabStop      = true;
            LlForum.BackColor    = Color.Transparent;
            LlForum.Text         = "http://forexsb.com/forum";
            LlForum.Tag          = "http://forexsb.com/forum/";
            LlForum.LinkClicked += WebsiteLinkClicked;

            // llEmail
            LlEmail.AutoSize     = true;
            LlEmail.TabStop      = true;
            LlEmail.BackColor    = Color.Transparent;
            LlEmail.Text         = "*****@*****.**";
            LlEmail.Tag          = "mailto:[email protected]";
            LlEmail.LinkClicked += WebsiteLinkClicked;

            // LlCredits
            LlCredits.AutoSize     = true;
            LlCredits.TabStop      = true;
            LlCredits.BackColor    = Color.Transparent;
            LlCredits.Text         = Language.T("Credits and Contributors");
            LlCredits.Tag          = "http://forexsb.com/wiki/credits";
            LlCredits.LinkClicked += WebsiteLinkClicked;

            // Button Base
            BtnOk.Parent = this;
            BtnOk.Text   = Language.T("Ok");
            BtnOk.UseVisualStyleBackColor = true;
            BtnOk.Click += BtnOkClick;

            // AboutScreen
            PnlBase.Controls.Add(Label1);
            PnlBase.Controls.Add(Label2);
            PnlBase.Controls.Add(Label3);
            PnlBase.Controls.Add(Label4);
            PnlBase.Controls.Add(Label5);
            PnlBase.Controls.Add(Label6);
            PnlBase.Controls.Add(LlEmail);
            PnlBase.Controls.Add(LlForum);
            PnlBase.Controls.Add(LlWebsite);
            PnlBase.Controls.Add(LlCredits);
            PnlBase.Controls.Add(PictureBox1);

            StartPosition   = FormStartPosition.CenterScreen;
            Text            = Language.T("About") + " " + Data.ProgramName;
            FormBorderStyle = FormBorderStyle.FixedDialog;
            BackColor       = LayoutColors.ColorFormBack;
            MaximizeBox     = false;
            MinimizeBox     = false;
            ShowInTaskbar   = false;
            ClientSize      = new Size(360, 310);
        }
コード例 #6
0
        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;
        }
コード例 #7
0
        /// <summary>
        /// Constructor
        /// </summary>
        public TradingCharges()
        {
            PnlBase = new FancyPanel();

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

            _colorText = LayoutColors.ColorControlText;

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

            var toolTip = new ToolTip();


            // 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 == CommissionType.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 == CommissionType.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 == CommissionType.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 += BtnEditInstrumentClick;
            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;
        }
コード例 #8
0
        /// <summary>
        /// Public Constructor
        /// </summary>
        public StartingTips()
        {
            PnlBase    = new FancyPanel();
            PnlControl = new Panel();
            Browser    = new WebBrowser();
            ChboxShow  = new CheckBox();
            BtnNextTip = new Button();
            BtnPrevTip = new Button();
            BtnClose   = new Button();

            _xmlTips = new XmlDocument();

            Text            = Language.T("Tip of the Day");
            FormBorderStyle = FormBorderStyle.FixedDialog;
            Icon            = Data.Icon;
            MaximizeBox     = false;
            MinimizeBox     = false;
            TopMost         = true;

            PnlBase.Parent = this;

            Browser.Parent              = PnlBase;
            Browser.AllowNavigation     = true;
            Browser.AllowWebBrowserDrop = false;
            Browser.DocumentText        = Language.T("Loading...");
            Browser.Dock               = DockStyle.Fill;
            Browser.TabStop            = false;
            Browser.DocumentCompleted += BrowserDocumentCompleted;
            Browser.IsWebBrowserContextMenuEnabled = false;
            Browser.WebBrowserShortcutsEnabled     = false;

            PnlControl.Parent    = this;
            PnlControl.Dock      = DockStyle.Bottom;
            PnlControl.BackColor = Color.Transparent;

            ChboxShow.Parent             = PnlControl;
            ChboxShow.Text               = Language.T("Show a tip");
            ChboxShow.Checked            = Configs.ShowStartingTip;
            ChboxShow.TextAlign          = ContentAlignment.MiddleLeft;
            ChboxShow.AutoSize           = true;
            ChboxShow.ForeColor          = LayoutColors.ColorControlText;
            ChboxShow.CheckStateChanged += ChboxShowCheckStateChanged;

            BtnNextTip.Parent = PnlControl;
            BtnNextTip.Text   = Language.T("Next Tip");
            BtnNextTip.Name   = "Next";
            BtnNextTip.Click += Navigate;
            BtnNextTip.UseVisualStyleBackColor = true;

            BtnPrevTip.Parent = PnlControl;
            BtnPrevTip.Text   = Language.T("Previous Tip");
            BtnPrevTip.Name   = "Previous";
            BtnPrevTip.Click += Navigate;
            BtnPrevTip.UseVisualStyleBackColor = true;

            BtnClose.Parent = PnlControl;
            BtnClose.Text   = Language.T("Close");
            BtnClose.Name   = "Close";
            BtnClose.Click += Navigate;
            BtnClose.UseVisualStyleBackColor = true;

            LoadStartingTips();
        }
コード例 #9
0
        /// <summary>
        /// Constructor
        /// </summary>
        public NewTranslation()
        {
            // The form
            MaximizeBox = false;
            MinimizeBox = false;
            Icon = Data.Icon;
            BackColor = LayoutColors.ColorFormBack;
            FormBorderStyle = FormBorderStyle.FixedDialog;
            Text = Language.T("New Translation");

            // Controls
            PnlInput = new FancyPanel(Language.T("Common Parameters"));
            AlblInputNames = new Label[5];
            AtbxInputValues = new TextBox[5];
            BtnAccept = new Button();
            BtnCancel = new Button();

            // Input
            PnlInput.Parent = this;

            // Input Names
            var asInputNames = new[]
                                   {
                                       Language.T("Language"),
                                       Language.T("File name"),
                                       Language.T("Author"),
                                       Language.T("Website"),
                                       Language.T("Contacts")
                                   };

            // Input Values
            var asInputValues = new[]
                                    {
                                        "Language",
                                        "Language",
                                        "Your Name",
                                        "http://forexsb.com",
                                        "*****@*****.**"
                                    };

            // Input parameters
            for (int i = 0; i < asInputNames.Length; i++)
            {
                AlblInputNames[i] = new Label
                                        {
                                            Parent = PnlInput,
                                            ForeColor = LayoutColors.ColorControlText,
                                            BackColor = Color.Transparent,
                                            AutoSize = true,
                                            Text = asInputNames[i]
                                        };

                AtbxInputValues[i] = new TextBox {Parent = PnlInput, Text = asInputValues[i]};
            }

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

            //Button Accept
            BtnAccept.Parent = this;
            BtnAccept.Name = "Accept";
            BtnAccept.Text = Language.T("Accept");
            BtnAccept.DialogResult = DialogResult.OK;
            BtnAccept.Click += BtnClick;
            BtnAccept.UseVisualStyleBackColor = true;
        }
コード例 #10
0
        /// <summary>
        /// Constructor
        /// </summary>
        public EditTranslation()
        {
            // The form
            MaximizeBox = false;
            MinimizeBox = false;
            Icon = Data.Icon;
            BackColor = LayoutColors.ColorFormBack;
            FormBorderStyle = FormBorderStyle.FixedDialog;
            Text = Language.T("Edit Translation");
            FormClosing += ActionsFormClosing;

            // Controls
            PnlCommon = new FancyPanel(Language.T("Common Parameters"));
            PnlPhrases = new FancyPanel(Language.T("English Phrase - Translated Phrase"));
            AlblInputNames = new Label[5];
            AtbxInputValues = new TextBox[5];
            AtbxMain = new TextBox[Textboxes];
            AtbxAlt = new TextBox[Textboxes];
            ScrollBar = new VScrollBar();
            TbxSearch = new TextBox();
            BtnSearch = new Button();
            BtnUntranslated = new Button();
            BtnAccept = new Button();
            BtnCancel = new Button();

            // Common
            PnlCommon.Parent = this;

            // Phrases
            PnlPhrases.Parent = this;

            // Input Names
            var asInputNames = new[]
                                   {
                                       Language.T("Language"),
                                       Language.T("File name"),
                                       Language.T("Author"),
                                       Language.T("Website"),
                                       Language.T("Contacts")
                                   };

            // Input Values
            var asInputValues = new[]
                                    {
                                        Configs.Language,
                                        Language.LanguageFileName,
                                        Language.Author,
                                        Language.AuthorsWebsite,
                                        Language.AuthorsEmail
                                    };

            // Common parameters
            for (int i = 0; i < asInputNames.Length; i++)
            {
                AlblInputNames[i] = new Label
                                        {
                                            Parent = PnlCommon,
                                            ForeColor = LayoutColors.ColorControlText,
                                            BackColor = Color.Transparent,
                                            AutoSize = true,
                                            Text = asInputNames[i]
                                        };

                AtbxInputValues[i] = new TextBox {Parent = PnlCommon, Text = asInputValues[i]};
            }

            // Phrases
            for (int i = 0; i < Textboxes; i++)
            {
                AtbxMain[i] = new TextBox
                                  {Parent = PnlPhrases, Multiline = true, ReadOnly = true, ForeColor = Color.DarkGray};

                AtbxAlt[i] = new TextBox {Parent = PnlPhrases, Multiline = true, Tag = i};
                AtbxAlt[i].TextChanged += EditTranslationTextChanged;
            }

            // Vertical ScrollBar
            ScrollBar.Parent = PnlPhrases;
            ScrollBar.Visible = true;
            ScrollBar.Enabled = true;
            ScrollBar.ValueChanged += ScrollBarValueChanged;
            ScrollBar.TabStop = true;

            // TextBox Search
            TbxSearch.Parent = this;
            TbxSearch.TextChanged += TbxSearchTextChanged;

            // Button Search
            BtnSearch.Parent = this;
            BtnSearch.Name = "Search";
            BtnSearch.Text = Language.T("Search");
            BtnSearch.Click += BtnClick;
            BtnSearch.UseVisualStyleBackColor = true;

            // Button Untranslated
            BtnUntranslated.Parent = this;
            BtnUntranslated.Name = "Untranslated";
            BtnUntranslated.Text = Language.T("Not Translated");
            BtnUntranslated.Click += BtnClick;
            BtnUntranslated.UseVisualStyleBackColor = true;

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

            // Button Accept
            BtnAccept.Parent = this;
            BtnAccept.Name = "Accept";
            BtnAccept.Text = Language.T("Accept");
            BtnAccept.DialogResult = DialogResult.OK;
            BtnAccept.Click += BtnClick;
            BtnAccept.Enabled = false;
            BtnAccept.UseVisualStyleBackColor = true;
        }
コード例 #11
0
        /// <summary>
        /// Constructor
        /// </summary>
        public PivotPointsCalculator()
        {
            PnlInput  = new FancyPanel(Language.T("Input Values"));
            PnlOutput = new FancyPanel(Language.T("Output Values"));

            AlblInputNames   = new Label[3];
            AtbxInputValues  = new TextBox[3];
            AlblOutputNames  = new Label[7];
            AlblOutputValues = new Label[7];

            _colorText = LayoutColors.ColorControlText;

            MaximizeBox     = false;
            MinimizeBox     = false;
            Icon            = Data.Icon;
            BackColor       = LayoutColors.ColorFormBack;
            FormBorderStyle = FormBorderStyle.FixedDialog;
            Text            = Language.T("Pivot Points");

            PnlInput.Parent  = this;
            PnlOutput.Parent = this;

            // Input Names
            var inputNames = new[]
            {
                Language.T("Highest price"),
                Language.T("Closing price"),
                Language.T("Lowest price")
            };

            int number = 0;

            foreach (string name in inputNames)
            {
                AlblInputNames[number] = new Label
                {
                    Parent    = PnlInput,
                    ForeColor = _colorText,
                    BackColor = Color.Transparent,
                    AutoSize  = true,
                    Text      = name
                };

                AtbxInputValues[number] = new TextBox {
                    Parent = PnlInput
                };
                AtbxInputValues[number].TextChanged += TbxInputTextChanged;
                number++;
            }

            var outputNames = new[]
            {
                Language.T("Resistance") + " 3",
                Language.T("Resistance") + " 2",
                Language.T("Resistance") + " 1",
                Language.T("Pivot Point"),
                Language.T("Support") + " 1",
                Language.T("Support") + " 2",
                Language.T("Support") + " 3"
            };

            number = 0;
            foreach (string name in outputNames)
            {
                AlblOutputNames[number] = new Label
                {
                    Parent    = PnlOutput,
                    ForeColor = _colorText,
                    BackColor = Color.Transparent,
                    AutoSize  = true,
                    Text      = name
                };

                AlblOutputValues[number] = new Label
                {
                    Parent    = PnlOutput,
                    ForeColor = _colorText,
                    BackColor = Color.Transparent,
                    AutoSize  = true
                };

                number++;
            }

            Font font = Font;

            AlblOutputNames[3].Font  = new Font(font.FontFamily, font.Size, FontStyle.Bold);
            AlblOutputValues[3].Font = new Font(font.FontFamily, font.Size, FontStyle.Bold);
        }
コード例 #12
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public DataHorizon(int maxBars, DateTime startTime, DateTime endTime, bool useStartTime, bool useEndTime)
        {
            MaxBars      = maxBars;
            StartTime    = startTime;
            EndTime      = endTime;
            UseEndTime   = useEndTime;
            UseStartTime = useStartTime;

            BtnAccept       = new Button();
            BtnHelp         = new Button();
            BtnCancel       = new Button();
            PnlBase         = new FancyPanel();
            DtpStartTime    = new DateTimePicker();
            DtpEndTime      = new DateTimePicker();
            CbxUseEndTime   = new CheckBox();
            CbxUseStartTime = new CheckBox();
            NUDMaxBars      = new NumericUpDown();
            LblMaxBars      = new Label();
            LblMinBars      = new Label();

            MaximizeBox     = false;
            MinimizeBox     = false;
            ShowInTaskbar   = false;
            Icon            = Data.Icon;
            FormBorderStyle = FormBorderStyle.FixedDialog;
            AcceptButton    = BtnAccept;
            Text            = Language.T("Data Horizon");

            var toolTip = new ToolTip();

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

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

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

            // Panel Base
            PnlBase.Parent = this;

            // Check box UesStartTime
            CbxUseStartTime.Parent             = PnlBase;
            CbxUseStartTime.AutoSize           = true;
            CbxUseStartTime.ForeColor          = LayoutColors.ColorControlText;
            CbxUseStartTime.BackColor          = Color.Transparent;
            CbxUseStartTime.Text               = Language.T("Remove data older than:");
            CbxUseStartTime.CheckStateChanged += UseStartTimeCheckStateChanged;
            toolTip.SetToolTip(CbxUseStartTime, Language.T("All data older than the specified date will be cut out."));

            // Check box UesEndTime
            CbxUseEndTime.Parent             = PnlBase;
            CbxUseEndTime.ForeColor          = LayoutColors.ColorControlText;
            CbxUseEndTime.BackColor          = Color.Transparent;
            CbxUseEndTime.AutoSize           = true;
            CbxUseEndTime.Text               = Language.T("Remove data newer than:");
            CbxUseEndTime.CheckStateChanged += UseEndTimeCheckStateChanged;
            toolTip.SetToolTip(CbxUseEndTime, Language.T("All data newer than the specified date will be cut out."));

            // StartTime
            DtpStartTime.Parent        = PnlBase;
            DtpStartTime.ForeColor     = LayoutColors.ColorControlText;
            DtpStartTime.Format        = DateTimePickerFormat.Custom;
            DtpStartTime.CustomFormat  = "MMMM dd, yyyy - dddd,   HH : mm";
            DtpStartTime.ShowUpDown    = true;
            DtpStartTime.ValueChanged += StartTimeValueChanged;

            // EndTime
            DtpEndTime.Parent        = PnlBase;
            DtpEndTime.ForeColor     = LayoutColors.ColorControlText;
            DtpEndTime.Format        = DateTimePickerFormat.Custom;
            DtpEndTime.CustomFormat  = "MMMM dd, yyyy - dddd,   HH : mm";
            DtpEndTime.ShowUpDown    = true;
            DtpEndTime.ValueChanged += EndTimeValueChanged;

            // LabelMaxBars
            LblMaxBars.Parent    = PnlBase;
            LblMaxBars.AutoSize  = true;
            LblMaxBars.ForeColor = LayoutColors.ColorControlText;
            LblMaxBars.BackColor = Color.Transparent;
            LblMaxBars.Text      = Language.T("Maximum number of bars:");
            LblMaxBars.TextAlign = ContentAlignment.MiddleLeft;

            // MaxBars
            NUDMaxBars.BeginInit();
            NUDMaxBars.Parent             = PnlBase;
            NUDMaxBars.Name               = "MaxBars";
            NUDMaxBars.Minimum            = Configs.MinBars;
            NUDMaxBars.Maximum            = Configs.MaxBarsLimit;
            NUDMaxBars.ThousandsSeparator = true;
            NUDMaxBars.ValueChanged      += MaxBarsValueChanged;
            NUDMaxBars.TextAlign          = HorizontalAlignment.Center;
            NUDMaxBars.EndInit();

            // Label MinBars
            LblMinBars.Parent    = PnlBase;
            LblMinBars.AutoSize  = true;
            LblMinBars.ForeColor = LayoutColors.ColorControlText;
            LblMinBars.BackColor = Color.Transparent;
            LblMinBars.Text      = Language.T("Minimum number of bars:") + " " + Configs.MinBars;
            LblMinBars.TextAlign = ContentAlignment.MiddleLeft;
        }
コード例 #13
0
        /// <summary>
        /// Constructor
        /// </summary>
        public MetaTrader4Import()
        {
            LblIntro         = new Label();
            TxbDataDirectory = new TextBox();
            BtnBrowse        = new Button();
            PnlSettings      = new FancyPanel();
            PnlInfoBase      = new FancyPanel(Language.T("Imported Files"));
            TbxInfo          = new TextBox();
            BtnHelp          = new Button();
            BtnClose         = new Button();
            BtnImport        = new Button();
            ProgressBarFile  = new ProgressBar();
            ProgressBar      = new ProgressBar();
            LblDestFolder    = new Label();
            TxbDestFolder    = new TextBox();
            BtnDestFolder    = new Button();

            LblStartingDate = new Label();
            DtpStartingDate = new DateTimePicker();
            LblEndingDate   = new Label();
            DtpEndingDate   = new DateTimePicker();

            _colorText = LayoutColors.ColorControlText;

            MaximizeBox     = false;
            MinimizeBox     = false;
            ShowInTaskbar   = false;
            Icon            = Data.Icon;
            FormBorderStyle = FormBorderStyle.FixedDialog;
            AcceptButton    = BtnImport;
            CancelButton    = BtnClose;
            Text            = Language.T("MetaTrader 4 Import");

            // Label Intro
            LblIntro.Parent    = PnlSettings;
            LblIntro.ForeColor = _colorText;
            LblIntro.BackColor = Color.Transparent;
            LblIntro.AutoSize  = true;
            LblIntro.Text      = Language.T("Directory containing MetaTrader 4 HST files:");

            // Data Directory
            TxbDataDirectory.Parent    = PnlSettings;
            TxbDataDirectory.BackColor = LayoutColors.ColorControlBack;
            TxbDataDirectory.ForeColor = _colorText;
            TxbDataDirectory.Text      = Configs.MetaTrader4DataPath;

            // Button Browse
            BtnBrowse.Parent = PnlSettings;
            BtnBrowse.Name   = "Browse";
            BtnBrowse.Text   = Language.T("Browse");
            BtnBrowse.Click += BtnBrowseClick;
            BtnBrowse.UseVisualStyleBackColor = true;

            // Label Starting Date
            LblStartingDate.Parent    = PnlSettings;
            LblStartingDate.ForeColor = _colorText;
            LblStartingDate.BackColor = Color.Transparent;
            LblStartingDate.AutoSize  = true;
            LblStartingDate.Text      = Language.T("Starting Date:");

            // Starting Date
            DtpStartingDate.Parent     = PnlSettings;
            DtpStartingDate.ForeColor  = LayoutColors.ColorCaptionText;
            DtpStartingDate.ShowUpDown = true;

            // Label Ending Date
            LblEndingDate.Parent    = PnlSettings;
            LblEndingDate.ForeColor = _colorText;
            LblEndingDate.BackColor = Color.Transparent;
            LblEndingDate.AutoSize  = true;
            LblEndingDate.Text      = Language.T("Ending Date:");

            // Ending Date
            DtpEndingDate.Parent     = PnlSettings;
            DtpEndingDate.ForeColor  = LayoutColors.ColorCaptionText;
            DtpEndingDate.ShowUpDown = true;

            // LblDestFolder
            LblDestFolder.Parent    = PnlSettings;
            LblDestFolder.ForeColor = LayoutColors.ColorControlText;
            LblDestFolder.BackColor = Color.Transparent;
            LblDestFolder.AutoSize  = true;
            LblDestFolder.Text      = Language.T("Select a destination folder") + ":";

            // TxbDestFolder
            TxbDestFolder.Parent    = PnlSettings;
            TxbDestFolder.BackColor = LayoutColors.ColorControlBack;
            TxbDestFolder.ForeColor = LayoutColors.ColorControlText;
            TxbDestFolder.Text      = String.IsNullOrEmpty(Configs.MT4ImportDestFolder) ? Data.OfflineDataDir : Configs.MT4ImportDestFolder;

            // BtnDestFolder
            BtnDestFolder.Parent = PnlSettings;
            BtnDestFolder.Name   = "BtnDestFolder";
            BtnDestFolder.Text   = Language.T("Browse");
            BtnDestFolder.Click += BtnDestFolderClick;
            BtnDestFolder.UseVisualStyleBackColor = true;

            // PnlSettings
            PnlSettings.Parent = this;

            // PnlInfoBase
            PnlInfoBase.Parent  = this;
            PnlInfoBase.Padding = new Padding(4, (int)PnlInfoBase.CaptionHeight, 2, 2);

            // TbxInfo
            TbxInfo.Parent        = PnlInfoBase;
            TbxInfo.BorderStyle   = BorderStyle.None;
            TbxInfo.Dock          = DockStyle.Fill;
            TbxInfo.BackColor     = LayoutColors.ColorControlBack;
            TbxInfo.ForeColor     = LayoutColors.ColorControlText;
            TbxInfo.Multiline     = true;
            TbxInfo.AcceptsReturn = true;
            TbxInfo.AcceptsTab    = true;
            TbxInfo.ScrollBars    = ScrollBars.Vertical;

            // ProgressBarFile
            ProgressBarFile.Parent = this;

            // ProgressBar
            ProgressBar.Parent = this;

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

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

            // Button Import
            BtnImport.Parent = this;
            BtnImport.Name   = "Import";
            BtnImport.Text   = Language.T("Import");
            BtnImport.Click += BtnImportClick;
            BtnImport.UseVisualStyleBackColor = true;

            // BackGroundWorker
            _bgWorker = new BackgroundWorker {
                WorkerReportsProgress = true, WorkerSupportsCancellation = true
            };
            _bgWorker.DoWork             += BgWorkerDoWork;
            _bgWorker.RunWorkerCompleted += BgWorkerRunWorkerCompleted;
        }
コード例 #14
0
        /// <summary>
        /// Make a form
        /// </summary>
        public StrategyDescription()
        {
            PnlBase = new Panel();
            PnlWarnBase = new FancyPanel();
            LblWarning = new Label();
            PnlTbxBase = new FancyPanel(Language.T("Strategy Description"));
            TxboxInfo = new TextBox();
            BtnClose = new Button();
            BtnAccept = new Button();
            BtnClear = new Button();

            AcceptButton = BtnClose;
            BackColor = LayoutColors.ColorFormBack;
            Icon = Data.Icon;
            MinimumSize = new Size(400, 400);
            Text = Language.T("Strategy Description");
            FormClosing += ActionsFormClosing;

            Controls.Add(PnlBase);
            Controls.Add(BtnAccept);
            Controls.Add(BtnClose);
            Controls.Add(BtnClear);

            // PnlWarnBase
            PnlWarnBase.Parent = this;
            PnlWarnBase.Padding = new Padding(2, 4, 2, 2);

            // LblWarning
            LblWarning.Parent = PnlWarnBase;
            LblWarning.TextAlign = ContentAlignment.MiddleCenter;
            LblWarning.BackColor = Color.Transparent;
            LblWarning.ForeColor = LayoutColors.ColorControlText;
            LblWarning.AutoSize = false;
            LblWarning.Dock = DockStyle.Fill;
            if (Data.Strategy.Description != "")
            {
                if (!Data.IsStrDescriptionRelevant())
                {
                    LblWarning.Font = new Font(Font, FontStyle.Bold);
                    LblWarning.Text = Language.T("This description might be outdated!");
                }
                else
                    LblWarning.Text = Path.GetFileNameWithoutExtension(Data.StrategyName);
            }
            else
                LblWarning.Text = Language.T("You can write a description of the strategy!");

            PnlTbxBase.Parent = PnlBase;
            PnlTbxBase.Padding = new Padding(4, (int) PnlTbxBase.CaptionHeight + 1, 2, 3);
            PnlTbxBase.Dock = DockStyle.Fill;

            // TxboxInfo
            TxboxInfo.Parent = PnlTbxBase;
            TxboxInfo.Dock = DockStyle.Fill;
            TxboxInfo.BackColor = LayoutColors.ColorControlBack;
            TxboxInfo.ForeColor = LayoutColors.ColorControlText;
            TxboxInfo.BorderStyle = BorderStyle.None;
            TxboxInfo.Multiline = true;
            TxboxInfo.AcceptsReturn = true;
            TxboxInfo.AcceptsTab = true;
            TxboxInfo.ScrollBars = ScrollBars.Vertical;
            TxboxInfo.KeyDown += TxboxInfo_KeyDown;
            TxboxInfo.Text = Data.Strategy.Description;
            TxboxInfo.Select(0, 0);

            // BtnClose
            BtnClose.Text = Language.T("Close");
            BtnClose.Click += BtnCloseClick;
            BtnClose.UseVisualStyleBackColor = true;

            // BtnAccept
            BtnAccept.Text = Language.T("Accept");
            BtnAccept.Click += BtnAcceptClick;
            BtnAccept.UseVisualStyleBackColor = true;

            // BtnClear
            BtnClear.Text = Language.T("Clear");
            BtnClear.Click += BtnClearClick;
            BtnClear.UseVisualStyleBackColor = true;

            _oldInfo = Data.Strategy.Description;
        }
コード例 #15
0
        /// <summary>
        /// Make a form
        /// </summary>
        public StrategyDescription()
        {
            PnlBase     = new Panel();
            PnlWarnBase = new FancyPanel();
            LblWarning  = new Label();
            PnlTbxBase  = new FancyPanel(Language.T("Strategy Description"));
            TxboxInfo   = new TextBox();
            BtnClose    = new Button();
            BtnAccept   = new Button();
            BtnClear    = new Button();

            AcceptButton = BtnClose;
            BackColor    = LayoutColors.ColorFormBack;
            Icon         = Data.Icon;
            MinimumSize  = new Size(400, 400);
            Text         = Language.T("Strategy Description");
            FormClosing += ActionsFormClosing;

            Controls.Add(PnlBase);
            Controls.Add(BtnAccept);
            Controls.Add(BtnClose);
            Controls.Add(BtnClear);

            // PnlWarnBase
            PnlWarnBase.Parent  = this;
            PnlWarnBase.Padding = new Padding(2, 4, 2, 2);

            // LblWarning
            LblWarning.Parent    = PnlWarnBase;
            LblWarning.TextAlign = ContentAlignment.MiddleCenter;
            LblWarning.BackColor = Color.Transparent;
            LblWarning.ForeColor = LayoutColors.ColorControlText;
            LblWarning.AutoSize  = false;
            LblWarning.Dock      = DockStyle.Fill;
            if (Data.Strategy.Description != "")
            {
                if (!Data.IsStrDescriptionRelevant())
                {
                    LblWarning.Font = new Font(Font, FontStyle.Bold);
                    LblWarning.Text = Language.T("This description might be outdated!");
                }
                else
                {
                    LblWarning.Text = Path.GetFileNameWithoutExtension(Data.StrategyName);
                }
            }
            else
            {
                LblWarning.Text = Language.T("You can write a description of the strategy!");
            }

            PnlTbxBase.Parent  = PnlBase;
            PnlTbxBase.Padding = new Padding(4, (int)PnlTbxBase.CaptionHeight + 1, 2, 3);
            PnlTbxBase.Dock    = DockStyle.Fill;


            // TxboxInfo
            TxboxInfo.Parent        = PnlTbxBase;
            TxboxInfo.Dock          = DockStyle.Fill;
            TxboxInfo.BackColor     = LayoutColors.ColorControlBack;
            TxboxInfo.ForeColor     = LayoutColors.ColorControlText;
            TxboxInfo.BorderStyle   = BorderStyle.None;
            TxboxInfo.Multiline     = true;
            TxboxInfo.AcceptsReturn = true;
            TxboxInfo.AcceptsTab    = true;
            TxboxInfo.ScrollBars    = ScrollBars.Vertical;
            TxboxInfo.KeyDown      += TxboxInfo_KeyDown;
            TxboxInfo.Text          = Data.Strategy.Description;
            TxboxInfo.Select(0, 0);

            // BtnClose
            BtnClose.Text   = Language.T("Close");
            BtnClose.Click += BtnCloseClick;
            BtnClose.UseVisualStyleBackColor = true;

            // BtnAccept
            BtnAccept.Text   = Language.T("Accept");
            BtnAccept.Click += BtnAcceptClick;
            BtnAccept.UseVisualStyleBackColor = true;

            // BtnClear
            BtnClear.Text   = Language.T("Clear");
            BtnClear.Click += BtnClearClick;
            BtnClear.UseVisualStyleBackColor = true;

            _oldInfo = Data.Strategy.Description;
        }
コード例 #16
0
        /// <summary>
        /// Constructor
        /// </summary>
        public PivotPointsCalculator()
        {
            PnlInput = new FancyPanel(Language.T("Input Values"));
            PnlOutput = new FancyPanel(Language.T("Output Values"));

            AlblInputNames = new Label[3];
            AtbxInputValues = new TextBox[3];
            AlblOutputNames = new Label[7];
            AlblOutputValues = new Label[7];

            _colorText = LayoutColors.ColorControlText;

            MaximizeBox = false;
            MinimizeBox = false;
            Icon = Data.Icon;
            BackColor = LayoutColors.ColorFormBack;
            FormBorderStyle = FormBorderStyle.FixedDialog;
            Text = Language.T("Pivot Points");

            PnlInput.Parent = this;
            PnlOutput.Parent = this;

            // Input Names
            var inputNames = new[]
                                 {
                                     Language.T("Highest price"),
                                     Language.T("Closing price"),
                                     Language.T("Lowest price")
                                 };

            int number = 0;
            foreach (string name in inputNames)
            {
                AlblInputNames[number] = new Label
                                             {
                                                 Parent = PnlInput,
                                                 ForeColor = _colorText,
                                                 BackColor = Color.Transparent,
                                                 AutoSize = true,
                                                 Text = name
                                             };

                AtbxInputValues[number] = new TextBox {Parent = PnlInput};
                AtbxInputValues[number].TextChanged += TbxInputTextChanged;
                number++;
            }

            var outputNames = new[]
                                  {
                                      Language.T("Resistance") + " 3",
                                      Language.T("Resistance") + " 2",
                                      Language.T("Resistance") + " 1",
                                      Language.T("Pivot Point"),
                                      Language.T("Support") + " 1",
                                      Language.T("Support") + " 2",
                                      Language.T("Support") + " 3"
                                  };

            number = 0;
            foreach (string name in outputNames)
            {
                AlblOutputNames[number] = new Label
                                              {
                                                  Parent = PnlOutput,
                                                  ForeColor = _colorText,
                                                  BackColor = Color.Transparent,
                                                  AutoSize = true,
                                                  Text = name
                                              };

                AlblOutputValues[number] = new Label
                                               {
                                                   Parent = PnlOutput,
                                                   ForeColor = _colorText,
                                                   BackColor = Color.Transparent,
                                                   AutoSize = true
                                               };

                number++;
            }

            Font font = Font;
            AlblOutputNames[3].Font = new Font(font.FontFamily, font.Size, FontStyle.Bold);
            AlblOutputValues[3].Font = new Font(font.FontFamily, font.Size, FontStyle.Bold);
        }
コード例 #17
0
        /// <summary>
        /// Constructor
        /// </summary>
        public NewTranslation()
        {
            // The form
            MaximizeBox     = false;
            MinimizeBox     = false;
            Icon            = Data.Icon;
            BackColor       = LayoutColors.ColorFormBack;
            FormBorderStyle = FormBorderStyle.FixedDialog;
            Text            = Language.T("New Translation");

            // Controls
            PnlInput        = new FancyPanel(Language.T("Common Parameters"));
            AlblInputNames  = new Label[5];
            AtbxInputValues = new TextBox[5];
            BtnAccept       = new Button();
            BtnCancel       = new Button();

            // Input
            PnlInput.Parent = this;

            // Input Names
            var asInputNames = new[]
            {
                Language.T("Language"),
                Language.T("File name"),
                Language.T("Author"),
                Language.T("Website"),
                Language.T("Contacts")
            };

            // Input Values
            var asInputValues = new[]
            {
                "Language",
                "Language",
                "Your Name",
                "http://forexsb.com",
                "*****@*****.**"
            };

            // Input parameters
            for (int i = 0; i < asInputNames.Length; i++)
            {
                AlblInputNames[i] = new Label
                {
                    Parent    = PnlInput,
                    ForeColor = LayoutColors.ColorControlText,
                    BackColor = Color.Transparent,
                    AutoSize  = true,
                    Text      = asInputNames[i]
                };

                AtbxInputValues[i] = new TextBox {
                    Parent = PnlInput, Text = asInputValues[i]
                };
            }

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

            //Button Accept
            BtnAccept.Parent                  = this;
            BtnAccept.Name                    = "Accept";
            BtnAccept.Text                    = Language.T("Accept");
            BtnAccept.DialogResult            = DialogResult.OK;
            BtnAccept.Click                  += BtnClick;
            BtnAccept.UseVisualStyleBackColor = true;
        }
コード例 #18
0
        /// <summary>
        /// Constructor
        /// </summary>
        public AccountSettings()
        {
            PnlBase = new FancyPanel();

            LblAccountCurrency = new Label();
            LblInitialAccount = new Label();
            LblLeverage = new Label();
            LblExchangeRate = new Label();
            LblExchangeRateInfo = new Label();

            CbxAccountCurrency = new ComboBox();
            NUDInitialAccount = new NumericUpDown();
            CbxLeverage = new ComboBox();
            NUDExchangeRate = new NumericUpDown();
            TbxExchangeRate = new TextBox();

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

            _colorText = LayoutColors.ColorControlText;

            MaximizeBox = false;
            MinimizeBox = false;
            ShowInTaskbar = false;
            Icon = Data.Icon;
            FormBorderStyle = FormBorderStyle.FixedDialog;
            AcceptButton = BtnAccept;
            Text = Language.T("Account Settings");

            // pnlBase
            PnlBase.Parent = this;

            // Label Account Currency
            LblAccountCurrency.Parent = PnlBase;
            LblAccountCurrency.ForeColor = _colorText;
            LblAccountCurrency.BackColor = Color.Transparent;
            LblAccountCurrency.Text = Language.T("Account currency");
            LblAccountCurrency.AutoSize = true;

            // Label Initial Account
            LblInitialAccount.Parent = PnlBase;
            LblInitialAccount.ForeColor = _colorText;
            LblInitialAccount.BackColor = Color.Transparent;
            LblInitialAccount.Text = Language.T("Initial account");
            LblInitialAccount.AutoSize = true;

            // Label Leverage
            LblLeverage.Parent = PnlBase;
            LblLeverage.ForeColor = _colorText;
            LblLeverage.BackColor = Color.Transparent;
            LblLeverage.Text = Language.T("Leverage");
            LblLeverage.AutoSize = true;

            // Label Exchange Rate
            LblExchangeRate.Parent = PnlBase;
            LblExchangeRate.ForeColor = _colorText;
            LblExchangeRate.BackColor = Color.Transparent;
            LblExchangeRate.Text = Language.T("Account exchange rate");
            LblExchangeRate.AutoSize = true;

            // Label Exchange Rate Info
            LblExchangeRateInfo.Parent = PnlBase;
            LblExchangeRateInfo.ForeColor = _colorText;
            LblExchangeRateInfo.BackColor = Color.Transparent;
            LblExchangeRateInfo.Text =
                Language.T("Forex Strategy Builder uses the account exchange rate to calculate the trading statistics in your account currency.") +
                " " +
                Language.T("When your account currency does not take part in the trading couple the account exchange rate is a fixed figure.");

            // ComboBox Account Currency
            CbxAccountCurrency.Parent = PnlBase;
            CbxAccountCurrency.Name = "cbxAccountCurrency";
            CbxAccountCurrency.DropDownStyle = ComboBoxStyle.DropDownList;
            CbxAccountCurrency.Items.AddRange(new object[] {"USD", "EUR"});
            CbxAccountCurrency.SelectedIndex = 0;

            // NumericUpDown Initial Account
            NUDInitialAccount.Parent = PnlBase;
            NUDInitialAccount.Name = "nudInitialAccount";
            NUDInitialAccount.BeginInit();
            NUDInitialAccount.Minimum = 100;
            NUDInitialAccount.Maximum = 100000;
            NUDInitialAccount.Increment = 1000;
            NUDInitialAccount.Value = _initialAccount;
            NUDInitialAccount.EndInit();

            // ComboBox Leverage
            CbxLeverage.Parent = PnlBase;
            CbxLeverage.Name = "cbxLeverage";
            CbxLeverage.DropDownStyle = ComboBoxStyle.DropDownList;
            CbxLeverage.Items.AddRange(new object[] { "1/1", "1/10", "1/20", "1/30", "1/50", "1/100", "1/200", "1/300", "1/400", "1/500" });
            CbxLeverage.SelectedIndex = 5;

            // tbxExchangeRate
            TbxExchangeRate.Parent = PnlBase;
            TbxExchangeRate.BackColor = LayoutColors.ColorControlBack;
            TbxExchangeRate.ForeColor = _colorText;
            TbxExchangeRate.ReadOnly = true;
            TbxExchangeRate.Visible = false;
            TbxExchangeRate.Text = Language.T("Deal price");

            // NumericUpDown Exchange Rate
            NUDExchangeRate.BeginInit();
            NUDExchangeRate.Parent = PnlBase;
            NUDExchangeRate.Name = "nudExchangeRate";
            NUDExchangeRate.Minimum = 0;
            NUDExchangeRate.Maximum = 100000;
            NUDExchangeRate.Increment = 0.0001M;
            NUDExchangeRate.DecimalPlaces = 4;
            NUDExchangeRate.Value = 1;
            NUDExchangeRate.EndInit();

            //Button Default
            BtnDefault.Parent = this;
            BtnDefault.Name = "Default";
            BtnDefault.Text = Language.T("Default");
            BtnDefault.Click += BtnDefaultClick;
            BtnDefault.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;
        }
コード例 #19
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public DataHorizon(int maxBars, DateTime startTime, DateTime endTime, bool useStartTime, bool useEndTime)
        {
            MaxBars = maxBars;
            StartTime = startTime;
            EndTime = endTime;
            UseEndTime = useEndTime;
            UseStartTime = useStartTime;

            BtnAccept = new Button();
            BtnHelp = new Button();
            BtnCancel = new Button();
            PnlBase = new FancyPanel();
            DtpStartTime = new DateTimePicker();
            DtpEndTime = new DateTimePicker();
            CbxUseEndTime = new CheckBox();
            CbxUseStartTime = new CheckBox();
            NUDMaxBars = new NumericUpDown();
            LblMaxBars = new Label();
            LblMinBars = new Label();

            MaximizeBox = false;
            MinimizeBox = false;
            ShowInTaskbar = false;
            Icon = Data.Icon;
            FormBorderStyle = FormBorderStyle.FixedDialog;
            AcceptButton = BtnAccept;
            Text = Language.T("Data Horizon");

            var toolTip = new ToolTip();

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

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

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

            // Panel Base
            PnlBase.Parent = this;

            // Check box UesStartTime
            CbxUseStartTime.Parent = PnlBase;
            CbxUseStartTime.AutoSize = true;
            CbxUseStartTime.ForeColor = LayoutColors.ColorControlText;
            CbxUseStartTime.BackColor = Color.Transparent;
            CbxUseStartTime.Text = Language.T("Remove data older than:");
            CbxUseStartTime.CheckStateChanged += UseStartTimeCheckStateChanged;
            toolTip.SetToolTip(CbxUseStartTime, Language.T("All data older than the specified date will be cut out."));

            // Check box UesEndTime
            CbxUseEndTime.Parent = PnlBase;
            CbxUseEndTime.ForeColor = LayoutColors.ColorControlText;
            CbxUseEndTime.BackColor = Color.Transparent;
            CbxUseEndTime.AutoSize = true;
            CbxUseEndTime.Text = Language.T("Remove data newer than:");
            CbxUseEndTime.CheckStateChanged += UseEndTimeCheckStateChanged;
            toolTip.SetToolTip(CbxUseEndTime, Language.T("All data newer than the specified date will be cut out."));

            // StartTime
            DtpStartTime.Parent = PnlBase;
            DtpStartTime.ForeColor = LayoutColors.ColorControlText;
            DtpStartTime.Format = DateTimePickerFormat.Custom;
            DtpStartTime.CustomFormat = "MMMM dd, yyyy - dddd,   HH : mm";
            DtpStartTime.ShowUpDown = true;
            DtpStartTime.ValueChanged += StartTimeValueChanged;

            // EndTime
            DtpEndTime.Parent = PnlBase;
            DtpEndTime.ForeColor = LayoutColors.ColorControlText;
            DtpEndTime.Format = DateTimePickerFormat.Custom;
            DtpEndTime.CustomFormat = "MMMM dd, yyyy - dddd,   HH : mm";
            DtpEndTime.ShowUpDown = true;
            DtpEndTime.ValueChanged += EndTimeValueChanged;

            // LabelMaxBars
            LblMaxBars.Parent = PnlBase;
            LblMaxBars.AutoSize = true;
            LblMaxBars.ForeColor = LayoutColors.ColorControlText;
            LblMaxBars.BackColor = Color.Transparent;
            LblMaxBars.Text = Language.T("Maximum number of bars:");
            LblMaxBars.TextAlign = ContentAlignment.MiddleLeft;

            // MaxBars
            NUDMaxBars.BeginInit();
            NUDMaxBars.Parent = PnlBase;
            NUDMaxBars.Name = "MaxBars";
            NUDMaxBars.Minimum = Configs.MinBars;
            NUDMaxBars.Maximum = Configs.MaxBarsLimit;
            NUDMaxBars.ThousandsSeparator = true;
            NUDMaxBars.ValueChanged += MaxBarsValueChanged;
            NUDMaxBars.TextAlign = HorizontalAlignment.Center;
            NUDMaxBars.EndInit();

            // Label MinBars
            LblMinBars.Parent = PnlBase;
            LblMinBars.AutoSize = true;
            LblMinBars.ForeColor = LayoutColors.ColorControlText;
            LblMinBars.BackColor = Color.Transparent;
            LblMinBars.Text = Language.T("Minimum number of bars:") + " " + Configs.MinBars;
            LblMinBars.TextAlign = ContentAlignment.MiddleLeft;
        }
コード例 #20
0
        /// <summary>
        /// Constructor
        /// </summary>
        public MetaTrader4Import()
        {
            LblIntro = new Label();
            TxbDataDirectory = new TextBox();
            BtnBrowse = new Button();
            PnlSettings = new FancyPanel();
            PnlInfoBase = new FancyPanel(Language.T("Imported Files"));
            TbxInfo = new TextBox();
            BtnHelp = new Button();
            BtnClose = new Button();
            BtnImport = new Button();
            ProgressBarFile = new ProgressBar();
            ProgressBar = new ProgressBar();

            LblStartingDate = new Label();
            DtpStartingDate = new DateTimePicker();
            LblEndingDate = new Label();
            DtpEndingDate = new DateTimePicker();

            _colorText = LayoutColors.ColorControlText;

            MaximizeBox = false;
            MinimizeBox = false;
            ShowInTaskbar = false;
            Icon = Data.Icon;
            FormBorderStyle = FormBorderStyle.FixedDialog;
            AcceptButton = BtnImport;
            CancelButton = BtnClose;
            Text = Language.T("MetaTrader 4 Import");

            // Label Intro
            LblIntro.Parent = PnlSettings;
            LblIntro.ForeColor = _colorText;
            LblIntro.BackColor = Color.Transparent;
            LblIntro.AutoSize = true;
            LblIntro.Text = Language.T("Directory containing MetaTrader 4 HST files:");

            // Data Directory
            TxbDataDirectory.Parent = PnlSettings;
            TxbDataDirectory.BackColor = LayoutColors.ColorControlBack;
            TxbDataDirectory.ForeColor = _colorText;
            TxbDataDirectory.Text = Configs.MetaTrader4DataPath;

            // Button Browse
            BtnBrowse.Parent = PnlSettings;
            BtnBrowse.Name = "Browse";
            BtnBrowse.Text = Language.T("Browse");
            BtnBrowse.Click += BtnBrowseClick;
            BtnBrowse.UseVisualStyleBackColor = true;

            // Label Starting Date
            LblStartingDate.Parent = PnlSettings;
            LblStartingDate.ForeColor = _colorText;
            LblStartingDate.BackColor = Color.Transparent;
            LblStartingDate.AutoSize = true;
            LblStartingDate.Text = Language.T("Starting Date:");

            // Starting Date
            DtpStartingDate.Parent = PnlSettings;
            DtpStartingDate.ForeColor = LayoutColors.ColorCaptionText;
            DtpStartingDate.ShowUpDown = true;

            // Label Ending Date
            LblEndingDate.Parent = PnlSettings;
            LblEndingDate.ForeColor = _colorText;
            LblEndingDate.BackColor = Color.Transparent;
            LblEndingDate.AutoSize = true;
            LblEndingDate.Text = Language.T("Ending Date:");

            // Ending Date
            DtpEndingDate.Parent = PnlSettings;
            DtpEndingDate.ForeColor = LayoutColors.ColorCaptionText;
            DtpEndingDate.ShowUpDown = true;

            // PnlSettings
            PnlSettings.Parent = this;

            // PnlInfoBase
            PnlInfoBase.Parent = this;
            PnlInfoBase.Padding = new Padding(4, (int) PnlInfoBase.CaptionHeight, 2, 2);

            // TbxInfo
            TbxInfo.Parent = PnlInfoBase;
            TbxInfo.BorderStyle = BorderStyle.None;
            TbxInfo.Dock = DockStyle.Fill;
            TbxInfo.BackColor = LayoutColors.ColorControlBack;
            TbxInfo.ForeColor = LayoutColors.ColorControlText;
            TbxInfo.Multiline = true;
            TbxInfo.AcceptsReturn = true;
            TbxInfo.AcceptsTab = true;
            TbxInfo.ScrollBars = ScrollBars.Vertical;

            // ProgressBarFile
            ProgressBarFile.Parent = this;

            // ProgressBar
            ProgressBar.Parent = this;

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

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

            // Button Import
            BtnImport.Parent = this;
            BtnImport.Name = "Import";
            BtnImport.Text = Language.T("Import");
            BtnImport.Click += BtnImportClick;
            BtnImport.UseVisualStyleBackColor = true;

            // BackGroundWorker
            _bgWorker = new BackgroundWorker {WorkerReportsProgress = true, WorkerSupportsCancellation = true};
            _bgWorker.DoWork += BgWorkerDoWork;
            _bgWorker.RunWorkerCompleted += BgWorkerRunWorkerCompleted;
        }
コード例 #21
0
        /// <summary>
        /// Constructor
        /// </summary>
        public TradingCharges()
        {
            PnlBase = new FancyPanel();

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

            _colorText = LayoutColors.ColorControlText;

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

            var toolTip = new ToolTip();

            // 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 == CommissionType.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 == CommissionType.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 == CommissionType.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 += BtnEditInstrumentClick;
            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;
        }
コード例 #22
0
        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;
        }
コード例 #23
0
        /// <summary>
        /// Constructor
        /// </summary>
        public InstrumentEditor()
        {
            PnlInstruments = new FancyPanel(Language.T("Instruments"));
            PnlProperties = new FancyPanel(Language.T("Instrument Properties"));
            PnlAddInstrument = new FancyPanel(Language.T("Add an Instrument"));

            // Instruments' controls
            LbxInstruments = new ListBox();
            BtnDelete = new Button();
            BtnUp = new Button();
            BtnDown = new Button();

            // Properties' controls
            LblPropSymbol = new Label();
            LblPropType = new Label();
            LblPropComment = new Label();
            LblPropDigits = new Label();
            LblPropPoint = new Label();
            LblPropLots = new Label();
            LblPropSpread = new Label();
            LblPropSwap = new Label();
            LblPropCommission = new Label();
            LblPropSlippage = new Label();
            LblPropPriceIn = new Label();
            LblPropAccountIn = new Label();
            LblPropAccountRate = new Label();
            LblPropFileName = new Label();
            LblPropDataFiles = new Label();

            TbxPropSymbol = new TextBox();
            TbxPropType = new TextBox();
            TbxPropComment = new TextBox();
            TbxPropPoint = new TextBox();
            TbxPropSpread = new TextBox();
            TbxPropSlippage = new TextBox();
            TbxPropPriceIn = new TextBox();
            TbxPropAccountIn = new TextBox();
            TbxPropAccountRate = new TextBox();
            TbxPropFileName = new TextBox();

            CbxPropSwap = new ComboBox();
            CbxPropCommission = new ComboBox();
            CbxPropCommScope = new ComboBox();
            CbxPropCommTime = new ComboBox();

            NUDPropDigits = new NumericUpDown();
            NUDPropLotSize = new NumericUpDown();
            NUDPropSpread = new NumericUpDown();
            NUDPropSwapLong = new NumericUpDown();
            NUDPropSwapShort = new NumericUpDown();
            NUDPropCommission = new NumericUpDown();
            NUDPropSlippage = new NumericUpDown();
            NUDPropAccountRate = new NumericUpDown();

            BtnAccept = new Button();

            // Add an Instrument's controls
            LblAddInstrSymbol = new Label();
            LblAddInstrType = new Label();
            TbxAddInstrSymbol = new TextBox();
            CbxAddInstrType = new ComboBox();
            BtnAddInstrAdd = new Button();

            BtnClose = new Button();

            _fontCaption = new Font(Font.FontFamily, 9);
            _captionHeight = Math.Max(_fontCaption.Height, 18);
            _colorText = LayoutColors.ColorControlText;
            NeedReset = false;

            MaximizeBox = false;
            MinimizeBox = false;
            ShowInTaskbar = false;
            Icon = Data.Icon;
            BackColor = LayoutColors.ColorFormBack;
            FormBorderStyle = FormBorderStyle.FixedDialog;
            AcceptButton = BtnAccept;
            Text = Language.T("Instrument Editor");
            FormClosing += InstrumentEditorFormClosing;

            // PnlInstruments
            PnlInstruments.Parent = this;

            // PnlProperties
            PnlProperties.Parent = this;

            // PnlAddInstrument
            PnlAddInstrument.Parent = this;

            // LbxInstruments
            LbxInstruments.Parent = PnlInstruments;
            LbxInstruments.BackColor = LayoutColors.ColorControlBack;
            //LbxInstruments.BorderStyle = BorderStyle.None;
            LbxInstruments.ForeColor = _colorText;
            foreach (var symbol in Instruments.SymbolList)
                LbxInstruments.Items.Add(symbol);

            // Button UP
            BtnUp.Parent = PnlInstruments;
            BtnUp.Text = Language.T("Up");
            BtnUp.UseVisualStyleBackColor = true;
            BtnUp.Click += BtnUpClick;

            // Button Down
            BtnDown.Parent = PnlInstruments;
            BtnDown.Text = Language.T("Down");
            BtnDown.UseVisualStyleBackColor = true;
            BtnDown.Click += BtnDownClick;

            // Button Delete
            BtnDelete.Parent = PnlInstruments;
            BtnDelete.Text = Language.T("Delete");
            BtnDelete.UseVisualStyleBackColor = true;
            BtnDelete.Click += BtnDeleteClick;

            // LblAddInstrSymbol
            LblAddInstrSymbol.Parent = PnlAddInstrument;
            LblAddInstrSymbol.ForeColor = _colorText;
            LblAddInstrSymbol.BackColor = Color.Transparent;
            LblAddInstrSymbol.AutoSize = false;
            LblAddInstrSymbol.TextAlign = ContentAlignment.MiddleRight;
            LblAddInstrSymbol.Text = Language.T("Symbol");

            // TbxAddInstrSymbol
            TbxAddInstrSymbol.Parent = PnlAddInstrument;
            TbxAddInstrSymbol.ForeColor = _colorText;

            // LblAddInstrType
            LblAddInstrType.Parent = PnlAddInstrument;
            LblAddInstrType.ForeColor = _colorText;
            LblAddInstrType.BackColor = Color.Transparent;
            LblAddInstrType.AutoSize = false;
            LblAddInstrType.TextAlign = ContentAlignment.MiddleRight;
            LblAddInstrType.Text = Language.T("Type");

            // CbxAddInstrType
            CbxAddInstrType.Parent = PnlAddInstrument;
            CbxAddInstrType.Name = "cbxAddInstrType";
            CbxAddInstrType.DropDownStyle = ComboBoxStyle.DropDownList;
            string[] instrTypes = Enum.GetNames(typeof (InstrumetType));
            foreach (var type in instrTypes)
                CbxAddInstrType.Items.Add(type);
            CbxAddInstrType.SelectedIndex = 0;

            // BtnAddInstrAdd
            BtnAddInstrAdd.Parent = PnlAddInstrument;
            BtnAddInstrAdd.Name = "btnAddInstrAdd";
            BtnAddInstrAdd.Text = Language.T("Add");
            BtnAddInstrAdd.UseVisualStyleBackColor = true;
            BtnAddInstrAdd.Click += BtnAddInstrAddClick;

            // LblPropSymbol
            LblPropSymbol.Parent = PnlProperties;
            LblPropSymbol.ForeColor = _colorText;
            LblPropSymbol.BackColor = Color.Transparent;
            LblPropSymbol.AutoSize = false;
            LblPropSymbol.TextAlign = ContentAlignment.MiddleRight;
            LblPropSymbol.Text = Language.T("Symbol");

            // LblPropType
            LblPropType.Parent = PnlProperties;
            LblPropType.ForeColor = _colorText;
            LblPropType.BackColor = Color.Transparent;
            LblPropType.AutoSize = false;
            LblPropType.TextAlign = ContentAlignment.MiddleRight;
            LblPropType.Text = Language.T("Type");

            // LblPropComment
            LblPropComment.Parent = PnlProperties;
            LblPropComment.ForeColor = _colorText;
            LblPropComment.BackColor = Color.Transparent;
            LblPropComment.AutoSize = false;
            LblPropComment.TextAlign = ContentAlignment.MiddleRight;
            LblPropComment.Text = Language.T("Comment");

            // LblPropDigits
            LblPropDigits.Parent = PnlProperties;
            LblPropDigits.ForeColor = _colorText;
            LblPropDigits.BackColor = Color.Transparent;
            LblPropDigits.AutoSize = false;
            LblPropDigits.TextAlign = ContentAlignment.MiddleRight;
            LblPropDigits.Text = Language.T("Digits");

            // LblPropPoint
            LblPropPoint.Parent = PnlProperties;
            LblPropPoint.ForeColor = _colorText;
            LblPropPoint.BackColor = Color.Transparent;
            LblPropPoint.AutoSize = false;
            LblPropPoint.TextAlign = ContentAlignment.MiddleRight;
            LblPropPoint.Text = Language.T("Point value");

            // LblPropLots
            LblPropLots.Parent = PnlProperties;
            LblPropLots.ForeColor = _colorText;
            LblPropLots.BackColor = Color.Transparent;
            LblPropLots.AutoSize = false;
            LblPropLots.TextAlign = ContentAlignment.MiddleRight;
            LblPropLots.Text = Language.T("Lot size");

            // LblPropSpread
            LblPropSpread.Parent = PnlProperties;
            LblPropSpread.ForeColor = _colorText;
            LblPropSpread.BackColor = Color.Transparent;
            LblPropSpread.AutoSize = false;
            LblPropSpread.TextAlign = ContentAlignment.MiddleRight;
            LblPropSpread.Text = Language.T("Spread in");

            // LblPropSwap
            LblPropSwap.Parent = PnlProperties;
            LblPropSwap.ForeColor = _colorText;
            LblPropSwap.BackColor = Color.Transparent;
            LblPropSwap.AutoSize = false;
            LblPropSwap.TextAlign = ContentAlignment.MiddleRight;
            LblPropSwap.Text = Language.T("Swap in");

            // LblPropCommission
            LblPropCommission.Parent = PnlProperties;
            LblPropCommission.ForeColor = _colorText;
            LblPropCommission.BackColor = Color.Transparent;
            LblPropCommission.AutoSize = false;
            LblPropCommission.TextAlign = ContentAlignment.MiddleRight;
            LblPropCommission.Text = Language.T("Commission in");

            // LblPropSlippage
            LblPropSlippage.Parent = PnlProperties;
            LblPropSlippage.ForeColor = _colorText;
            LblPropSlippage.BackColor = Color.Transparent;
            LblPropSlippage.AutoSize = false;
            LblPropSlippage.TextAlign = ContentAlignment.MiddleRight;
            LblPropSlippage.Text = Language.T("Slippage in");

            // LblPropPriceIn
            LblPropPriceIn.Parent = PnlProperties;
            LblPropPriceIn.ForeColor = _colorText;
            LblPropPriceIn.BackColor = Color.Transparent;
            LblPropPriceIn.AutoSize = false;
            LblPropPriceIn.TextAlign = ContentAlignment.MiddleRight;
            LblPropPriceIn.Text = Language.T("Price in");

            // LblPropAccountIn
            LblPropAccountIn.Parent = PnlProperties;
            LblPropAccountIn.ForeColor = _colorText;
            LblPropAccountIn.BackColor = Color.Transparent;
            LblPropAccountIn.AutoSize = false;
            LblPropAccountIn.TextAlign = ContentAlignment.MiddleRight;
            LblPropAccountIn.Text = Language.T("Account in");

            // LblPropAccountRate
            LblPropAccountRate.Parent = PnlProperties;
            LblPropAccountRate.ForeColor = _colorText;
            LblPropAccountRate.BackColor = Color.Transparent;
            LblPropAccountRate.AutoSize = false;
            LblPropAccountRate.TextAlign = ContentAlignment.MiddleRight;
            LblPropAccountRate.Text = Language.T("Account exchange rate");

            // LblPropFileName
            LblPropFileName.Parent = PnlProperties;
            LblPropFileName.BackColor = Color.Transparent;
            LblPropFileName.ForeColor = _colorText;
            LblPropFileName.AutoSize = false;
            LblPropFileName.TextAlign = ContentAlignment.MiddleRight;
            LblPropFileName.Text = Language.T("Base name of the data files");

            // LblPropDataFiles
            LblPropDataFiles.Parent = PnlProperties;
            LblPropDataFiles.BackColor = Color.Transparent;
            LblPropDataFiles.ForeColor = _colorText;
            LblPropDataFiles.AutoSize = false;
            LblPropDataFiles.TextAlign = ContentAlignment.TopLeft;
            LblPropDataFiles.Text = "";

            // TbxPropSymbol
            TbxPropSymbol.Parent = PnlProperties;
            TbxPropSymbol.BackColor = LayoutColors.ColorControlBack;
            TbxPropSymbol.ForeColor = _colorText;
            TbxPropSymbol.Enabled = false;

            // TbxPropType
            TbxPropType.Parent = PnlProperties;
            TbxPropType.BackColor = LayoutColors.ColorControlBack;
            TbxPropType.ForeColor = _colorText;
            TbxPropType.Enabled = false;

            // TbxPropComment
            TbxPropComment.Parent = PnlProperties;
            TbxPropComment.BackColor = LayoutColors.ColorControlBack;
            TbxPropComment.ForeColor = _colorText;

            // TbxPropPoint
            TbxPropPoint.Parent = PnlProperties;
            TbxPropPoint.BackColor = LayoutColors.ColorControlBack;
            TbxPropPoint.ForeColor = _colorText;
            TbxPropPoint.Enabled = false;

            // TbxPropSpread
            TbxPropSpread.Parent = PnlProperties;
            TbxPropSpread.BackColor = LayoutColors.ColorControlBack;
            TbxPropSpread.ForeColor = _colorText;
            TbxPropSpread.Enabled = false;
            TbxPropSpread.Text = Language.T("pips");

            // TbxPropSlippage
            TbxPropSlippage.Parent = PnlProperties;
            TbxPropSlippage.BackColor = LayoutColors.ColorControlBack;
            TbxPropSlippage.ForeColor = _colorText;
            TbxPropSlippage.Enabled = false;
            TbxPropSlippage.Text = Language.T("pips");

            // TbxPropPriceIn
            TbxPropPriceIn.Parent = PnlProperties;
            TbxPropPriceIn.BackColor = LayoutColors.ColorControlBack;
            TbxPropPriceIn.ForeColor = _colorText;
            TbxPropPriceIn.TextChanged += TbxPropPriceInTextChanged;

            // TbxPropAccountIn
            TbxPropAccountIn.Parent = PnlProperties;
            TbxPropAccountIn.BackColor = LayoutColors.ColorControlBack;
            TbxPropAccountIn.ForeColor = _colorText;
            TbxPropAccountIn.Enabled = false;
            TbxPropAccountIn.Text = Configs.AccountCurrency;

            // TbxPropAccountRate
            TbxPropAccountRate.Parent = PnlProperties;
            TbxPropAccountRate.BackColor = LayoutColors.ColorControlBack;
            TbxPropAccountRate.ForeColor = _colorText;
            TbxPropAccountRate.Enabled = false;
            TbxPropAccountRate.Text = "Deal price";

            // TbxPropFileName
            TbxPropFileName.Parent = PnlProperties;
            TbxPropFileName.BackColor = LayoutColors.ColorControlBack;
            TbxPropFileName.ForeColor = _colorText;
            TbxPropFileName.TextChanged += TbxPropFileNameTextChanged;

            // CbxPropSwap
            CbxPropSwap.Parent = PnlProperties;
            CbxPropSwap.Name = "CbxPropSwap";
            CbxPropSwap.DropDownStyle = ComboBoxStyle.DropDownList;
            CbxPropSwap.Items.AddRange(new object[] {Language.T("pips"), Language.T("percent"), Language.T("money")});
            CbxPropSwap.SelectedIndex = 0;

            // CbxPropCommission
            CbxPropCommission.Parent = PnlProperties;
            CbxPropCommission.Name = "CbxPropCommission";
            CbxPropCommission.DropDownStyle = ComboBoxStyle.DropDownList;
            CbxPropCommission.Items.AddRange(new object[] {Language.T("pips"), Language.T("percent"), Language.T("money")});
            CbxPropCommission.SelectedIndex = 0;
            CbxPropCommission.SelectedIndexChanged += CbxPropCommissionSelectedIndexChanged;

            // CbxPropCommScope
            CbxPropCommScope.Parent = PnlProperties;
            CbxPropCommScope.Name = "CbxPropCommScope";
            CbxPropCommScope.DropDownStyle = ComboBoxStyle.DropDownList;
            CbxPropCommScope.Items.AddRange(new object[] {Language.T("per lot"), Language.T("per deal")});
            CbxPropCommScope.SelectedIndex = 0;

            // CbxPropCommTime
            CbxPropCommTime.Parent = PnlProperties;
            CbxPropCommTime.Name = "CbxPropCommTime";
            CbxPropCommTime.DropDownStyle = ComboBoxStyle.DropDownList;
            CbxPropCommTime.Items.AddRange(new object[] {Language.T("at opening"), Language.T("at open/close")});
            CbxPropCommTime.SelectedIndex = 0;

            // NumericUpDown Digits
            NUDPropDigits.BeginInit();
            NUDPropDigits.Parent = PnlProperties;
            NUDPropDigits.Name = "NUDPropDigits";
            NUDPropDigits.Minimum = 0;
            NUDPropDigits.Maximum = 5;
            NUDPropDigits.Increment = 1;
            NUDPropDigits.Value = 4;
            NUDPropDigits.TextAlign = HorizontalAlignment.Center;
            NUDPropDigits.ValueChanged += NudPropDigitsValueChanged;
            NUDPropDigits.EndInit();

            // NUDPropLotSize
            NUDPropLotSize.BeginInit();
            NUDPropLotSize.Parent = PnlProperties;
            NUDPropLotSize.Name = "NUDPropLotSize";
            NUDPropLotSize.Minimum = 0;
            NUDPropLotSize.Maximum = 100000;
            NUDPropLotSize.Increment = 1;
            NUDPropLotSize.Value = 10000;
            NUDPropLotSize.TextAlign = HorizontalAlignment.Center;
            NUDPropLotSize.EndInit();

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

            // NumericUpDown Swap Long
            NUDPropSwapLong.BeginInit();
            NUDPropSwapLong.Parent = PnlProperties;
            NUDPropSwapLong.Name = "NUDPropSwapLong";
            NUDPropSwapLong.TextAlign = HorizontalAlignment.Center;
            NUDPropSwapLong.Minimum = -500;
            NUDPropSwapLong.Maximum = 500;
            NUDPropSwapLong.Increment = 0.01M;
            NUDPropSwapLong.DecimalPlaces = 2;
            NUDPropSwapLong.Value = 1;
            NUDPropSwapLong.EndInit();
            _toolTip.SetToolTip(NUDPropSwapLong,
                                Language.T("Swap number for a long position rollover") + Environment.NewLine +
                                Language.T("A positive value decreases your profit."));

            // NumericUpDown Swap Short
            NUDPropSwapShort.BeginInit();
            NUDPropSwapShort.Parent = PnlProperties;
            NUDPropSwapShort.Name = "NUDPropSwapShort";
            NUDPropSwapShort.TextAlign = HorizontalAlignment.Center;
            NUDPropSwapShort.Minimum = -500;
            NUDPropSwapShort.Maximum = 500;
            NUDPropSwapShort.Increment = 0.01M;
            NUDPropSwapShort.DecimalPlaces = 2;
            NUDPropSwapShort.Value = -1;
            NUDPropSwapShort.EndInit();
            _toolTip.SetToolTip(NUDPropSwapShort,
                                Language.T("Swap number for a short position rollover") + Environment.NewLine +
                                Language.T("A negative value decreases your profit."));

            // NumericUpDown NUDPropCommission
            NUDPropCommission.BeginInit();
            NUDPropCommission.Parent = PnlProperties;
            NUDPropCommission.Name = "NUDPropCommission";
            NUDPropCommission.TextAlign = HorizontalAlignment.Center;
            NUDPropCommission.Minimum = -500;
            NUDPropCommission.Maximum = 500;
            NUDPropCommission.Increment = 0.01M;
            NUDPropCommission.DecimalPlaces = 2;
            NUDPropCommission.Value = 0;
            NUDPropCommission.EndInit();

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

            // NumericUpDown NUDPropAccountRate
            NUDPropAccountRate.BeginInit();
            NUDPropAccountRate.Parent = PnlProperties;
            NUDPropAccountRate.Name = "NUDPropAccountRate";
            NUDPropAccountRate.TextAlign = HorizontalAlignment.Center;
            NUDPropAccountRate.Minimum = 0;
            NUDPropAccountRate.Maximum = 100000;
            NUDPropAccountRate.Increment = 0.0001M;
            NUDPropAccountRate.DecimalPlaces = 4;
            NUDPropAccountRate.Value = 1;
            NUDPropAccountRate.ValueChanged += NUDPropAccountRateValueChanged;
            NUDPropAccountRate.EndInit();

            // Button Accept
            BtnAccept.Parent = PnlProperties;
            BtnAccept.Name = "btnAccept";
            BtnAccept.Text = Language.T("Accept");
            BtnAccept.Click += BtnAcceptClick;
            BtnAccept.UseVisualStyleBackColor = true;

            //Button Close
            BtnClose.Parent = this;
            BtnClose.Text = Language.T("Close");
            BtnClose.DialogResult = DialogResult.Cancel;
            BtnClose.UseVisualStyleBackColor = true;
        }
コード例 #24
0
        /// <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());
                }
            }
        }
コード例 #25
0
        /// <summary>
        /// Constructor
        /// </summary>
        public EditTranslation()
        {
            // The form
            MaximizeBox     = false;
            MinimizeBox     = false;
            Icon            = Data.Icon;
            BackColor       = LayoutColors.ColorFormBack;
            FormBorderStyle = FormBorderStyle.FixedDialog;
            Text            = Language.T("Edit Translation");
            FormClosing    += ActionsFormClosing;

            // Controls
            PnlCommon       = new FancyPanel(Language.T("Common Parameters"));
            PnlPhrases      = new FancyPanel(Language.T("English Phrase - Translated Phrase"));
            AlblInputNames  = new Label[5];
            AtbxInputValues = new TextBox[5];
            AtbxMain        = new TextBox[Textboxes];
            AtbxAlt         = new TextBox[Textboxes];
            ScrollBar       = new VScrollBar();
            TbxSearch       = new TextBox();
            BtnSearch       = new Button();
            BtnUntranslated = new Button();
            BtnAccept       = new Button();
            BtnCancel       = new Button();

            // Common
            PnlCommon.Parent = this;

            // Phrases
            PnlPhrases.Parent = this;

            // Input Names
            var asInputNames = new[]
            {
                Language.T("Language"),
                Language.T("File name"),
                Language.T("Author"),
                Language.T("Website"),
                Language.T("Contacts")
            };

            // Input Values
            var asInputValues = new[]
            {
                Configs.Language,
                Language.LanguageFileName,
                Language.Author,
                Language.AuthorsWebsite,
                Language.AuthorsEmail
            };

            // Common parameters
            for (int i = 0; i < asInputNames.Length; i++)
            {
                AlblInputNames[i] = new Label
                {
                    Parent    = PnlCommon,
                    ForeColor = LayoutColors.ColorControlText,
                    BackColor = Color.Transparent,
                    AutoSize  = true,
                    Text      = asInputNames[i]
                };

                AtbxInputValues[i] = new TextBox {
                    Parent = PnlCommon, Text = asInputValues[i]
                };
            }

            // Phrases
            for (int i = 0; i < Textboxes; i++)
            {
                AtbxMain[i] = new TextBox
                {
                    Parent = PnlPhrases, Multiline = true, ReadOnly = true, ForeColor = Color.DarkGray
                };

                AtbxAlt[i] = new TextBox {
                    Parent = PnlPhrases, Multiline = true, Tag = i
                };
                AtbxAlt[i].TextChanged += EditTranslationTextChanged;
            }

            // Vertical ScrollBar
            ScrollBar.Parent        = PnlPhrases;
            ScrollBar.Visible       = true;
            ScrollBar.Enabled       = true;
            ScrollBar.ValueChanged += ScrollBarValueChanged;
            ScrollBar.TabStop       = true;

            // TextBox Search
            TbxSearch.Parent       = this;
            TbxSearch.TextChanged += TbxSearchTextChanged;

            // Button Search
            BtnSearch.Parent = this;
            BtnSearch.Name   = "Search";
            BtnSearch.Text   = Language.T("Search");
            BtnSearch.Click += BtnClick;
            BtnSearch.UseVisualStyleBackColor = true;

            // Button Untranslated
            BtnUntranslated.Parent = this;
            BtnUntranslated.Name   = "Untranslated";
            BtnUntranslated.Text   = Language.T("Not Translated");
            BtnUntranslated.Click += BtnClick;
            BtnUntranslated.UseVisualStyleBackColor = true;

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

            // Button Accept
            BtnAccept.Parent                  = this;
            BtnAccept.Name                    = "Accept";
            BtnAccept.Text                    = Language.T("Accept");
            BtnAccept.DialogResult            = DialogResult.OK;
            BtnAccept.Click                  += BtnClick;
            BtnAccept.Enabled                 = false;
            BtnAccept.UseVisualStyleBackColor = true;
        }
コード例 #26
0
        /// <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());
        }
コード例 #27
0
        /// <summary>
        /// Constructor
        /// </summary>
        public FibonacciLevelsCalculator()
        {
            PnlInput  = new FancyPanel(Language.T("Input Values"));
            PnlOutput = new FancyPanel(Language.T("Output Values"));

            AlblInputNames   = new Label[2];
            AtbxInputValues  = new TextBox[2];
            AlblOutputNames  = new Label[10];
            AlblOutputValues = new Label[10];

            _colorText = LayoutColors.ColorControlText;

            MaximizeBox     = false;
            MinimizeBox     = false;
            Icon            = Data.Icon;
            BackColor       = LayoutColors.ColorFormBack;
            FormBorderStyle = FormBorderStyle.FixedDialog;
            Text            = Language.T("Fibonacci Levels");

            // Input
            PnlInput.Parent = this;

            // Output
            PnlOutput.Parent = this;

            // Input Names
            var asInputNames = new[]
            {
                Language.T("First price"),
                Language.T("Second price")
            };

            int number = 0;

            foreach (string name in asInputNames)
            {
                AlblInputNames[number] = new Label
                {
                    Parent    = PnlInput,
                    ForeColor = _colorText,
                    BackColor = Color.Transparent,
                    AutoSize  = true,
                    Text      = name
                };

                AtbxInputValues[number] = new TextBox {
                    Parent = PnlInput
                };
                AtbxInputValues[number].TextChanged += TbxInputTextChanged;
                number++;
            }

            // Output Names
            number = 0;
            foreach (float fn in _afLevels)
            {
                AlblOutputNames[number] = new Label
                {
                    Parent    = PnlOutput,
                    ForeColor = _colorText,
                    BackColor = Color.Transparent,
                    AutoSize  = true,
                    Text      = fn.ToString("F1") + " %"
                };

                AlblOutputValues[number] = new Label
                {
                    Parent    = PnlOutput,
                    ForeColor = _colorText,
                    BackColor = Color.Transparent,
                    AutoSize  = true
                };

                number++;
            }

            Font font = Font;

            AlblOutputNames[2].Font  = new Font(font.FontFamily, font.Size, FontStyle.Bold);
            AlblOutputNames[3].Font  = new Font(font.FontFamily, font.Size, FontStyle.Bold);
            AlblOutputNames[4].Font  = new Font(font.FontFamily, font.Size, FontStyle.Bold);
            AlblOutputValues[2].Font = new Font(font.FontFamily, font.Size, FontStyle.Bold);
            AlblOutputValues[3].Font = new Font(font.FontFamily, font.Size, FontStyle.Bold);
            AlblOutputValues[4].Font = new Font(font.FontFamily, font.Size, FontStyle.Bold);
        }
コード例 #28
0
        /// <summary>
        /// Constructor
        /// </summary>
        public AccountSettings()
        {
            PnlBase = new FancyPanel();

            LblAccountCurrency  = new Label();
            LblInitialAccount   = new Label();
            LblLeverage         = new Label();
            LblExchangeRate     = new Label();
            LblExchangeRateInfo = new Label();

            CbxAccountCurrency = new ComboBox();
            NUDInitialAccount  = new NumericUpDown();
            CbxLeverage        = new ComboBox();
            NUDExchangeRate    = new NumericUpDown();
            TbxExchangeRate    = new TextBox();

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

            _colorText = LayoutColors.ColorControlText;

            MaximizeBox     = false;
            MinimizeBox     = false;
            ShowInTaskbar   = false;
            Icon            = Data.Icon;
            FormBorderStyle = FormBorderStyle.FixedDialog;
            AcceptButton    = BtnAccept;
            Text            = Language.T("Account Settings");

            // pnlBase
            PnlBase.Parent = this;

            // Label Account Currency
            LblAccountCurrency.Parent    = PnlBase;
            LblAccountCurrency.ForeColor = _colorText;
            LblAccountCurrency.BackColor = Color.Transparent;
            LblAccountCurrency.Text      = Language.T("Account currency");
            LblAccountCurrency.AutoSize  = true;

            // Label Initial Account
            LblInitialAccount.Parent    = PnlBase;
            LblInitialAccount.ForeColor = _colorText;
            LblInitialAccount.BackColor = Color.Transparent;
            LblInitialAccount.Text      = Language.T("Initial account");
            LblInitialAccount.AutoSize  = true;

            // Label Leverage
            LblLeverage.Parent    = PnlBase;
            LblLeverage.ForeColor = _colorText;
            LblLeverage.BackColor = Color.Transparent;
            LblLeverage.Text      = Language.T("Leverage");
            LblLeverage.AutoSize  = true;

            // Label Exchange Rate
            LblExchangeRate.Parent    = PnlBase;
            LblExchangeRate.ForeColor = _colorText;
            LblExchangeRate.BackColor = Color.Transparent;
            LblExchangeRate.Text      = Language.T("Account exchange rate");
            LblExchangeRate.AutoSize  = true;

            // Label Exchange Rate Info
            LblExchangeRateInfo.Parent    = PnlBase;
            LblExchangeRateInfo.ForeColor = _colorText;
            LblExchangeRateInfo.BackColor = Color.Transparent;
            LblExchangeRateInfo.Text      =
                Language.T("Forex Strategy Builder uses the account exchange rate to calculate the trading statistics in your account currency.") +
                " " +
                Language.T("When your account currency does not take part in the trading couple the account exchange rate is a fixed figure.");

            // ComboBox Account Currency
            CbxAccountCurrency.Parent        = PnlBase;
            CbxAccountCurrency.Name          = "cbxAccountCurrency";
            CbxAccountCurrency.DropDownStyle = ComboBoxStyle.DropDownList;
            CbxAccountCurrency.Items.AddRange(new object[] { "USD", "EUR" });
            CbxAccountCurrency.SelectedIndex = 0;

            // NumericUpDown Initial Account
            NUDInitialAccount.Parent = PnlBase;
            NUDInitialAccount.Name   = "nudInitialAccount";
            NUDInitialAccount.BeginInit();
            NUDInitialAccount.Minimum   = 100;
            NUDInitialAccount.Maximum   = 100000;
            NUDInitialAccount.Increment = 1000;
            NUDInitialAccount.Value     = _initialAccount;
            NUDInitialAccount.EndInit();

            // ComboBox Leverage
            CbxLeverage.Parent        = PnlBase;
            CbxLeverage.Name          = "cbxLeverage";
            CbxLeverage.DropDownStyle = ComboBoxStyle.DropDownList;
            CbxLeverage.Items.AddRange(new object[] { "1/1", "1/10", "1/20", "1/30", "1/50", "1/100", "1/200", "1/300", "1/400", "1/500" });
            CbxLeverage.SelectedIndex = 5;

            // tbxExchangeRate
            TbxExchangeRate.Parent    = PnlBase;
            TbxExchangeRate.BackColor = LayoutColors.ColorControlBack;
            TbxExchangeRate.ForeColor = _colorText;
            TbxExchangeRate.ReadOnly  = true;
            TbxExchangeRate.Visible   = false;
            TbxExchangeRate.Text      = Language.T("Deal price");

            // NumericUpDown Exchange Rate
            NUDExchangeRate.BeginInit();
            NUDExchangeRate.Parent        = PnlBase;
            NUDExchangeRate.Name          = "nudExchangeRate";
            NUDExchangeRate.Minimum       = 0;
            NUDExchangeRate.Maximum       = 100000;
            NUDExchangeRate.Increment     = 0.0001M;
            NUDExchangeRate.DecimalPlaces = 4;
            NUDExchangeRate.Value         = 1;
            NUDExchangeRate.EndInit();

            //Button Default
            BtnDefault.Parent = this;
            BtnDefault.Name   = "Default";
            BtnDefault.Text   = Language.T("Default");
            BtnDefault.Click += BtnDefaultClick;
            BtnDefault.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;
        }
コード例 #29
0
        /// <summary>
        /// Constructor
        /// </summary>
        public ProfitCalculator()
        {
            PnlInput  = new FancyPanel(Language.T("Input Values"));
            PnlOutput = new FancyPanel(Language.T("Output Values"));

            AlblInputNames   = new Label[6];
            AlblOutputNames  = new Label[8];
            AlblOutputValues = new Label[8];

            LblLotSize    = new Label();
            CbxDirection  = new ComboBox();
            NUDLots       = new NumericUpDown();
            NUDEntryPrice = new NumericUpDown();
            NUDExitPrice  = new NumericUpDown();
            NUDDays       = new NumericUpDown();

            _colorText = LayoutColors.ColorControlText;

            MaximizeBox     = false;
            MinimizeBox     = false;
            Icon            = Data.Icon;
            BackColor       = LayoutColors.ColorFormBack;
            FormBorderStyle = FormBorderStyle.FixedDialog;
            Text            = Language.T("Profit Calculator");

            // Input
            PnlInput.Parent = this;

            // Output
            PnlOutput.Parent = this;

            // Input Names
            var asInputNames = new[]
            {
                Data.InstrProperties.Symbol,
                Language.T("Direction"),
                Language.T("Number of lots"),
                Language.T("Entry price"),
                Language.T("Exit price"),
                Language.T("Days rollover")
            };

            int number = 0;

            foreach (string name in asInputNames)
            {
                AlblInputNames[number] = new Label
                {
                    Parent    = PnlInput,
                    ForeColor = _colorText,
                    BackColor = Color.Transparent,
                    AutoSize  = true,
                    Text      = name
                };
                number++;
            }

            // Label Lot size
            LblLotSize.Parent    = PnlInput;
            LblLotSize.ForeColor = _colorText;
            LblLotSize.BackColor = Color.Transparent;

            // ComboBox SameDirAction
            CbxDirection.Parent        = PnlInput;
            CbxDirection.DropDownStyle = ComboBoxStyle.DropDownList;
            CbxDirection.Items.AddRange(new object[] { Language.T("Long"), Language.T("Short") });
            CbxDirection.SelectedIndex = 0;

            // Lots
            NUDLots.Parent = PnlInput;
            NUDLots.BeginInit();
            NUDLots.Minimum       = 0.01M;
            NUDLots.Maximum       = 100;
            NUDLots.Increment     = 0.01M;
            NUDLots.DecimalPlaces = 2;
            NUDLots.Value         = (decimal)Data.Strategy.EntryLots;
            NUDLots.EndInit();

            // NumericUpDown Entry Price
            NUDEntryPrice.Parent = PnlInput;

            // NumericUpDown Exit Price
            NUDExitPrice.Parent = PnlInput;

            // NumericUpDown Reducing Lots
            NUDDays.Parent = PnlInput;
            NUDDays.BeginInit();
            NUDDays.Minimum   = 0;
            NUDDays.Maximum   = 1000;
            NUDDays.Increment = 1;
            NUDDays.Value     = 1;
            NUDDays.EndInit();

            // Output Names
            var asOutputNames = new[]
            {
                Language.T("Required margin"),
                Language.T("Gross profit"),
                Language.T("Spread"),
                Language.T("Entry commission"),
                Language.T("Exit commission"),
                Language.T("Rollover"),
                Language.T("Slippage"),
                Language.T("Net profit")
            };

            number = 0;
            foreach (string name in asOutputNames)
            {
                AlblOutputNames[number] = new Label
                {
                    Parent    = PnlOutput,
                    ForeColor = _colorText,
                    BackColor = Color.Transparent,
                    AutoSize  = true,
                    Text      = name
                };

                AlblOutputValues[number] = new Label
                {
                    Parent    = PnlOutput,
                    ForeColor = _colorText,
                    BackColor = Color.Transparent,
                    AutoSize  = true
                };

                number++;
            }

            AlblOutputNames[number - 1].Font  = new Font(Font.FontFamily, Font.Size, FontStyle.Bold);
            AlblOutputValues[number - 1].Font = new Font(Font.FontFamily, Font.Size, FontStyle.Bold);

            Timer = new Timer {
                Interval = 2000
            };
            Timer.Tick += TimerTick;
            Timer.Start();
        }
コード例 #30
0
        /// <summary>
        /// Public Constructor
        /// </summary>
        public StartingTips()
        {
            PnlBase = new FancyPanel();
            PnlControl = new Panel();
            Browser = new WebBrowser();
            ChboxShow = new CheckBox();
            BtnNextTip = new Button();
            BtnPrevTip = new Button();
            BtnClose = new Button();

            _xmlTips = new XmlDocument();

            Text = Language.T("Tip of the Day");
            FormBorderStyle = FormBorderStyle.FixedDialog;
            Icon = Data.Icon;
            MaximizeBox = false;
            MinimizeBox = false;
            TopMost = true;

            PnlBase.Parent = this;

            Browser.Parent = PnlBase;
            Browser.AllowNavigation = true;
            Browser.AllowWebBrowserDrop = false;
            Browser.DocumentText = Language.T("Loading...");
            Browser.Dock = DockStyle.Fill;
            Browser.TabStop = false;
            Browser.DocumentCompleted += BrowserDocumentCompleted;
            Browser.IsWebBrowserContextMenuEnabled = false;
            Browser.WebBrowserShortcutsEnabled = false;

            PnlControl.Parent = this;
            PnlControl.Dock = DockStyle.Bottom;
            PnlControl.BackColor = Color.Transparent;

            ChboxShow.Parent = PnlControl;
            ChboxShow.Text = Language.T("Show a tip");
            ChboxShow.Checked = Configs.ShowStartingTip;
            ChboxShow.TextAlign = ContentAlignment.MiddleLeft;
            ChboxShow.AutoSize = true;
            ChboxShow.ForeColor = LayoutColors.ColorControlText;
            ChboxShow.CheckStateChanged += ChboxShowCheckStateChanged;

            BtnNextTip.Parent = PnlControl;
            BtnNextTip.Text = Language.T("Next Tip");
            BtnNextTip.Name = "Next";
            BtnNextTip.Click += Navigate;
            BtnNextTip.UseVisualStyleBackColor = true;

            BtnPrevTip.Parent = PnlControl;
            BtnPrevTip.Text = Language.T("Previous Tip");
            BtnPrevTip.Name = "Previous";
            BtnPrevTip.Click += Navigate;
            BtnPrevTip.UseVisualStyleBackColor = true;

            BtnClose.Parent = PnlControl;
            BtnClose.Text = Language.T("Close");
            BtnClose.Name = "Close";
            BtnClose.Click += Navigate;
            BtnClose.UseVisualStyleBackColor = true;

            LoadStartingTips();
        }
コード例 #31
0
        public AboutScreen()
        {
            PnlBase = new FancyPanel();
            Label1 = new Label();
            Label2 = new Label();
            Label3 = new Label();
            Label4 = new Label();
            Label5 = new Label();
            Label6 = new Label();
            PictureBox1 = new PictureBox();
            LlWebsite = new LinkLabel();
            LlForum = new LinkLabel();
            LlEmail = new LinkLabel();
            LlCredits = new LinkLabel();
            BtnOk = new Button();

            // Panel Base
            PnlBase.Parent = this;

            // pictureBox1
            PictureBox1.TabStop = false;
            PictureBox1.BackColor = Color.Transparent;
            PictureBox1.Image = Resources.Logo;

            // label1
            Label1.AutoSize = true;
            Label1.Font = new Font("Microsoft Sans Serif", 16F, FontStyle.Bold);
            Label1.ForeColor = LayoutColors.ColorControlText;
            Label1.BackColor = Color.Transparent;
            Label1.Text = Data.ProgramName;

            string stage = String.Empty;
            if (Data.IsProgramBeta)
                stage = " " + Language.T("Beta");
            else if (Data.IsProgramRC)
                stage = " " + "RC";

            // label2
            Label2.AutoSize = true;
            Label2.Font = new Font("Microsoft Sans Serif", 12F);
            Label2.ForeColor = LayoutColors.ColorControlText;
            Label2.BackColor = Color.Transparent;
            Label2.Text = Language.T("Version") + ": " + Data.ProgramVersion + stage;

            // label3
            Label3.AutoSize = true;
            Label3.Font = new Font("Microsoft Sans Serif", 10F);
            Label3.ForeColor = LayoutColors.ColorControlText;
            Label3.BackColor = Color.Transparent;
            Label3.Text = "Copyright © 2006 - 2012 Miroslav Popov" + Environment.NewLine + Language.T("Distributor") +
                          " - Forex Software Ltd." + Environment.NewLine + Environment.NewLine +
                          Language.T("This is a freeware program!");

            // label4
            Label4.AutoSize = true;
            Label4.ForeColor = LayoutColors.ColorControlText;
            Label4.BackColor = Color.Transparent;
            Label4.Text = Language.T("Website") + ":";

            // label5
            Label5.AutoSize = true;
            Label5.ForeColor = LayoutColors.ColorControlText;
            Label5.BackColor = Color.Transparent;
            Label5.Text = Language.T("Support forum") + ":";

            // label6
            Label6.AutoSize = true;
            Label6.ForeColor = LayoutColors.ColorControlText;
            Label6.BackColor = Color.Transparent;
            Label6.Text = Language.T("Contacts") + ":";

            // llWebsite
            LlWebsite.AutoSize = true;
            LlWebsite.TabStop = true;
            LlWebsite.BackColor = Color.Transparent;
            LlWebsite.Text = "http://forexsb.com";
            LlWebsite.Tag = "http://forexsb.com/";
            LlWebsite.LinkClicked += WebsiteLinkClicked;

            // llForum
            LlForum.AutoSize = true;
            LlForum.TabStop = true;
            LlForum.BackColor = Color.Transparent;
            LlForum.Text = "http://forexsb.com/forum";
            LlForum.Tag = "http://forexsb.com/forum/";
            LlForum.LinkClicked += WebsiteLinkClicked;

            // llEmail
            LlEmail.AutoSize = true;
            LlEmail.TabStop = true;
            LlEmail.BackColor = Color.Transparent;
            LlEmail.Text = "*****@*****.**";
            LlEmail.Tag = "mailto:[email protected]";
            LlEmail.LinkClicked += WebsiteLinkClicked;

            // LlCredits
            LlCredits.AutoSize = true;
            LlCredits.TabStop = true;
            LlCredits.BackColor = Color.Transparent;
            LlCredits.Text = Language.T("Credits and Contributors");
            LlCredits.Tag = "http://forexsb.com/wiki/credits";
            LlCredits.LinkClicked += WebsiteLinkClicked;

            // Button Base
            BtnOk.Parent = this;
            BtnOk.Text = Language.T("Ok");
            BtnOk.UseVisualStyleBackColor = true;
            BtnOk.Click += BtnOkClick;

            // AboutScreen
            PnlBase.Controls.Add(Label1);
            PnlBase.Controls.Add(Label2);
            PnlBase.Controls.Add(Label3);
            PnlBase.Controls.Add(Label4);
            PnlBase.Controls.Add(Label5);
            PnlBase.Controls.Add(Label6);
            PnlBase.Controls.Add(LlEmail);
            PnlBase.Controls.Add(LlForum);
            PnlBase.Controls.Add(LlWebsite);
            PnlBase.Controls.Add(LlCredits);
            PnlBase.Controls.Add(PictureBox1);

            StartPosition = FormStartPosition.CenterScreen;
            Text = Language.T("About") + " " + Data.ProgramName;
            FormBorderStyle = FormBorderStyle.FixedDialog;
            BackColor = LayoutColors.ColorFormBack;
            MaximizeBox = false;
            MinimizeBox = false;
            ShowInTaskbar = false;
            ClientSize = new Size(360, 310);
        }
コード例 #32
0
        /// <summary>
        /// Constructor
        /// </summary>
        public FibonacciLevelsCalculator()
        {
            PnlInput = new FancyPanel(Language.T("Input Values"));
            PnlOutput = new FancyPanel(Language.T("Output Values"));

            AlblInputNames = new Label[2];
            AtbxInputValues = new TextBox[2];
            AlblOutputNames = new Label[10];
            AlblOutputValues = new Label[10];

            _colorText = LayoutColors.ColorControlText;

            MaximizeBox = false;
            MinimizeBox = false;
            Icon = Data.Icon;
            BackColor = LayoutColors.ColorFormBack;
            FormBorderStyle = FormBorderStyle.FixedDialog;
            Text = Language.T("Fibonacci Levels");

            // Input
            PnlInput.Parent = this;

            // Output
            PnlOutput.Parent = this;

            // Input Names
            var asInputNames = new[]
                                   {
                                       Language.T("First price"),
                                       Language.T("Second price")
                                   };

            int number = 0;
            foreach (string name in asInputNames)
            {
                AlblInputNames[number] = new Label
                                             {
                                                 Parent = PnlInput,
                                                 ForeColor = _colorText,
                                                 BackColor = Color.Transparent,
                                                 AutoSize = true,
                                                 Text = name
                                             };

                AtbxInputValues[number] = new TextBox {Parent = PnlInput};
                AtbxInputValues[number].TextChanged += TbxInputTextChanged;
                number++;
            }

            // Output Names
            number = 0;
            foreach (float fn in _afLevels)
            {
                AlblOutputNames[number] = new Label
                                              {
                                                  Parent = PnlOutput,
                                                  ForeColor = _colorText,
                                                  BackColor = Color.Transparent,
                                                  AutoSize = true,
                                                  Text = fn.ToString("F1") + " %"
                                              };

                AlblOutputValues[number] = new Label
                                               {
                                                   Parent = PnlOutput,
                                                   ForeColor = _colorText,
                                                   BackColor = Color.Transparent,
                                                   AutoSize = true
                                               };

                number++;
            }

            Font font = Font;
            AlblOutputNames[2].Font = new Font(font.FontFamily, font.Size, FontStyle.Bold);
            AlblOutputNames[3].Font = new Font(font.FontFamily, font.Size, FontStyle.Bold);
            AlblOutputNames[4].Font = new Font(font.FontFamily, font.Size, FontStyle.Bold);
            AlblOutputValues[2].Font = new Font(font.FontFamily, font.Size, FontStyle.Bold);
            AlblOutputValues[3].Font = new Font(font.FontFamily, font.Size, FontStyle.Bold);
            AlblOutputValues[4].Font = new Font(font.FontFamily, font.Size, FontStyle.Bold);
        }