/// <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;
        }
        /// <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);
            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;
        }
        /// <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;
        }
        /// <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;
        }
        /// <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;
        }
Пример #6
0
        public AboutScreen()
        {
            PnlBase = new FancyPanel();
            LblProgramName = new Label();
            LblProgramVersion = new Label();
            LblLibraryVersion = new Label();
            LblExpertVersion = new Label();
            LblCopyright = new Label();
            LblWebsite = new Label();
            LblSupportForum = new Label();
            LblContacts = new Label();
            PictureLogo = new PictureBox();
            LinkWebsite = new LinkLabel();
            LinkForum = new LinkLabel();
            LinkEmail = new LinkLabel();
            LinkCredits = new LinkLabel();
            BtnOk = new Button();

            // Panel Base
            PnlBase.Parent = this;

            PictureLogo.TabStop = false;
            PictureLogo.BackColor = Color.Transparent;
            PictureLogo.Image = Resources.Logo;

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

            LblProgramVersion.AutoSize = true;
            LblProgramVersion.Font = new Font("Microsoft Sans Serif", 12F);
            LblProgramVersion.ForeColor = LayoutColors.ColorControlText;
            LblProgramVersion.BackColor = Color.Transparent;
            LblProgramVersion.Text = Language.T("Program version") + ": " + Data.ProgramVersion +
                                     (Data.IsProgramBeta ? " " + Language.T("Beta") : "");

            LblLibraryVersion.AutoSize = true;
            LblLibraryVersion.Font = new Font("Microsoft Sans Serif", 10F);
            LblLibraryVersion.ForeColor = LayoutColors.ColorControlText;
            LblLibraryVersion.BackColor = Color.Transparent;
            LblLibraryVersion.Text = Language.T("Library version") + ": " + Data.LibraryVersion;

            // label4
            LblExpertVersion.AutoSize = true;
            LblExpertVersion.Font = new Font("Microsoft Sans Serif", 10F);
            LblExpertVersion.ForeColor = LayoutColors.ColorControlText;
            LblExpertVersion.BackColor = Color.Transparent;
            LblExpertVersion.Text = Language.T("Expert version") + ": " + Data.ExpertVersion;

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

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

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

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

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

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

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

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

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

            // AboutScreen
            PnlBase.Controls.Add(LblProgramName);
            PnlBase.Controls.Add(LblProgramVersion);
            PnlBase.Controls.Add(LblLibraryVersion);
            PnlBase.Controls.Add(LblExpertVersion);
            PnlBase.Controls.Add(LblCopyright);
            PnlBase.Controls.Add(LblWebsite);
            PnlBase.Controls.Add(LblSupportForum);
            PnlBase.Controls.Add(LblContacts);
            PnlBase.Controls.Add(LinkWebsite);
            PnlBase.Controls.Add(LinkForum);
            PnlBase.Controls.Add(LinkEmail);
            PnlBase.Controls.Add(LinkCredits);
            PnlBase.Controls.Add(PictureLogo);

            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, 350);
        }
Пример #7
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();
        }
Пример #8
0
        public StrategyProperties()
        {
            PermanentTP     = 100;
            PermanentTPType = PermanentProtectionType.Relative;
            UsePermanentTP  = false;
            BreakEven       = 100;
            UseBreakEven    = false;
            PermanentSL     = 100;
            PermanentSLType = PermanentProtectionType.Relative;
            UsePermanentSL  = false;
            PnlAveraging    = new FancyPanel(Language.T("Handling of Additional Entry Signals"),
                                             LayoutColors.ColorSlotCaptionBackAveraging, LayoutColors.ColorSlotCaptionText);
            PnlAmounts = new FancyPanel(Language.T("Trading Size"), LayoutColors.ColorSlotCaptionBackAveraging,
                                        LayoutColors.ColorSlotCaptionText);
            PnlProtection = new FancyPanel(Language.T("Permanent Protection"),
                                           LayoutColors.ColorSlotCaptionBackAveraging,
                                           LayoutColors.ColorSlotCaptionText);

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

            LblAveragingSameDir = new Label();
            LblAveragingOppDir  = new Label();

            CbxSameDirAction = new ComboBox();
            CbxOppDirAction  = new ComboBox();
            NudMaxOpenLots   = new NumericUpDown();
            RbConstantUnits  = new RadioButton();
            RbVariableUnits  = new RadioButton();
            NudEntryLots     = new NumericUpDown();
            NudAddingLots    = new NumericUpDown();
            NudReducingLots  = new NumericUpDown();
            LblMaxOpenLots   = new Label();
            LblEntryLots     = new Label();
            LblAddingLots    = new Label();
            LblReducingLots  = new Label();

            ChbPermaSL              = new CheckBox();
            CbxPermaSLType          = new ComboBox();
            NudPermaSL              = new NumericUpDown();
            ChbPermaTP              = new CheckBox();
            CbxPermaTPType          = new ComboBox();
            NudPermaTP              = new NumericUpDown();
            ChbBreakEven            = new CheckBox();
            NudBreakEven            = new NumericUpDown();
            CbxUseMartingale        = new CheckBox();
            NudMartingaleMultiplier = new NumericUpDown();


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

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

            // pnlAveraging
            PnlAveraging.Parent = this;

            // pnlAmounts
            PnlAmounts.Parent = this;

            // pnlProtection
            PnlProtection.Parent = this;

            // Label Same dir action
            LblAveragingSameDir.Parent    = PnlAveraging;
            LblAveragingSameDir.ForeColor = LayoutColors.ColorControlText;
            LblAveragingSameDir.BackColor = Color.Transparent;
            LblAveragingSameDir.AutoSize  = true;
            LblAveragingSameDir.Text      = Language.T("Next same direction signal behaviour");

            // Label Opposite dir action
            LblAveragingOppDir.Parent    = PnlAveraging;
            LblAveragingOppDir.ForeColor = LayoutColors.ColorControlText;
            LblAveragingOppDir.BackColor = Color.Transparent;
            LblAveragingOppDir.AutoSize  = true;
            LblAveragingOppDir.Text      = Language.T("Next opposite direction signal behaviour");

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

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

            // Label MaxOpen Lots
            LblMaxOpenLots.Parent    = PnlAmounts;
            LblMaxOpenLots.ForeColor = LayoutColors.ColorControlText;
            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         = (decimal)MaxOpenLots;
            NudMaxOpenLots.DecimalPlaces = 2;
            NudMaxOpenLots.TextAlign     = HorizontalAlignment.Center;
            NudMaxOpenLots.EndInit();

            // Radio Button Constant Units
            RbConstantUnits.Parent    = PnlAmounts;
            RbConstantUnits.ForeColor = LayoutColors.ColorControlText;
            RbConstantUnits.BackColor = Color.Transparent;
            RbConstantUnits.Checked   = !UseAccountPercentEntry;
            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 = LayoutColors.ColorControlText;
            RbVariableUnits.BackColor = Color.Transparent;
            RbVariableUnits.Checked   = UseAccountPercentEntry;
            RbVariableUnits.AutoSize  = false;
            RbVariableUnits.Name      = "rbVariableUnits";
            RbVariableUnits.Text      =
                Language.T(
                    "Trade a variable number of lots depending on your current account equity. The percentage values show the part of the account equity used to cover the required margin.");

            // Label Entry Lots
            LblEntryLots.Parent    = PnlAmounts;
            LblEntryLots.ForeColor = LayoutColors.ColorControlText;
            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         = (decimal)EntryLots;
            NudEntryLots.DecimalPlaces = 2;
            NudEntryLots.TextAlign     = HorizontalAlignment.Center;
            NudEntryLots.EndInit();

            // Label Entry Lots %
            LblPercent1.Parent    = PnlAmounts;
            LblPercent1.ForeColor = LayoutColors.ColorControlText;
            LblPercent1.BackColor = Color.Transparent;
            LblPercent1.AutoSize  = true;
            LblPercent1.Text      = "%";

            // Label Adding Lots
            LblAddingLots.Parent    = PnlAmounts;
            LblAddingLots.ForeColor = LayoutColors.ColorControlText;
            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         = (decimal)AddingLots;
            NudAddingLots.DecimalPlaces = 2;
            NudAddingLots.TextAlign     = HorizontalAlignment.Center;
            NudAddingLots.EndInit();

            // Label Adding Lots %
            LblPercent2.Parent    = PnlAmounts;
            LblPercent2.ForeColor = LayoutColors.ColorControlText;
            LblPercent2.BackColor = Color.Transparent;
            LblPercent2.AutoSize  = true;
            LblPercent2.Text      = "%";

            // Label Reducing Lots
            LblReducingLots.Parent    = PnlAmounts;
            LblReducingLots.ForeColor = LayoutColors.ColorControlText;
            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.Value         = (decimal)ReducingLots;
            NudReducingLots.DecimalPlaces = 2;
            NudReducingLots.TextAlign     = HorizontalAlignment.Center;
            NudReducingLots.EndInit();

            // Label Reducing Lots %
            LblPercent3.Parent    = PnlAmounts;
            LblPercent3.ForeColor = LayoutColors.ColorControlText;
            LblPercent3.BackColor = Color.Transparent;
            LblPercent3.AutoSize  = true;
            LblPercent3.Text      = "%";

            // CheckBox Use Martingale
            CbxUseMartingale.Name      = "cbxUseMartingale";
            CbxUseMartingale.Parent    = PnlAmounts;
            CbxUseMartingale.ForeColor = LayoutColors.ColorControlText;
            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();

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

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

            // NumericUpDown Permanent S/L
            NudPermaSL.Parent = PnlProtection;
            NudPermaSL.Name   = "nudPermaSL";
            NudPermaSL.BeginInit();
            NudPermaSL.Minimum   = 5;
            NudPermaSL.Maximum   = 5000;
            NudPermaSL.Increment = 1;
            NudPermaSL.Value     = PermanentSL;
            NudPermaSL.TextAlign = HorizontalAlignment.Center;
            NudPermaSL.EndInit();

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

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

            // NumericUpDown Permanent Take Profit
            NudPermaTP.Parent = PnlProtection;
            NudPermaTP.Name   = "nudPermaTP";
            NudPermaTP.BeginInit();
            NudPermaTP.Minimum   = 5;
            NudPermaTP.Maximum   = 5000;
            NudPermaTP.Increment = 1;
            NudPermaTP.Value     = PermanentTP;
            NudPermaTP.TextAlign = HorizontalAlignment.Center;
            NudPermaTP.EndInit();

            // CheckBox Break Even
            ChbBreakEven.Parent    = PnlProtection;
            ChbBreakEven.ForeColor = LayoutColors.ColorControlText;
            ChbBreakEven.BackColor = Color.Transparent;
            ChbBreakEven.AutoCheck = true;
            ChbBreakEven.AutoSize  = true;
            ChbBreakEven.Name      = "chbBreakEven";
            ChbBreakEven.Text      = Language.T("Break Even") + " [" + Language.T("pips") + "]";

            // NumericUpDown Break Even
            NudBreakEven.Parent = PnlProtection;
            NudBreakEven.Name   = "nudBreakEven";
            NudBreakEven.BeginInit();
            NudBreakEven.Minimum   = 5;
            NudBreakEven.Maximum   = 5000;
            NudBreakEven.Increment = 1;
            NudBreakEven.Value     = BreakEven;
            NudBreakEven.TextAlign = HorizontalAlignment.Center;
            NudBreakEven.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;
        }
Пример #9
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;
        }
        /// <summary>
        ///     Constructor
        /// </summary>
        public IndicatorDialog(int slotNumb, SlotTypes slotType, bool isSlotDefined)
        {
            slot     = slotNumb;
            SlotType = slotType;

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

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

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

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

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

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

            PnlParameters.Parent = this;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            SetTreeViewIndicators();

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

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

            OppSignalBehaviour = Data.Strategy.OppSignalAction;

            if (slotType == SlotTypes.Close && Data.Strategy.CloseFilters > 0)
            {
                for (int iSlot = Data.Strategy.CloseSlot + 1; iSlot < Data.Strategy.Slots; iSlot++)
                {
                    closingConditions.Add(Data.Strategy.Slot[iSlot].Clone());
                }
            }
        }
Пример #11
0
        /// <summary>
        ///     Sets the controls in tabPageStatus
        /// </summary>
        private void InitializePageStatus()
        {
            // tabPageStatus
            TabPageStatus.Name       = "tabPageStatus";
            TabPageStatus.Text       = Language.T("Status");
            TabPageStatus.ImageIndex = 0;
            TabPageStatus.Resize    += TabPageStatusResize;

            // Panel Warning
            PnlWarning = new FancyPanel
            {
                Height  = 0,
                Enabled = false,
                Visible = false
            };

            // Panel Connection
            PnlConnection = new FancyPanel(Language.T("Connection Status"))
            {
                Parent = TabPageStatus
            };

            // lblConnection
            LblConnection = new Label
            {
                Name      = "lblConnection",
                Parent    = PnlConnection,
                Text      = Language.T("Not Connected. You have to connect to a MetaTrader terminal."),
                TextAlign = ContentAlignment.MiddleLeft
            };

            // Panel Data Info
            PnlDataInfoBase = new FancyPanel(Language.T("Data Info"))
            {
                Parent = TabPageStatus
            };
            PnlDataInfoBase.Padding = new Padding(2, (int)PnlDataInfoBase.CaptionHeight, 2, 2);

            TbxDataInfo = new TextBox
            {
                Parent        = PnlDataInfoBase,
                BorderStyle   = BorderStyle.None,
                Dock          = DockStyle.Fill,
                TabStop       = false,
                Multiline     = true,
                AcceptsReturn = true,
                AcceptsTab    = true,
                WordWrap      = false,
                ScrollBars    = ScrollBars.Vertical,
                Font          = new Font("Courier New", 8.25F, FontStyle.Regular, GraphicsUnit.Point, ((204)))
            };

            PnlDataInfoButtons = new Panel {
                Parent = PnlDataInfoBase, Dock = DockStyle.Top
            };
            PnlDataInfoButtons.Paint += PnlDataInfoButtons_Paint;

            BtnShowMarketInfo = new Button {
                Parent = PnlDataInfoButtons, Text = Language.T("Market Info")
            };
            BtnShowMarketInfo.Click += BtnShowMarketInfoClick;
            BtnShowMarketInfo.UseVisualStyleBackColor = true;

            BtnShowAccountInfo = new Button {
                Parent = PnlDataInfoButtons, Text = Language.T("Account Info")
            };
            BtnShowAccountInfo.Click += BtnShowAccountInfoClick;
            BtnShowAccountInfo.UseVisualStyleBackColor = true;

            BtnShowBars = new Button {
                Parent = PnlDataInfoButtons, Text = Language.T("Loaded Bars")
            };
            BtnShowBars.Click += BtnShowBarsClick;
            BtnShowBars.UseVisualStyleBackColor = true;

            PnlMarketInfo = new InfoPanel(Language.T("Market Information"))
            {
                Parent = TabPageStatus
            };
            PnlUsefulLinks = new LinkPanel(Language.T("Useful Links"))
            {
                Parent = TabPageStatus
            };
            PnlForexBrokers = new LinkPanel(Language.T("Forex Brokers"))
            {
                Parent = TabPageStatus
            };

            SetStatusColors();
        }
        /// <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("points") + "]";

            // 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.SwapUnit == ChargeUnit.Money
                                    ? Data.InstrProperties.PriceIn
                                    : Language.T(Data.InstrProperties.SwapUnit.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.SwapUnit == ChargeUnit.Money
                                     ? Data.InstrProperties.PriceIn
                                     : Language.T(Data.InstrProperties.SwapUnit.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.CommissionUnit == ChargeUnit.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("points") + "]";

            // 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 points 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;
        }
        /// <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();
        }
        /// <summary>
        ///     Constructor
        /// </summary>
        public IndicatorDialog(int slotNumb, SlotTypes slotType, bool isSlotDefined)
        {
            slot = slotNumb;
            SlotType = slotType;

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

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

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

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

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

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

            PnlParameters.Parent = this;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            SetTreeViewIndicators();

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

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

            OppSignalBehaviour = Data.Strategy.OppSignalAction;

            if (slotType == SlotTypes.Close && Data.Strategy.CloseFilters > 0)
                for (int iSlot = Data.Strategy.CloseSlot + 1; iSlot < Data.Strategy.Slots; iSlot++)
                    closingConditions.Add(Data.Strategy.Slot[iSlot].Clone());
        }
        /// <summary>
        ///     Constructor
        /// </summary>
        public 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);
        }
        /// <summary>
        ///     Initializes Operation tab page.
        /// </summary>
        private void InitializePageOperation()
        {
            TabPageOperation.Name       = "tabPageOperation";
            TabPageOperation.Text       = Language.T("Operation");
            TabPageOperation.ImageIndex = 5;
            TabPageOperation.BackColor  = LayoutColors.ColorFormBack;

            PnlManualTrade = new FancyPanel(Language.T("Manual Operation Execution"))
            {
                Parent = TabPageOperation, Dock = DockStyle.Fill
            };
            PnlManualTrade.Resize += PnlManualTradeResize;

            PnlHolder = new Panel {
                Parent = PnlManualTrade, BackColor = Color.Transparent, Size = new Size((int)(750 * Data.HDpiScale), 350)
            };

            LblSymbol = new Label
            {
                Parent    = PnlHolder,
                Text      = "Symbol",
                BackColor = Color.Transparent,
                ForeColor = LayoutColors.ColorControlText,
                Font      = new Font(Font.FontFamily, 18, FontStyle.Bold)
            };
            LblSymbol.Height    = LblSymbol.Font.Height;
            LblSymbol.Width     = (int)(180 * Data.HDpiScale);
            LblSymbol.TextAlign = ContentAlignment.MiddleRight;
            LblSymbol.Location  = new Point(5, 35);

            LblBidAsk = new Label
            {
                Parent    = PnlHolder,
                Text      = "Bid / Ask",
                BackColor = Color.Transparent,
                ForeColor = LayoutColors.ColorControlText,
                Font      = new Font(Font.FontFamily, 18, FontStyle.Bold),
                Width     = 295,
                TextAlign = ContentAlignment.MiddleCenter,
                Location  = new Point(LblSymbol.Right + Space, 35)
            };
            LblBidAsk.Height = LblBidAsk.Font.Height;

            LblLots = new Label
            {
                Parent    = PnlHolder,
                Text      = Language.T("Lots"),
                Font      = new Font(Font.FontFamily, 11),
                BackColor = Color.Transparent,
                ForeColor = LayoutColors.ColorControlText,
                Width     = (int)(90 * Data.HDpiScale)
            };
            LblLots.Height    = LblLots.Font.Height;
            LblLots.TextAlign = ContentAlignment.MiddleRight;
            LblLots.Location  = new Point(5, 81);
            var lblWidth = (int)(100 * Data.HDpiScale);

            LblStopLoss = new Label
            {
                Parent    = PnlHolder,
                Text      = Language.T("Stop Loss"),
                Font      = new Font(Font.FontFamily, 11),
                BackColor = Color.Transparent,
                ForeColor = LayoutColors.ColorControlText,
                Location  = new Point(5, 121),
                Width     = lblWidth,
                TextAlign = ContentAlignment.MiddleRight
            };

            LblTakeProfit = new Label
            {
                Parent    = PnlHolder,
                Font      = new Font(Font.FontFamily, 11),
                Text      = Language.T("Take Profit"),
                BackColor = Color.Transparent,
                ForeColor = LayoutColors.ColorControlText,
                Location  = new Point(5, 151),
                Width     = lblWidth,
                TextAlign = ContentAlignment.MiddleRight
            };

            LblBreakEven = new Label
            {
                Parent    = PnlHolder,
                Font      = new Font(Font.FontFamily, 11),
                Text      = Language.T("Break Even"),
                BackColor = Color.Transparent,
                ForeColor = LayoutColors.ColorControlText,
                Location  = new Point(5, 191),
                Width     = lblWidth,
                TextAlign = ContentAlignment.MiddleRight
            };

            LblTrailingStop = new Label
            {
                Parent    = PnlHolder,
                Font      = new Font(Font.FontFamily, 11),
                Text      = Language.T("Trailing Stop"),
                BackColor = Color.Transparent,
                ForeColor = LayoutColors.ColorControlText,
                Location  = new Point(5, 221),
                Width     = lblWidth,
                TextAlign = ContentAlignment.MiddleRight
            };


            int nudLeft = LblTrailingStop.Right + Space;

            NudLots = new NumericUpDown
            {
                Parent    = PnlHolder,
                Font      = new Font(Font.FontFamily, 11),
                TextAlign = HorizontalAlignment.Center,
                Width     = 80,
                Location  = new Point(nudLeft, 81)
            };
            NudLots.BeginInit();
            NudLots.Minimum       = 0.1M;
            NudLots.Maximum       = 100;
            NudLots.Increment     = 0.1M;
            NudLots.Value         = 1;
            NudLots.DecimalPlaces = 1;
            NudLots.EndInit();

            NudStopLoss = new NumericUpDown
            {
                Parent    = PnlHolder,
                Font      = new Font(Font.FontFamily, 11),
                TextAlign = HorizontalAlignment.Center,
                Width     = 80,
                Location  = new Point(nudLeft, 121)
            };
            NudStopLoss.BeginInit();
            NudStopLoss.Minimum       = 0;
            NudStopLoss.Maximum       = 5000;
            NudStopLoss.Increment     = 1;
            NudStopLoss.Value         = 0;
            NudStopLoss.DecimalPlaces = 0;
            NudStopLoss.EndInit();
            NudStopLoss.ValueChanged += ParameterValueChanged;

            ColorParameter = NudStopLoss.ForeColor;

            NudTakeProfit = new NumericUpDown
            {
                Parent    = PnlHolder,
                Font      = new Font(Font.FontFamily, 11),
                TextAlign = HorizontalAlignment.Center,
                Width     = 80,
                Location  = new Point(nudLeft, 151)
            };
            NudTakeProfit.BeginInit();
            NudTakeProfit.Minimum       = 0;
            NudTakeProfit.Maximum       = 5000;
            NudTakeProfit.Increment     = 1;
            NudTakeProfit.Value         = 0;
            NudTakeProfit.DecimalPlaces = 0;
            NudTakeProfit.EndInit();
            NudTakeProfit.ValueChanged += ParameterValueChanged;

            NudBreakEven = new NumericUpDown
            {
                Parent    = PnlHolder,
                Font      = new Font(Font.FontFamily, 11),
                TextAlign = HorizontalAlignment.Center,
                Width     = 80,
                Location  = new Point(nudLeft, 191)
            };
            NudBreakEven.BeginInit();
            NudBreakEven.Minimum       = 0;
            NudBreakEven.Maximum       = 5000;
            NudBreakEven.Increment     = 1;
            NudBreakEven.Value         = 0;
            NudBreakEven.DecimalPlaces = 0;
            NudBreakEven.EndInit();
            NudBreakEven.ValueChanged += ParameterValueChanged;

            NudTrailingStop = new NumericUpDown
            {
                Parent    = PnlHolder,
                Font      = new Font(Font.FontFamily, 11),
                TextAlign = HorizontalAlignment.Center,
                Width     = 80,
                Location  = new Point(nudLeft, 221)
            };
            NudTrailingStop.BeginInit();
            NudTrailingStop.Minimum       = 0;
            NudTrailingStop.Maximum       = 5000;
            NudTrailingStop.Increment     = 1;
            NudTrailingStop.Value         = 0;
            NudTrailingStop.DecimalPlaces = 0;
            NudTrailingStop.EndInit();
            NudTrailingStop.ValueChanged += ParameterValueChanged;

            int btnLeft = NudTrailingStop.Right + 2 * Space;

            BtnSell = new Button
            {
                Name       = "btnSell",
                Parent     = PnlHolder,
                Image      = Resources.btn_operation_sell,
                ImageAlign = ContentAlignment.MiddleLeft,
                Text       = Language.T("Sell"),
                Width      = 145,
                Height     = 40,
                Font       = new Font(Font.FontFamily, 16),
                ForeColor  = Color.Crimson,
                Location   = new Point(btnLeft, 80),
                UseVisualStyleBackColor = true
            };
            BtnSell.Click += BtnOperationClick;

            BtnBuy = new Button
            {
                Name       = "btnBuy",
                Parent     = PnlHolder,
                Image      = Resources.btn_operation_buy,
                ImageAlign = ContentAlignment.MiddleLeft,
                Text       = Language.T("Buy"),
                Width      = 145,
                Height     = 40,
                Font       = new Font(Font.FontFamily, 16),
                ForeColor  = Color.Green,
                Location   = new Point(BtnSell.Right + Space, 80),
                UseVisualStyleBackColor = true
            };
            BtnBuy.Click += BtnOperationClick;

            BtnClose = new Button
            {
                Name       = "btnClose",
                Parent     = PnlHolder,
                Image      = Resources.btn_operation_close,
                ImageAlign = ContentAlignment.MiddleLeft,
                Text       = Language.T("Close"),
                Width      = 295,
                Height     = 40,
                Font       = new Font(Font.FontFamily, 16, FontStyle.Bold),
                ForeColor  = Color.DarkOrange,
                Location   = new Point(btnLeft, 126),
                UseVisualStyleBackColor = true
            };
            BtnClose.Click += BtnOperationClick;

            BtnModify = new Button
            {
                Name       = "btnModify",
                Parent     = PnlHolder,
                Image      = Resources.recalculate,
                ImageAlign = ContentAlignment.MiddleLeft,
                Text       = Language.T("Modify Stop Loss and Take Profit"),
                ForeColor  = Color.Navy,
                Width      = 295,
                Location   = new Point(btnLeft, 172),
                UseVisualStyleBackColor = true
            };
            BtnModify.Click += BtnOperationClick;

            int chartLeft = BtnModify.Right + 2 * Space;

            TickChart = new TickChart(Language.T("Tick Chart"))
            {
                Parent   = PnlHolder,
                Size     = new Size(250, 200),
                Location = new Point(chartLeft, 81)
            };
        }
        /// <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;
        }
        /// <summary>
        /// Sets the controls in tabPageStrategy
        /// </summary>
        private void InitializePageStrategy()
        {
            // tabPageStrategy
            TabPageStrategy.Name       = "tabPageStrategy";
            TabPageStrategy.Text       = Language.T("Strategy");
            TabPageStrategy.ImageIndex = 1;
            TabPageStrategy.Resize    += TabPageStrategyResize;

            PnlOverviewBase = new Panel {
                Parent = TabPageStrategy, Dock = DockStyle.Fill
            };

            PnlStrategyBase = new Panel {
                Parent = TabPageStrategy, Dock = DockStyle.Left
            };

            // Panel Browser Base
            PnlBrawserBase         = new FancyPanel(Language.T("Strategy Overview"));
            PnlBrawserBase.Padding = new Padding(2, (int)PnlBrawserBase.CaptionHeight, 2, 2);
            PnlBrawserBase.Parent  = PnlOverviewBase;
            PnlBrawserBase.Dock    = DockStyle.Fill;

            // BrowserOverview
            BrowserOverview = new WebBrowser
            {
                Parent = PnlBrawserBase,
                Dock   = DockStyle.Fill,
                WebBrowserShortcutsEnabled = false,
                AllowWebBrowserDrop        = false
            };

            // StrategyLayout
            StrategyLayout = new StrategyLayout(Data.Strategy.Clone())
            {
                Parent = PnlStrategyBase
            };
            StrategyLayout.BtnAddOpenFilter.Click  += BtnAddOpenFilterClick;
            StrategyLayout.BtnAddCloseFilter.Click += BtnAddCloseFilterClick;

            // ToolStrip Strategy
            TsStrategy = new ToolStrip {
                Parent = PnlStrategyBase, Dock = DockStyle.None, AutoSize = false
            };

            // Button tsbtStrategyNew
            var tsbtStrategyNew = new ToolStripButton
            {
                Name         = "New",
                DisplayStyle = ToolStripItemDisplayStyle.Image,
                Image        = Resources.strategy_new
            };

            tsbtStrategyNew.Click      += BtnStrategyIoClick;
            tsbtStrategyNew.ToolTipText = Language.T("Open the default strategy \"New.xml\".");
            TsStrategy.Items.Add(tsbtStrategyNew);

            // Button tsbtStrategyOpen
            var tsbtStrategyOpen = new ToolStripButton
            {
                Name         = "Open",
                DisplayStyle = ToolStripItemDisplayStyle.Image,
                Image        = Resources.strategy_open
            };

            tsbtStrategyOpen.Click      += BtnStrategyIoClick;
            tsbtStrategyOpen.ToolTipText = Language.T("Open a strategy.");
            TsStrategy.Items.Add(tsbtStrategyOpen);

            // Button tsbtStrategySave
            var tsbtStrategySave = new ToolStripButton
            {
                Name         = "Save",
                DisplayStyle = ToolStripItemDisplayStyle.Image,
                Image        = Resources.strategy_save
            };

            tsbtStrategySave.Click      += BtnStrategyIoClick;
            tsbtStrategySave.ToolTipText = Language.T("Save the strategy.");
            TsStrategy.Items.Add(tsbtStrategySave);

            // Button tsbtStrategySaveAs
            var tsbtStrategySaveAs = new ToolStripButton
            {
                Name         = "SaveAs",
                DisplayStyle = ToolStripItemDisplayStyle.Image,
                Image        = Resources.strategy_save_as
            };

            tsbtStrategySaveAs.Click      += BtnStrategyIoClick;
            tsbtStrategySaveAs.ToolTipText = Language.T("Save a copy of the strategy.");
            TsStrategy.Items.Add(tsbtStrategySaveAs);

            TsStrategy.Items.Add(new ToolStripSeparator());

            // Button tsbtStrategyUndo
            var tsbtStrategyUndo = new ToolStripButton
            {
                Name         = "Undo",
                DisplayStyle = ToolStripItemDisplayStyle.Image,
                Image        = Resources.strategy_undo
            };

            tsbtStrategyUndo.Click      += MenuStrategyUndo_OnClick;
            tsbtStrategyUndo.ToolTipText = Language.T("Undo the last change in the strategy.");
            TsStrategy.Items.Add(tsbtStrategyUndo);

            // Button tsbtStrategyCopy
            var tsbtStrategyCopy = new ToolStripButton
            {
                Name         = "Copy",
                DisplayStyle = ToolStripItemDisplayStyle.Image,
                Image        = Resources.copy
            };

            tsbtStrategyCopy.Click      += MenuStrategyCopy_OnClick;
            tsbtStrategyCopy.ToolTipText = Language.T("Copy the entire strategy to the clipboard.");
            TsStrategy.Items.Add(tsbtStrategyCopy);

            // Button tsbtStrategyPaste
            var tsbtStrategyPaste = new ToolStripButton
            {
                Name         = "Paste",
                DisplayStyle = ToolStripItemDisplayStyle.Image,
                Image        = Resources.paste
            };

            tsbtStrategyPaste.Click      += MenuStrategyPaste_OnClick;
            tsbtStrategyPaste.ToolTipText = Language.T("Load a strategy from the clipboard.");
            TsStrategy.Items.Add(tsbtStrategyPaste);

            TsStrategy.Items.Add(new ToolStripSeparator());

            // Button tsbtStrategyZoomIn
            var tsbtStrategyZoomIn = new ToolStripButton
            {
                Name         = "ZoomIn",
                DisplayStyle = ToolStripItemDisplayStyle.Image,
                Image        = Resources.strategy_zoom_in
            };

            tsbtStrategyZoomIn.Click      += BtnStrategyZoomClick;
            tsbtStrategyZoomIn.ToolTipText = Language.T("Expand the information in the strategy slots.");
            TsStrategy.Items.Add(tsbtStrategyZoomIn);

            // Button tsbtStrategyZoomOut
            var tsbtStrategyZoomOut = new ToolStripButton
            {
                Name         = "ZoomOut",
                DisplayStyle = ToolStripItemDisplayStyle.Image,
                Image        = Resources.strategy_zoom_out
            };

            tsbtStrategyZoomOut.Click      += BtnStrategyZoomClick;
            tsbtStrategyZoomOut.ToolTipText = Language.T("Reduce the information in the strategy slots.");
            TsStrategy.Items.Add(tsbtStrategyZoomOut);

            TsStrategy.Items.Add(new ToolStripSeparator());

            // Button tsbtStrategyDescription
            var tsbtStrategyDescription = new ToolStripButton
            {
                Name         = "Description",
                DisplayStyle = ToolStripItemDisplayStyle.Image,
                Image        = Resources.strategy_description
            };

            tsbtStrategyDescription.Click      += BtnStrategyDescriptionClick;
            tsbtStrategyDescription.ToolTipText = Language.T("Edit the strategy description.");
            TsStrategy.Items.Add(tsbtStrategyDescription);

            // Button tsbtStrategyPublish
            var tsbtStrategyPublish = new ToolStripButton
            {
                Name         = "Publish",
                DisplayStyle = ToolStripItemDisplayStyle.Image,
                Image        = Resources.strategy_publish
            };

            tsbtStrategyPublish.Click      += MenuStrategyBBcode_OnClick;
            tsbtStrategyPublish.ToolTipText = Language.T("Publish the strategy in the program's forum.");
            TsStrategy.Items.Add(tsbtStrategyPublish);

            TsStrategy.Items.Add(new ToolStripSeparator());

            // Button tsbtStrategySettings
            var tsbtStrategySettings = new ToolStripButton
            {
                Name         = "Settings",
                DisplayStyle = ToolStripItemDisplayStyle.Image,
                Image        = Resources.strategy_settings
            };

            tsbtStrategySettings.Click      += BtnStrategySettings_Click;
            tsbtStrategySettings.ToolTipText = Language.T("Trade settings.");
            TsStrategy.Items.Add(tsbtStrategySettings);

            SetStrategyColors();
            RebuildStrategyLayout();
            SetSrategyOverview();
        }
Пример #19
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);
        }
        /// <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();
        }
        /// <summary>
        /// Sets the controls in tabPageStrategy
        /// </summary>
        private void InitializePageStrategy()
        {
            // tabPageStrategy
            TabPageStrategy.Name = "tabPageStrategy";
            TabPageStrategy.Text = Language.T("Strategy");
            TabPageStrategy.ImageIndex = 1;
            TabPageStrategy.Resize += TabPageStrategyResize;

            PnlOverviewBase = new Panel {Parent = TabPageStrategy, Dock = DockStyle.Fill};

            PnlStrategyBase = new Panel {Parent = TabPageStrategy, Dock = DockStyle.Left};

            // Panel Browser Base
            PnlBrawserBase = new FancyPanel(Language.T("Strategy Overview"));
            PnlBrawserBase.Padding = new Padding(2, (int) PnlBrawserBase.CaptionHeight, 2, 2);
            PnlBrawserBase.Parent = PnlOverviewBase;
            PnlBrawserBase.Dock = DockStyle.Fill;

            // BrowserOverview
            BrowserOverview = new WebBrowser
                                  {
                                      Parent = PnlBrawserBase,
                                      Dock = DockStyle.Fill,
                                      WebBrowserShortcutsEnabled = false,
                                      AllowWebBrowserDrop = false
                                  };

            // StrategyLayout
            StrategyLayout = new StrategyLayout(Data.Strategy.Clone()) {Parent = PnlStrategyBase};
            StrategyLayout.BtnAddOpenFilter.Click += BtnAddOpenFilterClick;
            StrategyLayout.BtnAddCloseFilter.Click += BtnAddCloseFilterClick;

            // ToolStrip Strategy
            TsStrategy = new ToolStrip {Parent = PnlStrategyBase, Dock = DockStyle.None, AutoSize = false};

            // Button tsbtStrategyNew
            var tsbtStrategyNew = new ToolStripButton
                                      {
                                          Name = "New",
                                          DisplayStyle = ToolStripItemDisplayStyle.Image,
                                          Image = Resources.strategy_new
                                      };
            tsbtStrategyNew.Click += BtnStrategyIoClick;
            tsbtStrategyNew.ToolTipText = Language.T("Open the default strategy \"New.xml\".");
            TsStrategy.Items.Add(tsbtStrategyNew);

            // Button tsbtStrategyOpen
            var tsbtStrategyOpen = new ToolStripButton
                                       {
                                           Name = "Open",
                                           DisplayStyle = ToolStripItemDisplayStyle.Image,
                                           Image = Resources.strategy_open
                                       };
            tsbtStrategyOpen.Click += BtnStrategyIoClick;
            tsbtStrategyOpen.ToolTipText = Language.T("Open a strategy.");
            TsStrategy.Items.Add(tsbtStrategyOpen);

            // Button tsbtStrategySave
            var tsbtStrategySave = new ToolStripButton
                                       {
                                           Name = "Save",
                                           DisplayStyle = ToolStripItemDisplayStyle.Image,
                                           Image = Resources.strategy_save
                                       };
            tsbtStrategySave.Click += BtnStrategyIoClick;
            tsbtStrategySave.ToolTipText = Language.T("Save the strategy.");
            TsStrategy.Items.Add(tsbtStrategySave);

            // Button tsbtStrategySaveAs
            var tsbtStrategySaveAs = new ToolStripButton
                                         {
                                             Name = "SaveAs",
                                             DisplayStyle = ToolStripItemDisplayStyle.Image,
                                             Image = Resources.strategy_save_as
                                         };
            tsbtStrategySaveAs.Click += BtnStrategyIoClick;
            tsbtStrategySaveAs.ToolTipText = Language.T("Save a copy of the strategy.");
            TsStrategy.Items.Add(tsbtStrategySaveAs);

            TsStrategy.Items.Add(new ToolStripSeparator());

            // Button tsbtStrategyUndo
            var tsbtStrategyUndo = new ToolStripButton
                                       {
                                           Name = "Undo",
                                           DisplayStyle = ToolStripItemDisplayStyle.Image,
                                           Image = Resources.strategy_undo
                                       };
            tsbtStrategyUndo.Click += MenuStrategyUndo_OnClick;
            tsbtStrategyUndo.ToolTipText = Language.T("Undo the last change in the strategy.");
            TsStrategy.Items.Add(tsbtStrategyUndo);

            // Button tsbtStrategyCopy
            var tsbtStrategyCopy = new ToolStripButton
                                       {
                                           Name = "Copy",
                                           DisplayStyle = ToolStripItemDisplayStyle.Image,
                                           Image = Resources.copy
                                       };
            tsbtStrategyCopy.Click += MenuStrategyCopy_OnClick;
            tsbtStrategyCopy.ToolTipText = Language.T("Copy the entire strategy to the clipboard.");
            TsStrategy.Items.Add(tsbtStrategyCopy);

            // Button tsbtStrategyPaste
            var tsbtStrategyPaste = new ToolStripButton
                                        {
                                            Name = "Paste",
                                            DisplayStyle = ToolStripItemDisplayStyle.Image,
                                            Image = Resources.paste
                                        };
            tsbtStrategyPaste.Click += MenuStrategyPaste_OnClick;
            tsbtStrategyPaste.ToolTipText = Language.T("Load a strategy from the clipboard.");
            TsStrategy.Items.Add(tsbtStrategyPaste);

            TsStrategy.Items.Add(new ToolStripSeparator());

            // Button tsbtStrategyZoomIn
            var tsbtStrategyZoomIn = new ToolStripButton
                                         {
                                             Name = "ZoomIn",
                                             DisplayStyle = ToolStripItemDisplayStyle.Image,
                                             Image = Resources.strategy_zoom_in
                                         };
            tsbtStrategyZoomIn.Click += BtnStrategyZoomClick;
            tsbtStrategyZoomIn.ToolTipText = Language.T("Expand the information in the strategy slots.");
            TsStrategy.Items.Add(tsbtStrategyZoomIn);

            // Button tsbtStrategyZoomOut
            var tsbtStrategyZoomOut = new ToolStripButton
                                          {
                                              Name = "ZoomOut",
                                              DisplayStyle = ToolStripItemDisplayStyle.Image,
                                              Image = Resources.strategy_zoom_out
                                          };
            tsbtStrategyZoomOut.Click += BtnStrategyZoomClick;
            tsbtStrategyZoomOut.ToolTipText = Language.T("Reduce the information in the strategy slots.");
            TsStrategy.Items.Add(tsbtStrategyZoomOut);

            TsStrategy.Items.Add(new ToolStripSeparator());

            // Button tsbtStrategyDescription
            var tsbtStrategyDescription = new ToolStripButton
                                              {
                                                  Name = "Description",
                                                  DisplayStyle = ToolStripItemDisplayStyle.Image,
                                                  Image = Resources.strategy_description
                                              };
            tsbtStrategyDescription.Click += BtnStrategyDescriptionClick;
            tsbtStrategyDescription.ToolTipText = Language.T("Edit the strategy description.");
            TsStrategy.Items.Add(tsbtStrategyDescription);

            // Button tsbtStrategyPublish
            var tsbtStrategyPublish = new ToolStripButton
                                          {
                                              Name = "Publish",
                                              DisplayStyle = ToolStripItemDisplayStyle.Image,
                                              Image = Resources.strategy_publish
                                          };
            tsbtStrategyPublish.Click += MenuStrategyBBcode_OnClick;
            tsbtStrategyPublish.ToolTipText = Language.T("Publish the strategy in the program's forum.");
            TsStrategy.Items.Add(tsbtStrategyPublish);

            TsStrategy.Items.Add(new ToolStripSeparator());

            // Button tsbtStrategySettings
            var tsbtStrategySettings = new ToolStripButton
                                           {
                                               Name = "Settings",
                                               DisplayStyle = ToolStripItemDisplayStyle.Image,
                                               Image = Resources.strategy_settings
                                           };
            tsbtStrategySettings.Click += BtnStrategySettings_Click;
            tsbtStrategySettings.ToolTipText = Language.T("Trade settings.");
            TsStrategy.Items.Add(tsbtStrategySettings);

            SetStrategyColors();
            RebuildStrategyLayout();
            SetSrategyOverview();
        }
        /// <summary>
        ///     Initializes Operation tab page.
        /// </summary>
        private void InitializePageOperation()
        {
            TabPageOperation.Name = "tabPageOperation";
            TabPageOperation.Text = Language.T("Operation");
            TabPageOperation.ImageIndex = 5;
            TabPageOperation.BackColor = LayoutColors.ColorFormBack;

            PnlManualTrade = new FancyPanel(Language.T("Manual Operation Execution"))
                {Parent = TabPageOperation, Dock = DockStyle.Fill};
            PnlManualTrade.Resize += PnlManualTradeResize;

            PnlHolder = new Panel { Parent = PnlManualTrade, BackColor = Color.Transparent, Size = new Size((int)(750 * Data.HDpiScale), 350) };

            LblSymbol = new Label
                {
                    Parent = PnlHolder,
                    Text = "Symbol",
                    BackColor = Color.Transparent,
                    ForeColor = LayoutColors.ColorControlText,
                    Font = new Font(Font.FontFamily, 18, FontStyle.Bold)
                };
            LblSymbol.Height = LblSymbol.Font.Height;
            LblSymbol.Width = (int) (180*Data.HDpiScale);
            LblSymbol.TextAlign = ContentAlignment.MiddleRight;
            LblSymbol.Location = new Point(5, 35);

            LblBidAsk = new Label
                {
                    Parent = PnlHolder,
                    Text = "Bid / Ask",
                    BackColor = Color.Transparent,
                    ForeColor = LayoutColors.ColorControlText,
                    Font = new Font(Font.FontFamily, 18, FontStyle.Bold),
                    Width = 295,
                    TextAlign = ContentAlignment.MiddleCenter,
                    Location = new Point(LblSymbol.Right + Space, 35)
                };
            LblBidAsk.Height = LblBidAsk.Font.Height;

            LblLots = new Label
                {
                    Parent = PnlHolder,
                    Text = Language.T("Lots"),
                    Font = new Font(Font.FontFamily, 11),
                    BackColor = Color.Transparent,
                    ForeColor = LayoutColors.ColorControlText,
                    Width = (int) (90*Data.HDpiScale)
                };
            LblLots.Height = LblLots.Font.Height;
            LblLots.TextAlign = ContentAlignment.MiddleRight;
            LblLots.Location = new Point(5, 81);
            var lblWidth = (int) (100*Data.HDpiScale);
            LblStopLoss = new Label
                {
                    Parent = PnlHolder,
                    Text = Language.T("Stop Loss"),
                    Font = new Font(Font.FontFamily, 11),
                    BackColor = Color.Transparent,
                    ForeColor = LayoutColors.ColorControlText,
                    Location = new Point(5, 121),
                    Width = lblWidth,
                    TextAlign = ContentAlignment.MiddleRight
                };

            LblTakeProfit = new Label
                {
                    Parent = PnlHolder,
                    Font = new Font(Font.FontFamily, 11),
                    Text = Language.T("Take Profit"),
                    BackColor = Color.Transparent,
                    ForeColor = LayoutColors.ColorControlText,
                    Location = new Point(5, 151),
                    Width = lblWidth,
                    TextAlign = ContentAlignment.MiddleRight
                };

            LblBreakEven = new Label
                {
                    Parent = PnlHolder,
                    Font = new Font(Font.FontFamily, 11),
                    Text = Language.T("Break Even"),
                    BackColor = Color.Transparent,
                    ForeColor = LayoutColors.ColorControlText,
                    Location = new Point(5, 191),
                    Width = lblWidth,
                    TextAlign = ContentAlignment.MiddleRight
                };

            LblTrailingStop = new Label
                {
                    Parent = PnlHolder,
                    Font = new Font(Font.FontFamily, 11),
                    Text = Language.T("Trailing Stop"),
                    BackColor = Color.Transparent,
                    ForeColor = LayoutColors.ColorControlText,
                    Location = new Point(5, 221),
                    Width = lblWidth,
                    TextAlign = ContentAlignment.MiddleRight
                };

            int nudLeft = LblTrailingStop.Right + Space;

            NudLots = new NumericUpDown
                {
                    Parent = PnlHolder,
                    Font = new Font(Font.FontFamily, 11),
                    TextAlign = HorizontalAlignment.Center,
                    Width = 80,
                    Location = new Point(nudLeft, 81)
                };
            NudLots.BeginInit();
            NudLots.Minimum = 0.1M;
            NudLots.Maximum = 100;
            NudLots.Increment = 0.1M;
            NudLots.Value = 1;
            NudLots.DecimalPlaces = 1;
            NudLots.EndInit();

            NudStopLoss = new NumericUpDown
                {
                    Parent = PnlHolder,
                    Font = new Font(Font.FontFamily, 11),
                    TextAlign = HorizontalAlignment.Center,
                    Width = 80,
                    Location = new Point(nudLeft, 121)
                };
            NudStopLoss.BeginInit();
            NudStopLoss.Minimum = 0;
            NudStopLoss.Maximum = 5000;
            NudStopLoss.Increment = 1;
            NudStopLoss.Value = 0;
            NudStopLoss.DecimalPlaces = 0;
            NudStopLoss.EndInit();
            NudStopLoss.ValueChanged += ParameterValueChanged;

            ColorParameter = NudStopLoss.ForeColor;

            NudTakeProfit = new NumericUpDown
                {
                    Parent = PnlHolder,
                    Font = new Font(Font.FontFamily, 11),
                    TextAlign = HorizontalAlignment.Center,
                    Width = 80,
                    Location = new Point(nudLeft, 151)
                };
            NudTakeProfit.BeginInit();
            NudTakeProfit.Minimum = 0;
            NudTakeProfit.Maximum = 5000;
            NudTakeProfit.Increment = 1;
            NudTakeProfit.Value = 0;
            NudTakeProfit.DecimalPlaces = 0;
            NudTakeProfit.EndInit();
            NudTakeProfit.ValueChanged += ParameterValueChanged;

            NudBreakEven = new NumericUpDown
                {
                    Parent = PnlHolder,
                    Font = new Font(Font.FontFamily, 11),
                    TextAlign = HorizontalAlignment.Center,
                    Width = 80,
                    Location = new Point(nudLeft, 191)
                };
            NudBreakEven.BeginInit();
            NudBreakEven.Minimum = 0;
            NudBreakEven.Maximum = 5000;
            NudBreakEven.Increment = 1;
            NudBreakEven.Value = 0;
            NudBreakEven.DecimalPlaces = 0;
            NudBreakEven.EndInit();
            NudBreakEven.ValueChanged += ParameterValueChanged;

            NudTrailingStop = new NumericUpDown
                {
                    Parent = PnlHolder,
                    Font = new Font(Font.FontFamily, 11),
                    TextAlign = HorizontalAlignment.Center,
                    Width = 80,
                    Location = new Point(nudLeft, 221)
                };
            NudTrailingStop.BeginInit();
            NudTrailingStop.Minimum = 0;
            NudTrailingStop.Maximum = 5000;
            NudTrailingStop.Increment = 1;
            NudTrailingStop.Value = 0;
            NudTrailingStop.DecimalPlaces = 0;
            NudTrailingStop.EndInit();
            NudTrailingStop.ValueChanged += ParameterValueChanged;

            int btnLeft = NudTrailingStop.Right + 2 * Space;

            BtnSell = new Button
                {
                    Name = "btnSell",
                    Parent = PnlHolder,
                    Image = Resources.btn_operation_sell,
                    ImageAlign = ContentAlignment.MiddleLeft,
                    Text = Language.T("Sell"),
                    Width = 145,
                    Height = 40,
                    Font = new Font(Font.FontFamily, 16),
                    ForeColor = Color.Crimson,
                    Location = new Point(btnLeft, 80),
                    UseVisualStyleBackColor = true
                };
            BtnSell.Click += BtnOperationClick;

            BtnBuy = new Button
                {
                    Name = "btnBuy",
                    Parent = PnlHolder,
                    Image = Resources.btn_operation_buy,
                    ImageAlign = ContentAlignment.MiddleLeft,
                    Text = Language.T("Buy"),
                    Width = 145,
                    Height = 40,
                    Font = new Font(Font.FontFamily, 16),
                    ForeColor = Color.Green,
                    Location = new Point(BtnSell.Right + Space, 80),
                    UseVisualStyleBackColor = true
                };
            BtnBuy.Click += BtnOperationClick;

            BtnClose = new Button
                {
                    Name = "btnClose",
                    Parent = PnlHolder,
                    Image = Resources.btn_operation_close,
                    ImageAlign = ContentAlignment.MiddleLeft,
                    Text = Language.T("Close"),
                    Width = 295,
                    Height = 40,
                    Font = new Font(Font.FontFamily, 16, FontStyle.Bold),
                    ForeColor = Color.DarkOrange,
                    Location = new Point(btnLeft, 126),
                    UseVisualStyleBackColor = true
                };
            BtnClose.Click += BtnOperationClick;

            BtnModify = new Button
                {
                    Name = "btnModify",
                    Parent = PnlHolder,
                    Image = Resources.recalculate,
                    ImageAlign = ContentAlignment.MiddleLeft,
                    Text = Language.T("Modify Stop Loss and Take Profit"),
                    ForeColor = Color.Navy,
                    Width = 295,
                    Location = new Point(btnLeft, 172),
                    UseVisualStyleBackColor = true
                };
            BtnModify.Click += BtnOperationClick;

            int chartLeft = BtnModify.Right + 2 * Space;
            TickChart = new TickChart(Language.T("Tick Chart"))
                {
                    Parent = PnlHolder,
                    Size = new Size(250, 200),
                    Location = new Point(chartLeft, 81)
                };
        }
        /// <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 (string 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 (string 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("points");

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

            // 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("points"), 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("points"), 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 points 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;
        }
        /// <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("points") + "]";

            // 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.SwapUnit == ChargeUnit.Money
                                    ? Data.InstrProperties.PriceIn
                                    : Language.T(Data.InstrProperties.SwapUnit.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.SwapUnit == ChargeUnit.Money
                                     ? Data.InstrProperties.PriceIn
                                     : Language.T(Data.InstrProperties.SwapUnit.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.CommissionUnit == ChargeUnit.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("points") + "]";

            // 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 points 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;
        }
Пример #25
0
        /// <summary>
        /// Constructor
        /// </summary>
        public TradeSettings()
        {
            PnlSettings = new FancyPanel();

            LblCloseAdvance = new Label();
            LblSlippageEntry = new Label();

            CbxLongLogicPrice = new ComboBox();
            ChbAutoSlippage = new CheckBox();
            NUDCloseAdvance = new NumericUpDown();
            NUDSlippageEntry = new NumericUpDown();
            NUDSlippageExit = new NumericUpDown();
            LblSlippageExit = new Label();
            LblLongLogicPrice = new Label();
            LblMinChartBars = new Label();
            NUDMinChartBars = new NumericUpDown();

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

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

            // pnlAveraging
            PnlSettings.Parent = this;

            // ComboBox Long Logic Price
            CbxLongLogicPrice.Parent = PnlSettings;
            CbxLongLogicPrice.DropDownStyle = ComboBoxStyle.DropDownList;
            CbxLongLogicPrice.Items.AddRange(new object[] {"Bid", "Ask", "Chart"});
            CbxLongLogicPrice.Text = Configs.LongTradeLogicPrice;

            // Label close advance
            LblCloseAdvance.Parent = PnlSettings;
            LblCloseAdvance.ForeColor = LayoutColors.ColorControlText;
            LblCloseAdvance.BackColor = Color.Transparent;
            LblCloseAdvance.AutoSize = true;
            LblCloseAdvance.Text = Language.T("'Bar Closing' time advance in seconds");

            // Check Box Auto Slippage
            ChbAutoSlippage.Parent = PnlSettings;
            ChbAutoSlippage.ForeColor = LayoutColors.ColorControlText;
            ChbAutoSlippage.BackColor = Color.Transparent;
            ChbAutoSlippage.AutoSize = true;
            ChbAutoSlippage.Checked = Configs.AutoSlippage;
            ChbAutoSlippage.Text = Language.T("Auto slippage depending on the spread.");
            ChbAutoSlippage.CheckedChanged += ChbAutoSlippageCheckedChanged;

            // Label Entry slippage
            LblSlippageEntry.Parent = PnlSettings;
            LblSlippageEntry.ForeColor = LayoutColors.ColorControlText;
            LblSlippageEntry.BackColor = Color.Transparent;
            LblSlippageEntry.AutoSize = true;
            LblSlippageEntry.Text = Language.T("Slippage for entry orders");

            // Label Entry slippage
            LblSlippageExit.Parent = PnlSettings;
            LblSlippageExit.ForeColor = LayoutColors.ColorControlText;
            LblSlippageExit.BackColor = Color.Transparent;
            LblSlippageExit.AutoSize = true;
            LblSlippageExit.Text = Language.T("Slippage for exit orders");

            // NumericUpDown Entry Lots
            NUDCloseAdvance.Parent = PnlSettings;
            NUDCloseAdvance.BeginInit();
            NUDCloseAdvance.Minimum = 1;
            NUDCloseAdvance.Maximum = 15;
            NUDCloseAdvance.Increment = 1;
            NUDCloseAdvance.Value = Configs.BarCloseAdvance;
            NUDCloseAdvance.DecimalPlaces = 0;
            NUDCloseAdvance.TextAlign = HorizontalAlignment.Center;
            NUDCloseAdvance.EndInit();

            // Label lblLongLogicPrice
            LblLongLogicPrice.Parent = PnlSettings;
            LblLongLogicPrice.ForeColor = LayoutColors.ColorControlText;
            LblLongLogicPrice.BackColor = Color.Transparent;
            LblLongLogicPrice.AutoSize = true;
            LblLongLogicPrice.Text = Language.T("Long logic rules base price");

            // NUD Entry slippage
            NUDSlippageEntry.Parent = PnlSettings;
            NUDSlippageEntry.BeginInit();
            NUDSlippageEntry.Minimum = 0;
            NUDSlippageEntry.Maximum = 1000;
            NUDSlippageEntry.Increment = 1;
            NUDSlippageEntry.Value = Configs.SlippageEntry;
            NUDSlippageEntry.DecimalPlaces = 0;
            NUDSlippageEntry.TextAlign = HorizontalAlignment.Center;
            NUDSlippageEntry.Enabled = !Configs.AutoSlippage;
            NUDSlippageEntry.EndInit();

            // NUD Exit slippage
            NUDSlippageExit.Parent = PnlSettings;
            NUDSlippageExit.BeginInit();
            NUDSlippageExit.Minimum = 0;
            NUDSlippageExit.Maximum = 1000;
            NUDSlippageExit.Increment = 1;
            NUDSlippageExit.Value = Configs.SlippageExit;
            NUDSlippageExit.DecimalPlaces = 0;
            NUDSlippageExit.TextAlign = HorizontalAlignment.Center;
            NUDSlippageExit.Enabled = !Configs.AutoSlippage;
            NUDSlippageExit.EndInit();

            // Label lblMinChartBars
            LblMinChartBars.Parent = PnlSettings;
            LblMinChartBars.ForeColor = LayoutColors.ColorControlText;
            LblMinChartBars.BackColor = Color.Transparent;
            LblMinChartBars.AutoSize = true;
            LblMinChartBars.Text = Language.T("Minimum number of bars in the chart");

            // NUD Exit slippage
            NUDMinChartBars.Parent = PnlSettings;
            NUDMinChartBars.BeginInit();
            NUDMinChartBars.Minimum = 300;
            NUDMinChartBars.Maximum = 10000;
            NUDMinChartBars.Increment = 1;
            NUDMinChartBars.Value = Configs.MinChartBars;
            NUDMinChartBars.DecimalPlaces = 0;
            NUDMinChartBars.TextAlign = HorizontalAlignment.Center;
            NUDMinChartBars.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.Click += BtnAcceptClick;
            BtnAccept.DialogResult = DialogResult.OK;
            BtnAccept.UseVisualStyleBackColor = true;
        }
        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.IsProgramReleaseCandidate)
                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 - 2013 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(400, 330);
        }
        /// <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;
        }
        /// <summary>
        ///     Sets the controls in tabPageStatus
        /// </summary>
        private void InitializePageStatus()
        {
            // tabPageStatus
            TabPageStatus.Name = "tabPageStatus";
            TabPageStatus.Text = Language.T("Status");
            TabPageStatus.ImageIndex = 0;
            TabPageStatus.Resize += TabPageStatusResize;

            // Panel Warning
            PnlWarning = new FancyPanel
                {
                    Height = 0,
                    Enabled = false,
                    Visible = false
                };

            // Panel Connection
            PnlConnection = new FancyPanel(Language.T("Connection Status")) {Parent = TabPageStatus};

            // lblConnection
            LblConnection = new Label
                {
                    Name = "lblConnection",
                    Parent = PnlConnection,
                    Text = Language.T("Not Connected. You have to connect to a MetaTrader terminal."),
                    TextAlign = ContentAlignment.MiddleLeft
                };

            // Panel Data Info
            PnlDataInfoBase = new FancyPanel(Language.T("Data Info")) {Parent = TabPageStatus};
            PnlDataInfoBase.Padding = new Padding(2, (int) PnlDataInfoBase.CaptionHeight, 2, 2);

            TbxDataInfo = new TextBox
                {
                    Parent = PnlDataInfoBase,
                    BorderStyle = BorderStyle.None,
                    Dock = DockStyle.Fill,
                    TabStop = false,
                    Multiline = true,
                    AcceptsReturn = true,
                    AcceptsTab = true,
                    WordWrap = false,
                    ScrollBars = ScrollBars.Vertical,
                    Font = new Font("Courier New", 8.25F, FontStyle.Regular, GraphicsUnit.Point, ((204)))
                };

            PnlDataInfoButtons = new Panel {Parent = PnlDataInfoBase, Dock = DockStyle.Top};
            PnlDataInfoButtons.Paint += PnlDataInfoButtons_Paint;

            BtnShowMarketInfo = new Button {Parent = PnlDataInfoButtons, Text = Language.T("Market Info")};
            BtnShowMarketInfo.Click += BtnShowMarketInfoClick;
            BtnShowMarketInfo.UseVisualStyleBackColor = true;

            BtnShowAccountInfo = new Button {Parent = PnlDataInfoButtons, Text = Language.T("Account Info")};
            BtnShowAccountInfo.Click += BtnShowAccountInfoClick;
            BtnShowAccountInfo.UseVisualStyleBackColor = true;

            BtnShowBars = new Button {Parent = PnlDataInfoButtons, Text = Language.T("Loaded Bars")};
            BtnShowBars.Click += BtnShowBarsClick;
            BtnShowBars.UseVisualStyleBackColor = true;

            PnlMarketInfo = new InfoPanel(Language.T("Market Information")) {Parent = TabPageStatus};
            PnlUsefulLinks = new LinkPanel(Language.T("Useful Links")) {Parent = TabPageStatus};
            PnlForexBrokers = new LinkPanel(Language.T("Forex Brokers")) {Parent = TabPageStatus};

            SetStatusColors();
        }
Пример #29
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;
        }
Пример #30
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;
        }
Пример #31
0
        /// <summary>
        /// Constructor
        /// </summary>
        public TradeSettings()
        {
            PnlSettings = new FancyPanel();

            LblCloseAdvance  = new Label();
            LblSlippageEntry = new Label();

            CbxLongLogicPrice = new ComboBox();
            ChbAutoSlippage   = new CheckBox();
            NUDCloseAdvance   = new NumericUpDown();
            NUDSlippageEntry  = new NumericUpDown();
            NUDSlippageExit   = new NumericUpDown();
            LblSlippageExit   = new Label();
            LblLongLogicPrice = new Label();
            LblMinChartBars   = new Label();
            NUDMinChartBars   = new NumericUpDown();

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

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

            // pnlAveraging
            PnlSettings.Parent = this;

            // ComboBox Long Logic Price
            CbxLongLogicPrice.Parent        = PnlSettings;
            CbxLongLogicPrice.DropDownStyle = ComboBoxStyle.DropDownList;
            CbxLongLogicPrice.Items.AddRange(new object[] { "Bid", "Ask", "Chart" });
            CbxLongLogicPrice.Text = Configs.LongTradeLogicPrice;

            // Label close advance
            LblCloseAdvance.Parent    = PnlSettings;
            LblCloseAdvance.ForeColor = LayoutColors.ColorControlText;
            LblCloseAdvance.BackColor = Color.Transparent;
            LblCloseAdvance.AutoSize  = true;
            LblCloseAdvance.Text      = Language.T("'Bar Closing' time advance in seconds");

            // Check Box Auto Slippage
            ChbAutoSlippage.Parent          = PnlSettings;
            ChbAutoSlippage.ForeColor       = LayoutColors.ColorControlText;
            ChbAutoSlippage.BackColor       = Color.Transparent;
            ChbAutoSlippage.AutoSize        = true;
            ChbAutoSlippage.Checked         = Configs.AutoSlippage;
            ChbAutoSlippage.Text            = Language.T("Auto slippage depending on the spread.");
            ChbAutoSlippage.CheckedChanged += ChbAutoSlippageCheckedChanged;

            // Label Entry slippage
            LblSlippageEntry.Parent    = PnlSettings;
            LblSlippageEntry.ForeColor = LayoutColors.ColorControlText;
            LblSlippageEntry.BackColor = Color.Transparent;
            LblSlippageEntry.AutoSize  = true;
            LblSlippageEntry.Text      = Language.T("Slippage for entry orders");

            // Label Entry slippage
            LblSlippageExit.Parent    = PnlSettings;
            LblSlippageExit.ForeColor = LayoutColors.ColorControlText;
            LblSlippageExit.BackColor = Color.Transparent;
            LblSlippageExit.AutoSize  = true;
            LblSlippageExit.Text      = Language.T("Slippage for exit orders");

            // NumericUpDown Entry Lots
            NUDCloseAdvance.Parent = PnlSettings;
            NUDCloseAdvance.BeginInit();
            NUDCloseAdvance.Minimum       = 1;
            NUDCloseAdvance.Maximum       = 15;
            NUDCloseAdvance.Increment     = 1;
            NUDCloseAdvance.Value         = Configs.BarCloseAdvance;
            NUDCloseAdvance.DecimalPlaces = 0;
            NUDCloseAdvance.TextAlign     = HorizontalAlignment.Center;
            NUDCloseAdvance.EndInit();

            // Label lblLongLogicPrice
            LblLongLogicPrice.Parent    = PnlSettings;
            LblLongLogicPrice.ForeColor = LayoutColors.ColorControlText;
            LblLongLogicPrice.BackColor = Color.Transparent;
            LblLongLogicPrice.AutoSize  = true;
            LblLongLogicPrice.Text      = Language.T("Long logic rules base price");

            // NUD Entry slippage
            NUDSlippageEntry.Parent = PnlSettings;
            NUDSlippageEntry.BeginInit();
            NUDSlippageEntry.Minimum       = 0;
            NUDSlippageEntry.Maximum       = 1000;
            NUDSlippageEntry.Increment     = 1;
            NUDSlippageEntry.Value         = Configs.SlippageEntry;
            NUDSlippageEntry.DecimalPlaces = 0;
            NUDSlippageEntry.TextAlign     = HorizontalAlignment.Center;
            NUDSlippageEntry.Enabled       = !Configs.AutoSlippage;
            NUDSlippageEntry.EndInit();

            // NUD Exit slippage
            NUDSlippageExit.Parent = PnlSettings;
            NUDSlippageExit.BeginInit();
            NUDSlippageExit.Minimum       = 0;
            NUDSlippageExit.Maximum       = 1000;
            NUDSlippageExit.Increment     = 1;
            NUDSlippageExit.Value         = Configs.SlippageExit;
            NUDSlippageExit.DecimalPlaces = 0;
            NUDSlippageExit.TextAlign     = HorizontalAlignment.Center;
            NUDSlippageExit.Enabled       = !Configs.AutoSlippage;
            NUDSlippageExit.EndInit();

            // Label lblMinChartBars
            LblMinChartBars.Parent    = PnlSettings;
            LblMinChartBars.ForeColor = LayoutColors.ColorControlText;
            LblMinChartBars.BackColor = Color.Transparent;
            LblMinChartBars.AutoSize  = true;
            LblMinChartBars.Text      = Language.T("Minimum number of bars in the chart");

            // NUD Exit slippage
            NUDMinChartBars.Parent = PnlSettings;
            NUDMinChartBars.BeginInit();
            NUDMinChartBars.Minimum       = 300;
            NUDMinChartBars.Maximum       = 10000;
            NUDMinChartBars.Increment     = 1;
            NUDMinChartBars.Value         = Configs.MinChartBars;
            NUDMinChartBars.DecimalPlaces = 0;
            NUDMinChartBars.TextAlign     = HorizontalAlignment.Center;
            NUDMinChartBars.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.Click                  += BtnAcceptClick;
            BtnAccept.DialogResult            = DialogResult.OK;
            BtnAccept.UseVisualStyleBackColor = true;
        }
Пример #32
0
        public AboutScreen()
        {
            PnlBase           = new FancyPanel();
            LblProgramName    = new Label();
            LblProgramVersion = new Label();
            LblLibraryVersion = new Label();
            LblExpertVersion  = new Label();
            LblCopyright      = new Label();
            LblWebsite        = new Label();
            LblSupportForum   = new Label();
            LblContacts       = new Label();
            PictureLogo       = new PictureBox();
            LinkWebsite       = new LinkLabel();
            LinkForum         = new LinkLabel();
            LinkEmail         = new LinkLabel();
            LinkCredits       = new LinkLabel();
            BtnOk             = new Button();

            // Panel Base
            PnlBase.Parent = this;

            PictureLogo.TabStop   = false;
            PictureLogo.BackColor = Color.Transparent;
            PictureLogo.Image     = Resources.Logo;

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

            LblProgramVersion.AutoSize  = true;
            LblProgramVersion.Font      = new Font("Microsoft Sans Serif", 12F);
            LblProgramVersion.ForeColor = LayoutColors.ColorControlText;
            LblProgramVersion.BackColor = Color.Transparent;
            LblProgramVersion.Text      = Language.T("Program version") + ": " + Data.ProgramVersion +
                                          (Data.IsProgramBeta ? " " + Language.T("Beta") : "");

            LblLibraryVersion.AutoSize  = true;
            LblLibraryVersion.Font      = new Font("Microsoft Sans Serif", 10F);
            LblLibraryVersion.ForeColor = LayoutColors.ColorControlText;
            LblLibraryVersion.BackColor = Color.Transparent;
            LblLibraryVersion.Text      = Language.T("Library version") + ": " + Data.LibraryVersion;

            // label4
            LblExpertVersion.AutoSize  = true;
            LblExpertVersion.Font      = new Font("Microsoft Sans Serif", 10F);
            LblExpertVersion.ForeColor = LayoutColors.ColorControlText;
            LblExpertVersion.BackColor = Color.Transparent;
            LblExpertVersion.Text      = Language.T("Expert version") + ": " + Data.ExpertVersion;

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

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

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

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

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

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

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

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

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

            // AboutScreen
            PnlBase.Controls.Add(LblProgramName);
            PnlBase.Controls.Add(LblProgramVersion);
            PnlBase.Controls.Add(LblLibraryVersion);
            PnlBase.Controls.Add(LblExpertVersion);
            PnlBase.Controls.Add(LblCopyright);
            PnlBase.Controls.Add(LblWebsite);
            PnlBase.Controls.Add(LblSupportForum);
            PnlBase.Controls.Add(LblContacts);
            PnlBase.Controls.Add(LinkWebsite);
            PnlBase.Controls.Add(LinkForum);
            PnlBase.Controls.Add(LinkEmail);
            PnlBase.Controls.Add(LinkCredits);
            PnlBase.Controls.Add(PictureLogo);

            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, 350);
        }
Пример #33
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();
        }
        /// <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;
        }
Пример #35
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;
        }
        /// <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();

            Color 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;
        }
        /// <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;
        }
Пример #38
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.IsProgramReleaseCandidate)
            {
                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 - 2014 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(400, 330);
        }
        /// <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;
        }
        /// <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;
        }
        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();
            FancyNudMaxOpenLots = new FancyNud();
            RbConstantUnits = new RadioButton();
            RbVariableUnits = new RadioButton();
            FancyNudEntryLots = new FancyNud();
            FancyNudAddingLots = new FancyNud();
            FancyNudReducingLots = new FancyNud();
            LblMaxOpenLots = new Label();
            LblEntryLots = new Label();
            LblAddingLots = new Label();
            LblReducingLots = new Label();
            CbxUseMartingale = new CheckBox();
            FancyNudMartingaleMultiplier = new FancyNud();

            ChbPermaSL = new CheckBox();
            CbxPermaSLType = new ComboBox();
            FancyNudPermaSL = new FancyNud();
            ChbPermaTP = new CheckBox();
            CbxPermaTPType = new ComboBox();
            FancyNudPermaTP = new FancyNud();
            ChbBreakEven = new CheckBox();
            FancyNudBreakEven = new FancyNud();

            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 (string 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 (string 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
            FancyNudMaxOpenLots.Parent = PnlAmounts;
            FancyNudMaxOpenLots.Name = "nudMaxOpenLots";
            FancyNudMaxOpenLots.BeginInit();
            FancyNudMaxOpenLots.Minimum = 0.01M;
            FancyNudMaxOpenLots.Maximum = 100;
            FancyNudMaxOpenLots.Increment = 0.01M;
            FancyNudMaxOpenLots.Value = 20;
            FancyNudMaxOpenLots.DecimalPlaces = 2;
            FancyNudMaxOpenLots.TextAlign = HorizontalAlignment.Center;
            FancyNudMaxOpenLots.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
            FancyNudEntryLots.Parent = PnlAmounts;
            FancyNudEntryLots.Name = "nudEntryLots";
            FancyNudEntryLots.BeginInit();
            FancyNudEntryLots.Minimum = 0.01M;
            FancyNudEntryLots.Maximum = 100;
            FancyNudEntryLots.Increment = 0.01M;
            FancyNudEntryLots.Value = 1;
            FancyNudEntryLots.DecimalPlaces = 2;
            FancyNudEntryLots.TextAlign = HorizontalAlignment.Center;
            FancyNudEntryLots.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
            FancyNudAddingLots.Parent = PnlAmounts;
            FancyNudAddingLots.Name = "nudAddingLots";
            FancyNudAddingLots.BeginInit();
            FancyNudAddingLots.Minimum = 0.01M;
            FancyNudAddingLots.Maximum = 100;
            FancyNudAddingLots.Increment = 0.01M;
            FancyNudAddingLots.Value = 1;
            FancyNudAddingLots.DecimalPlaces = 2;
            FancyNudAddingLots.TextAlign = HorizontalAlignment.Center;
            FancyNudAddingLots.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
            FancyNudReducingLots.Parent = PnlAmounts;
            FancyNudReducingLots.Name = "nudReducingLots";
            FancyNudReducingLots.BeginInit();
            FancyNudReducingLots.Minimum = 0.01M;
            FancyNudReducingLots.Maximum = 100;
            FancyNudReducingLots.Increment = 0.01m;
            FancyNudReducingLots.DecimalPlaces = 2;
            FancyNudReducingLots.Value = 1;
            FancyNudReducingLots.TextAlign = HorizontalAlignment.Center;
            FancyNudReducingLots.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
            FancyNudMartingaleMultiplier.Parent = PnlAmounts;
            FancyNudMartingaleMultiplier.Name = "nudMartingaleMultiplier";
            FancyNudMartingaleMultiplier.BeginInit();
            FancyNudMartingaleMultiplier.Minimum = 0.01M;
            FancyNudMartingaleMultiplier.Maximum = 10;
            FancyNudMartingaleMultiplier.Increment = 0.01m;
            FancyNudMartingaleMultiplier.DecimalPlaces = 2;
            FancyNudMartingaleMultiplier.Value = 2;
            FancyNudMartingaleMultiplier.TextAlign = HorizontalAlignment.Center;
            FancyNudMartingaleMultiplier.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
            FancyNudPermaSL.Name = "nudPermaSL";
            FancyNudPermaSL.Parent = PnlProtection;
            FancyNudPermaSL.BeginInit();
            FancyNudPermaSL.Minimum = 5;
            FancyNudPermaSL.Maximum = 5000;
            FancyNudPermaSL.Increment = 1;
            FancyNudPermaSL.Value = Data.InstrProperties.IsFiveDigits ? 1000 : 100;
            FancyNudPermaSL.TextAlign = HorizontalAlignment.Center;
            FancyNudPermaSL.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
            FancyNudPermaTP.Parent = PnlProtection;
            FancyNudPermaTP.Name = "nudPermaTP";
            FancyNudPermaTP.BeginInit();
            FancyNudPermaTP.Minimum = 5;
            FancyNudPermaTP.Maximum = 5000;
            FancyNudPermaTP.Increment = 1;
            FancyNudPermaTP.Value = Data.InstrProperties.IsFiveDigits ? 1000 : 100;
            FancyNudPermaTP.TextAlign = HorizontalAlignment.Center;
            FancyNudPermaTP.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
            FancyNudBreakEven.Parent = PnlProtection;
            FancyNudBreakEven.Name = "nudBreakEven";
            FancyNudBreakEven.BeginInit();
            FancyNudBreakEven.Minimum = 5;
            FancyNudBreakEven.Maximum = 5000;
            FancyNudBreakEven.Increment = 1;
            FancyNudBreakEven.Value = Data.InstrProperties.IsFiveDigits ? 1000 : 100;
            FancyNudBreakEven.TextAlign = HorizontalAlignment.Center;
            FancyNudBreakEven.EndInit();

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

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

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

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

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

            CbxSameDirAction             = new ComboBox();
            CbxOppDirAction              = new ComboBox();
            FancyNudMaxOpenLots          = new FancyNud();
            RbConstantUnits              = new RadioButton();
            RbVariableUnits              = new RadioButton();
            FancyNudEntryLots            = new FancyNud();
            FancyNudAddingLots           = new FancyNud();
            FancyNudReducingLots         = new FancyNud();
            LblMaxOpenLots               = new Label();
            LblEntryLots                 = new Label();
            LblAddingLots                = new Label();
            LblReducingLots              = new Label();
            CbxUseMartingale             = new CheckBox();
            FancyNudMartingaleMultiplier = new FancyNud();

            ChbPermaSL        = new CheckBox();
            CbxPermaSLType    = new ComboBox();
            FancyNudPermaSL   = new FancyNud();
            ChbPermaTP        = new CheckBox();
            CbxPermaTPType    = new ComboBox();
            FancyNudPermaTP   = new FancyNud();
            ChbBreakEven      = new CheckBox();
            FancyNudBreakEven = new FancyNud();

            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 (string 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 (string 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
            FancyNudMaxOpenLots.Parent = PnlAmounts;
            FancyNudMaxOpenLots.Name   = "nudMaxOpenLots";
            FancyNudMaxOpenLots.BeginInit();
            FancyNudMaxOpenLots.Minimum       = 0.01M;
            FancyNudMaxOpenLots.Maximum       = 100;
            FancyNudMaxOpenLots.Increment     = 0.01M;
            FancyNudMaxOpenLots.Value         = 20;
            FancyNudMaxOpenLots.DecimalPlaces = 2;
            FancyNudMaxOpenLots.TextAlign     = HorizontalAlignment.Center;
            FancyNudMaxOpenLots.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
            FancyNudEntryLots.Parent = PnlAmounts;
            FancyNudEntryLots.Name   = "nudEntryLots";
            FancyNudEntryLots.BeginInit();
            FancyNudEntryLots.Minimum       = 0.01M;
            FancyNudEntryLots.Maximum       = 100;
            FancyNudEntryLots.Increment     = 0.01M;
            FancyNudEntryLots.Value         = 1;
            FancyNudEntryLots.DecimalPlaces = 2;
            FancyNudEntryLots.TextAlign     = HorizontalAlignment.Center;
            FancyNudEntryLots.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
            FancyNudAddingLots.Parent = PnlAmounts;
            FancyNudAddingLots.Name   = "nudAddingLots";
            FancyNudAddingLots.BeginInit();
            FancyNudAddingLots.Minimum       = 0.01M;
            FancyNudAddingLots.Maximum       = 100;
            FancyNudAddingLots.Increment     = 0.01M;
            FancyNudAddingLots.Value         = 1;
            FancyNudAddingLots.DecimalPlaces = 2;
            FancyNudAddingLots.TextAlign     = HorizontalAlignment.Center;
            FancyNudAddingLots.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
            FancyNudReducingLots.Parent = PnlAmounts;
            FancyNudReducingLots.Name   = "nudReducingLots";
            FancyNudReducingLots.BeginInit();
            FancyNudReducingLots.Minimum       = 0.01M;
            FancyNudReducingLots.Maximum       = 100;
            FancyNudReducingLots.Increment     = 0.01m;
            FancyNudReducingLots.DecimalPlaces = 2;
            FancyNudReducingLots.Value         = 1;
            FancyNudReducingLots.TextAlign     = HorizontalAlignment.Center;
            FancyNudReducingLots.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
            FancyNudMartingaleMultiplier.Parent = PnlAmounts;
            FancyNudMartingaleMultiplier.Name   = "nudMartingaleMultiplier";
            FancyNudMartingaleMultiplier.BeginInit();
            FancyNudMartingaleMultiplier.Minimum       = 0.01M;
            FancyNudMartingaleMultiplier.Maximum       = 10;
            FancyNudMartingaleMultiplier.Increment     = 0.01m;
            FancyNudMartingaleMultiplier.DecimalPlaces = 2;
            FancyNudMartingaleMultiplier.Value         = 2;
            FancyNudMartingaleMultiplier.TextAlign     = HorizontalAlignment.Center;
            FancyNudMartingaleMultiplier.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
            FancyNudPermaSL.Name   = "nudPermaSL";
            FancyNudPermaSL.Parent = PnlProtection;
            FancyNudPermaSL.BeginInit();
            FancyNudPermaSL.Minimum   = 5;
            FancyNudPermaSL.Maximum   = 5000;
            FancyNudPermaSL.Increment = 1;
            FancyNudPermaSL.Value     = Data.InstrProperties.IsFiveDigits ? 1000 : 100;
            FancyNudPermaSL.TextAlign = HorizontalAlignment.Center;
            FancyNudPermaSL.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
            FancyNudPermaTP.Parent = PnlProtection;
            FancyNudPermaTP.Name   = "nudPermaTP";
            FancyNudPermaTP.BeginInit();
            FancyNudPermaTP.Minimum   = 5;
            FancyNudPermaTP.Maximum   = 5000;
            FancyNudPermaTP.Increment = 1;
            FancyNudPermaTP.Value     = Data.InstrProperties.IsFiveDigits ? 1000 : 100;
            FancyNudPermaTP.TextAlign = HorizontalAlignment.Center;
            FancyNudPermaTP.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
            FancyNudBreakEven.Parent = PnlProtection;
            FancyNudBreakEven.Name   = "nudBreakEven";
            FancyNudBreakEven.BeginInit();
            FancyNudBreakEven.Minimum   = 5;
            FancyNudBreakEven.Maximum   = 5000;
            FancyNudBreakEven.Increment = 1;
            FancyNudBreakEven.Value     = Data.InstrProperties.IsFiveDigits ? 1000 : 100;
            FancyNudBreakEven.TextAlign = HorizontalAlignment.Center;
            FancyNudBreakEven.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;
        }