/// <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> /// Public Constructor /// </summary> public FancyMessageBox(string text, string title) { PnlBase = new FancyPanel(); PnlControl = new Panel(); Browser = new WebBrowser(); BtnClose = new Button(); Text = title; Icon = Data.Icon; MaximizeBox = false; MinimizeBox = false; ShowInTaskbar = false; TopMost = true; AcceptButton = BtnClose; PnlBase.Parent = this; Browser.Parent = PnlBase; Browser.AllowNavigation = false; Browser.AllowWebBrowserDrop = false; Browser.DocumentText = GetText(text, title); Browser.Dock = DockStyle.Fill; Browser.TabStop = false; Browser.IsWebBrowserContextMenuEnabled = false; Browser.WebBrowserShortcutsEnabled = true; PnlControl.Parent = this; PnlControl.Dock = DockStyle.Bottom; PnlControl.BackColor = Color.Transparent; BtnClose.Parent = PnlControl; BtnClose.Text = Language.T("Close"); BtnClose.Name = "Close"; BtnClose.Click += BtnCloseClick; BtnClose.UseVisualStyleBackColor = true; }
/// <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(750, 350) }; 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(190, 35) }; 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 = 180; LblSymbol.TextAlign = ContentAlignment.MiddleRight; LblSymbol.Location = new Point(5, 35); LblLots = new Label { Parent = PnlHolder, Text = Language.T("Lots"), Font = new Font(Font.FontFamily, 11), BackColor = Color.Transparent, ForeColor = LayoutColors.ColorControlText, Width = 90 }; LblLots.Height = LblLots.Font.Height; LblLots.TextAlign = ContentAlignment.MiddleRight; LblLots.Location = new Point(5, 81); 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 = 90, 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 = 90, 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 = 90, 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 = 90, TextAlign = ContentAlignment.MiddleRight }; NUDLots = new NumericUpDown { Parent = PnlHolder, Font = new Font(Font.FontFamily, 11), TextAlign = HorizontalAlignment.Center, Width = 80, Location = new Point(100, 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(100, 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(100, 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(100, 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(100, 221) }; NUDTrailingStop.BeginInit(); NUDTrailingStop.Minimum = 0; NUDTrailingStop.Maximum = 5000; NUDTrailingStop.Increment = 1; NUDTrailingStop.Value = 0; NUDTrailingStop.DecimalPlaces = 0; NUDTrailingStop.EndInit(); NUDTrailingStop.ValueChanged += ParameterValueChanged; 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(190, 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(340, 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(190, 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(190, 172), UseVisualStyleBackColor = true }; BtnModify.Click += BtnOperationClick; TickChart = new TickChart(Language.T("Tick Chart")) { Parent = PnlHolder, Size = new Size(250, 200), Location = new Point(495, 81) }; }
/// <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 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; }
/// <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 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; }
/// <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()); } } }
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) 2012 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); }
/// <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> /// Constructor /// </summary> 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; }
/// <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> /// 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 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; }
/// <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> /// 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> /// 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(750, 350)}; 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(190, 35) }; 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 = 180; LblSymbol.TextAlign = ContentAlignment.MiddleRight; LblSymbol.Location = new Point(5, 35); LblLots = new Label { Parent = PnlHolder, Text = Language.T("Lots"), Font = new Font(Font.FontFamily, 11), BackColor = Color.Transparent, ForeColor = LayoutColors.ColorControlText, Width = 90 }; LblLots.Height = LblLots.Font.Height; LblLots.TextAlign = ContentAlignment.MiddleRight; LblLots.Location = new Point(5, 81); 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 = 90, 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 = 90, 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 = 90, 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 = 90, TextAlign = ContentAlignment.MiddleRight }; NUDLots = new NumericUpDown { Parent = PnlHolder, Font = new Font(Font.FontFamily, 11), TextAlign = HorizontalAlignment.Center, Width = 80, Location = new Point(100, 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(100, 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(100, 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(100, 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(100, 221) }; NUDTrailingStop.BeginInit(); NUDTrailingStop.Minimum = 0; NUDTrailingStop.Maximum = 5000; NUDTrailingStop.Increment = 1; NUDTrailingStop.Value = 0; NUDTrailingStop.DecimalPlaces = 0; NUDTrailingStop.EndInit(); NUDTrailingStop.ValueChanged += ParameterValueChanged; 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(190, 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(340, 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(190, 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(190, 172), UseVisualStyleBackColor = true }; BtnModify.Click += BtnOperationClick; TickChart = new TickChart(Language.T("Tick Chart")) {Parent = PnlHolder, Size = new Size(250, 200), Location = new Point(495, 81)}; }
/// <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 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> /// 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(); }