/// <summary> /// Initializes the controls in panel pnlOverview /// </summary> private void InitializeAccount() { var toolTip = new ToolTip(); string[] methods = Enum.GetNames(typeof(InterpolationMethod)); for (int i = 0; i < methods.Length; i++) { methods[i] = Language.T(methods[i]); } Graphics g = CreateGraphics(); int maxWidth = 0; foreach (string method in methods) { if ((int)g.MeasureString(method, Font).Width > maxWidth) { maxWidth = (int)g.MeasureString(method, Font).Width; } } g.Dispose(); // ComboBox Interpolation Methods ComboBoxInterpolationMethod = new ToolStripComboBox { Name = "ComboBoxInterpolationMethod", AutoSize = false, DropDownStyle = ComboBoxStyle.DropDownList, Width = maxWidth + (int)(18 * Data.HorizontalDLU), ToolTipText = Language.T("Bar interpolation method.") }; foreach (string method in methods) { ComboBoxInterpolationMethod.Items.Add(method); } ComboBoxInterpolationMethod.SelectedIndex = 0; ComboBoxInterpolationMethod.SelectedIndexChanged += SelectedIndexChanged; ToolStripAccount.Items.Add(ComboBoxInterpolationMethod); // Button Comparator var tsbtComparator = new ToolStripButton { Text = Language.T("Comparator"), Name = "Comparator" }; tsbtComparator.Click += BtnToolsOnClick; tsbtComparator.ToolTipText = Language.T("Compare the interpolating methods."); ToolStripAccount.Items.Add(tsbtComparator); // Button Scanner var tsbtScanner = new ToolStripButton { Text = Language.T("Scanner"), Name = "Scanner" }; tsbtScanner.Click += BtnToolsOnClick; tsbtScanner.ToolTipText = Language.T("Perform a deep intrabar scan.") + Environment.NewLine + Language.T("Quick scan") + " - F6."; ToolStripAccount.Items.Add(tsbtScanner); // Button Analyzer var tsbtAnalyzer = new ToolStripButton { Text = Language.T("Analyzer"), Name = "Analyzer" }; tsbtAnalyzer.Click += BtnToolsOnClick; ToolStripAccount.Items.Add(tsbtAnalyzer); // Info Panel Account Statistics InfoPanelAccountStatistics = new InfoPanel { Parent = PanelAccount, Dock = DockStyle.Fill }; new Splitter { Parent = PanelAccount, Dock = DockStyle.Bottom, BorderStyle = BorderStyle.None, Height = Gap }; // Small Balance Chart BalanceChart = new SmallBalanceChart { Parent = PanelAccount, Cursor = Cursors.Hand, Dock = DockStyle.Bottom, MinimumSize = new Size(100, 50), ShowDynamicInfo = true, IsContextButtonVisible = true }; BalanceChart.PopUpContextMenu.Items.AddRange(GetBalanceChartContextMenuItems()); BalanceChart.MouseMove += SmallBalanceChartMouseMove; BalanceChart.MouseLeave += SmallBalanceChartMouseLeave; BalanceChart.MouseUp += SmallBalanceChart_MouseUp; toolTip.SetToolTip(BalanceChart, Language.T("Click to view the full chart.") + Environment.NewLine + Language.T("Right click to detach chart.")); PanelAccount.Resize += PnlAccountResize; }
/// <summary> /// Constructor /// </summary> public Scanner() { InfoPanel = new Panel(); BalanceChart = new SmallBalanceChart(); ProgressBar = new ProgressBar(); LblProgress = new Label(); ChbAutoscan = new CheckBox(); ChbTickScan = new CheckBox(); BtnClose = new Button(); MaximizeBox = false; MinimizeBox = false; ShowInTaskbar = false; Icon = Data.Icon; FormBorderStyle = FormBorderStyle.FixedDialog; AcceptButton = BtnClose; Text = Language.T("Intrabar Scanner"); BackColor = LayoutColors.ColorFormBack; FormClosing += ScannerFormClosing; _colorText = LayoutColors.ColorControlText; _fontInfo = new Font(Font.FontFamily, 9); _infoRowHeight = Math.Max(_fontInfo.Height, 18); _isTickDataFile = CheckTickDataFile(); // pnlInfo InfoPanel.Parent = this; InfoPanel.BackColor = LayoutColors.ColorControlBack; InfoPanel.Paint += PnlInfoPaint; // Small Balance Chart BalanceChart.Parent = this; // ProgressBar ProgressBar.Parent = this; // Label Progress LblProgress.Parent = this; LblProgress.ForeColor = LayoutColors.ColorControlText; LblProgress.AutoSize = true; // Automatic Scan checkbox. ChbAutoscan.Parent = this; ChbAutoscan.ForeColor = _colorText; ChbAutoscan.BackColor = Color.Transparent; ChbAutoscan.Text = Language.T("Automatic Scan"); ChbAutoscan.Checked = Configs.Autoscan; ChbAutoscan.AutoSize = true; ChbAutoscan.CheckedChanged += ChbAutoscanCheckedChanged; // Tick Scan checkbox. ChbTickScan.Parent = this; ChbTickScan.ForeColor = _colorText; ChbTickScan.BackColor = Color.Transparent; ChbTickScan.Text = Language.T("Use Ticks"); ChbTickScan.Checked = Configs.UseTickData && _isTickDataFile; ChbTickScan.AutoSize = true; ChbTickScan.Visible = _isTickDataFile; ChbTickScan.CheckedChanged += ChbTickScanCheckedChanged; //Button Close BtnClose.Parent = this; BtnClose.Name = "Close"; BtnClose.Text = Language.T("Close"); BtnClose.DialogResult = DialogResult.OK; BtnClose.UseVisualStyleBackColor = true; // BackGroundWorker BgWorker = new BackgroundWorker { WorkerReportsProgress = true, WorkerSupportsCancellation = true }; BgWorker.DoWork += BgWorkerDoWork; BgWorker.ProgressChanged += BgWorkerProgressChanged; BgWorker.RunWorkerCompleted += BgWorkerRunWorkerCompleted; _isLoadingNow = false; if (!_isTickDataFile) { Configs.UseTickData = false; } }
public StrategyProperties() { PnlAveraging = new FancyPanel(Language.T("Handling of Additional Entry Signals"), LayoutColors.ColorSlotCaptionBackAveraging); PnlAmounts = new FancyPanel(Language.T("Trading Size"), LayoutColors.ColorSlotCaptionBackAveraging); PnlProtection = new FancyPanel(Language.T("Permanent Protection"), LayoutColors.ColorSlotCaptionBackAveraging); BalanceChart = new SmallBalanceChart(); LblPercent1 = new Label(); LblPercent2 = new Label(); LblPercent3 = new Label(); LblSameDirAction = new Label(); LblOppDirAction = new Label(); CbxSameDirAction = new ComboBox(); CbxOppDirAction = new ComboBox(); NUDMaxOpenLots = new NUD(); RbConstantUnits = new RadioButton(); RbVariableUnits = new RadioButton(); NUDEntryLots = new NUD(); NUDAddingLots = new NUD(); NUDReducingLots = new NUD(); LblMaxOpenLots = new Label(); LblEntryLots = new Label(); LblAddingLots = new Label(); LblReducingLots = new Label(); CbxUseMartingale = new CheckBox(); NUDMartingaleMultiplier = new NUD(); ChbPermaSL = new CheckBox(); CbxPermaSLType = new ComboBox(); NUDPermaSL = new NUD(); ChbPermaTP = new CheckBox(); CbxPermaTPType = new ComboBox(); NUDPermaTP = new NUD(); ChbBreakEven = new CheckBox(); NUDBreakEven = new NUD(); BtnAccept = new Button(); BtnDefault = new Button(); BtnCancel = new Button(); ColorText = LayoutColors.ColorControlText; MaximizeBox = false; MinimizeBox = false; ShowInTaskbar = false; Icon = Data.Icon; BackColor = LayoutColors.ColorFormBack; FormBorderStyle = FormBorderStyle.FixedDialog; AcceptButton = BtnAccept; Text = Language.T("Strategy Properties"); PnlAveraging.Parent = this; PnlAmounts.Parent = this; PnlProtection.Parent = this; BalanceChart.Parent = this; BalanceChart.SetChartData(); var toolTip = new ToolTip(); // Label Same dir action LblSameDirAction.Parent = PnlAveraging; LblSameDirAction.ForeColor = ColorText; LblSameDirAction.BackColor = Color.Transparent; LblSameDirAction.AutoSize = true; LblSameDirAction.Text = Language.T("Next same direction signal behavior"); // Label Opposite dir action LblOppDirAction.Parent = PnlAveraging; LblOppDirAction.ForeColor = ColorText; LblOppDirAction.BackColor = Color.Transparent; LblOppDirAction.AutoSize = true; LblOppDirAction.Text = Language.T("Next opposite direction signal behavior"); // ComboBox SameDirAction CbxSameDirAction.Parent = PnlAveraging; CbxSameDirAction.Name = "cbxSameDirAction"; CbxSameDirAction.DropDownStyle = ComboBoxStyle.DropDownList; var sameItems = new[] { Language.T("Nothing"), Language.T("Winner"), Language.T("Add") }; foreach (var item in sameItems) { CbxSameDirAction.Items.Add(item); } CbxSameDirAction.SelectedIndex = 0; toolTip.SetToolTip(CbxSameDirAction, Language.T("Nothing - cancels the additional orders.") + Environment.NewLine + Language.T("Winner - adds to a winning position.") + Environment.NewLine + Language.T("Add - adds to all positions.")); // ComboBox OppDirAction CbxOppDirAction.Parent = PnlAveraging; CbxOppDirAction.Name = "cbxOppDirAction"; CbxOppDirAction.DropDownStyle = ComboBoxStyle.DropDownList; var oppItems = new[] { Language.T("Nothing"), Language.T("Reduce"), Language.T("Close"), Language.T("Reverse") }; foreach (var item in oppItems) { CbxOppDirAction.Items.Add(item); } CbxOppDirAction.SelectedIndex = 0; toolTip.SetToolTip(CbxOppDirAction, Language.T("Nothing - cancels the additional orders.") + Environment.NewLine + Language.T("Reduce - reduces or closes a position.") + Environment.NewLine + Language.T("Close - closes the position.") + Environment.NewLine + Language.T("Reverse - reverses the position.")); // Label MaxOpen Lots LblMaxOpenLots.Parent = PnlAmounts; LblMaxOpenLots.ForeColor = ColorText; LblMaxOpenLots.BackColor = Color.Transparent; LblMaxOpenLots.AutoSize = true; LblMaxOpenLots.Text = Language.T("Maximum number of open lots"); // NumericUpDown MaxOpen Lots NUDMaxOpenLots.Parent = PnlAmounts; NUDMaxOpenLots.Name = "nudMaxOpenLots"; NUDMaxOpenLots.BeginInit(); NUDMaxOpenLots.Minimum = 0.01M; NUDMaxOpenLots.Maximum = 100; NUDMaxOpenLots.Increment = 0.01M; NUDMaxOpenLots.Value = 20; NUDMaxOpenLots.DecimalPlaces = 2; NUDMaxOpenLots.TextAlign = HorizontalAlignment.Center; NUDMaxOpenLots.EndInit(); // Radio Button Constant Units RbConstantUnits.Parent = PnlAmounts; RbConstantUnits.ForeColor = ColorText; RbConstantUnits.BackColor = Color.Transparent; RbConstantUnits.Checked = true; RbConstantUnits.AutoSize = true; RbConstantUnits.Name = "rbConstantUnits"; RbConstantUnits.Text = Language.T("Trade a constant number of lots"); // Radio Button Variable Units RbVariableUnits.Parent = PnlAmounts; RbVariableUnits.ForeColor = ColorText; RbVariableUnits.BackColor = Color.Transparent; RbVariableUnits.Checked = false; RbVariableUnits.AutoSize = false; RbVariableUnits.Name = "rbVariableUnits"; RbVariableUnits.Text = Language.T("Trade percent of your account. The percentage values show the part of the account equity used to cover the required margin."); // Label Entry Lots LblEntryLots.Parent = PnlAmounts; LblEntryLots.ForeColor = ColorText; LblEntryLots.BackColor = Color.Transparent; LblEntryLots.AutoSize = true; LblEntryLots.Text = Language.T("Number of entry lots for a new position"); // NumericUpDown Entry Lots NUDEntryLots.Parent = PnlAmounts; NUDEntryLots.Name = "nudEntryLots"; NUDEntryLots.BeginInit(); NUDEntryLots.Minimum = 0.01M; NUDEntryLots.Maximum = 100; NUDEntryLots.Increment = 0.01M; NUDEntryLots.Value = 1; NUDEntryLots.DecimalPlaces = 2; NUDEntryLots.TextAlign = HorizontalAlignment.Center; NUDEntryLots.EndInit(); // Label Entry Lots % LblPercent1.Parent = PnlAmounts; LblPercent1.ForeColor = ColorText; LblPercent1.BackColor = Color.Transparent; // Label Adding Lots LblAddingLots.Parent = PnlAmounts; LblAddingLots.ForeColor = ColorText; LblAddingLots.BackColor = Color.Transparent; LblAddingLots.AutoSize = true; LblAddingLots.Text = Language.T("In case of addition - number of lots to add"); // NumericUpDown Adding Lots NUDAddingLots.Parent = PnlAmounts; NUDAddingLots.Name = "nudAddingLots"; NUDAddingLots.BeginInit(); NUDAddingLots.Minimum = 0.01M; NUDAddingLots.Maximum = 100; NUDAddingLots.Increment = 0.01M; NUDAddingLots.Value = 1; NUDAddingLots.DecimalPlaces = 2; NUDAddingLots.TextAlign = HorizontalAlignment.Center; NUDAddingLots.EndInit(); // Label Adding Lots % LblPercent2.Parent = PnlAmounts; LblPercent2.ForeColor = ColorText; LblPercent2.BackColor = Color.Transparent; // Label Reducing Lots LblReducingLots.Parent = PnlAmounts; LblReducingLots.ForeColor = ColorText; LblReducingLots.BackColor = Color.Transparent; LblReducingLots.AutoSize = true; LblReducingLots.Text = Language.T("In case of reduction - number of lots to close"); // NumericUpDown Reducing Lots NUDReducingLots.Parent = PnlAmounts; NUDReducingLots.Name = "nudReducingLots"; NUDReducingLots.BeginInit(); NUDReducingLots.Minimum = 0.01M; NUDReducingLots.Maximum = 100; NUDReducingLots.Increment = 0.01m; NUDReducingLots.DecimalPlaces = 2; NUDReducingLots.Value = 1; NUDReducingLots.TextAlign = HorizontalAlignment.Center; NUDReducingLots.EndInit(); // CheckBox Use Martingale CbxUseMartingale.Name = "cbxUseMartingale"; CbxUseMartingale.Parent = PnlAmounts; CbxUseMartingale.ForeColor = ColorText; CbxUseMartingale.BackColor = Color.Transparent; CbxUseMartingale.AutoCheck = true; CbxUseMartingale.AutoSize = true; CbxUseMartingale.Checked = false; CbxUseMartingale.Text = Language.T("Martingale money management multiplier"); // NumericUpDown Martingale Multiplier NUDMartingaleMultiplier.Parent = PnlAmounts; NUDMartingaleMultiplier.Name = "nudMartingaleMultiplier"; NUDMartingaleMultiplier.BeginInit(); NUDMartingaleMultiplier.Minimum = 0.01M; NUDMartingaleMultiplier.Maximum = 10; NUDMartingaleMultiplier.Increment = 0.01m; NUDMartingaleMultiplier.DecimalPlaces = 2; NUDMartingaleMultiplier.Value = 2; NUDMartingaleMultiplier.TextAlign = HorizontalAlignment.Center; NUDMartingaleMultiplier.EndInit(); // Label Reducing Lots % LblPercent3.Parent = PnlAmounts; LblPercent3.ForeColor = ColorText; LblPercent3.BackColor = Color.Transparent; // CheckBox Permanent Stop Loss ChbPermaSL.Name = "chbPermaSL"; ChbPermaSL.Parent = PnlProtection; ChbPermaSL.ForeColor = ColorText; ChbPermaSL.BackColor = Color.Transparent; ChbPermaSL.AutoCheck = true; ChbPermaSL.AutoSize = true; ChbPermaSL.Checked = false; ChbPermaSL.Text = Language.T("Permanent Stop Loss"); // ComboBox cbxPermaSLType CbxPermaSLType.Parent = PnlProtection; CbxPermaSLType.Name = "cbxPermaSLType"; CbxPermaSLType.Visible = false; CbxPermaSLType.DropDownStyle = ComboBoxStyle.DropDownList; CbxPermaSLType.Items.Add(Language.T("Relative")); CbxPermaSLType.Items.Add(Language.T("Absolute")); CbxPermaSLType.SelectedIndex = 0; // NumericUpDown Permanent S/L NUDPermaSL.Name = "nudPermaSL"; NUDPermaSL.Parent = PnlProtection; NUDPermaSL.BeginInit(); NUDPermaSL.Minimum = 5; NUDPermaSL.Maximum = 5000; NUDPermaSL.Increment = 1; NUDPermaSL.Value = Data.InstrProperties.IsFiveDigits ? 1000 : 100; NUDPermaSL.TextAlign = HorizontalAlignment.Center; NUDPermaSL.EndInit(); // CheckBox Permanent Take Profit ChbPermaTP.Name = "chbPermaTP"; ChbPermaTP.Parent = PnlProtection; ChbPermaTP.ForeColor = ColorText; ChbPermaTP.BackColor = Color.Transparent; ChbPermaTP.AutoCheck = true; ChbPermaTP.AutoSize = true; ChbPermaTP.Checked = false; ChbPermaTP.Text = Language.T("Permanent Take Profit"); // ComboBox cbxPermaTPType CbxPermaTPType.Parent = PnlProtection; CbxPermaTPType.Name = "cbxPermaTPType"; CbxPermaTPType.Visible = false; CbxPermaTPType.DropDownStyle = ComboBoxStyle.DropDownList; CbxPermaTPType.Items.Add(Language.T("Relative")); CbxPermaTPType.Items.Add(Language.T("Absolute")); CbxPermaTPType.SelectedIndex = 0; // NumericUpDown Permanent Take Profit NUDPermaTP.Parent = PnlProtection; NUDPermaTP.Name = "nudPermaTP"; NUDPermaTP.BeginInit(); NUDPermaTP.Minimum = 5; NUDPermaTP.Maximum = 5000; NUDPermaTP.Increment = 1; NUDPermaTP.Value = Data.InstrProperties.IsFiveDigits ? 1000 : 100; NUDPermaTP.TextAlign = HorizontalAlignment.Center; NUDPermaTP.EndInit(); // CheckBox Break Even ChbBreakEven.Name = "chbBreakEven"; ChbBreakEven.Parent = PnlProtection; ChbBreakEven.ForeColor = ColorText; ChbBreakEven.BackColor = Color.Transparent; ChbBreakEven.AutoCheck = true; ChbBreakEven.AutoSize = true; ChbBreakEven.Checked = false; ChbBreakEven.Text = Language.T("Break Even"); // NumericUpDown Break Even NUDBreakEven.Parent = PnlProtection; NUDBreakEven.Name = "nudBreakEven"; NUDBreakEven.BeginInit(); NUDBreakEven.Minimum = 5; NUDBreakEven.Maximum = 5000; NUDBreakEven.Increment = 1; NUDBreakEven.Value = Data.InstrProperties.IsFiveDigits ? 1000 : 100; NUDBreakEven.TextAlign = HorizontalAlignment.Center; NUDBreakEven.EndInit(); //Button Default BtnDefault.Parent = this; BtnDefault.Name = "btnDefault"; BtnDefault.Text = Language.T("Default"); BtnDefault.Click += BtnDefaultClick; BtnDefault.UseVisualStyleBackColor = true; //Button Cancel BtnCancel.Parent = this; BtnCancel.Name = "btnCancel"; BtnCancel.Text = Language.T("Cancel"); BtnCancel.DialogResult = DialogResult.Cancel; BtnCancel.UseVisualStyleBackColor = true; //Button Accept BtnAccept.Parent = this; BtnAccept.Name = "btnAccept"; BtnAccept.Text = Language.T("Accept"); BtnAccept.DialogResult = DialogResult.OK; BtnAccept.UseVisualStyleBackColor = true; }
public StrategyProperties() { PnlAveraging = new FancyPanel(Language.T("Handling of Additional Entry Signals"), LayoutColors.ColorSlotCaptionBackAveraging); PnlAmounts = new FancyPanel(Language.T("Trading Size"), LayoutColors.ColorSlotCaptionBackAveraging); PnlProtection = new FancyPanel(Language.T("Permanent Protection"), LayoutColors.ColorSlotCaptionBackAveraging); BalanceChart = new SmallBalanceChart(); LblPercent1 = new Label(); LblPercent2 = new Label(); LblPercent3 = new Label(); LblSameDirAction = new Label(); LblOppDirAction = new Label(); CbxSameDirAction = new ComboBox(); CbxOppDirAction = new ComboBox(); NUDMaxOpenLots = new NUD(); RbConstantUnits = new RadioButton(); RbVariableUnits = new RadioButton(); NUDEntryLots = new NUD(); NUDAddingLots = new NUD(); NUDReducingLots = new NUD(); LblMaxOpenLots = new Label(); LblEntryLots = new Label(); LblAddingLots = new Label(); LblReducingLots = new Label(); CbxUseMartingale = new CheckBox(); NUDMartingaleMultiplier = new NUD(); ChbPermaSL = new CheckBox(); CbxPermaSLType = new ComboBox(); NUDPermaSL = new NUD(); ChbPermaTP = new CheckBox(); CbxPermaTPType = new ComboBox(); NUDPermaTP = new NUD(); ChbBreakEven = new CheckBox(); NUDBreakEven = new NUD(); BtnAccept = new Button(); BtnDefault = new Button(); BtnCancel = new Button(); ColorText = LayoutColors.ColorControlText; MaximizeBox = false; MinimizeBox = false; ShowInTaskbar = false; Icon = Data.Icon; BackColor = LayoutColors.ColorFormBack; FormBorderStyle = FormBorderStyle.FixedDialog; AcceptButton = BtnAccept; Text = Language.T("Strategy Properties"); PnlAveraging.Parent = this; PnlAmounts.Parent = this; PnlProtection.Parent = this; BalanceChart.Parent = this; BalanceChart.SetChartData(); var toolTip = new ToolTip(); // Label Same dir action LblSameDirAction.Parent = PnlAveraging; LblSameDirAction.ForeColor = ColorText; LblSameDirAction.BackColor = Color.Transparent; LblSameDirAction.AutoSize = true; LblSameDirAction.Text = Language.T("Next same direction signal behavior"); // Label Opposite dir action LblOppDirAction.Parent = PnlAveraging; LblOppDirAction.ForeColor = ColorText; LblOppDirAction.BackColor = Color.Transparent; LblOppDirAction.AutoSize = true; LblOppDirAction.Text = Language.T("Next opposite direction signal behavior"); // ComboBox SameDirAction CbxSameDirAction.Parent = PnlAveraging; CbxSameDirAction.Name = "cbxSameDirAction"; CbxSameDirAction.DropDownStyle = ComboBoxStyle.DropDownList; var sameItems = new[] {Language.T("Nothing"), Language.T("Winner"), Language.T("Add")}; foreach (var item in sameItems) CbxSameDirAction.Items.Add(item); CbxSameDirAction.SelectedIndex = 0; toolTip.SetToolTip(CbxSameDirAction, Language.T("Nothing - cancels the additional orders.") + Environment.NewLine + Language.T("Winner - adds to a winning position.") + Environment.NewLine + Language.T("Add - adds to all positions.")); // ComboBox OppDirAction CbxOppDirAction.Parent = PnlAveraging; CbxOppDirAction.Name = "cbxOppDirAction"; CbxOppDirAction.DropDownStyle = ComboBoxStyle.DropDownList; var oppItems = new[] { Language.T("Nothing"), Language.T("Reduce"), Language.T("Close"), Language.T("Reverse") }; foreach (var item in oppItems) CbxOppDirAction.Items.Add(item); CbxOppDirAction.SelectedIndex = 0; toolTip.SetToolTip(CbxOppDirAction, Language.T("Nothing - cancels the additional orders.") + Environment.NewLine + Language.T("Reduce - reduces or closes a position.") + Environment.NewLine + Language.T("Close - closes the position.") + Environment.NewLine + Language.T("Reverse - reverses the position.")); // Label MaxOpen Lots LblMaxOpenLots.Parent = PnlAmounts; LblMaxOpenLots.ForeColor = ColorText; LblMaxOpenLots.BackColor = Color.Transparent; LblMaxOpenLots.AutoSize = true; LblMaxOpenLots.Text = Language.T("Maximum number of open lots"); // NumericUpDown MaxOpen Lots NUDMaxOpenLots.Parent = PnlAmounts; NUDMaxOpenLots.Name = "nudMaxOpenLots"; NUDMaxOpenLots.BeginInit(); NUDMaxOpenLots.Minimum = 0.01M; NUDMaxOpenLots.Maximum = 100; NUDMaxOpenLots.Increment = 0.01M; NUDMaxOpenLots.Value = 20; NUDMaxOpenLots.DecimalPlaces = 2; NUDMaxOpenLots.TextAlign = HorizontalAlignment.Center; NUDMaxOpenLots.EndInit(); // Radio Button Constant Units RbConstantUnits.Parent = PnlAmounts; RbConstantUnits.ForeColor = ColorText; RbConstantUnits.BackColor = Color.Transparent; RbConstantUnits.Checked = true; RbConstantUnits.AutoSize = true; RbConstantUnits.Name = "rbConstantUnits"; RbConstantUnits.Text = Language.T("Trade a constant number of lots"); // Radio Button Variable Units RbVariableUnits.Parent = PnlAmounts; RbVariableUnits.ForeColor = ColorText; RbVariableUnits.BackColor = Color.Transparent; RbVariableUnits.Checked = false; RbVariableUnits.AutoSize = false; RbVariableUnits.Name = "rbVariableUnits"; RbVariableUnits.Text = Language.T("Trade percent of your account. The percentage values show the part of the account equity used to cover the required margin."); // Label Entry Lots LblEntryLots.Parent = PnlAmounts; LblEntryLots.ForeColor = ColorText; LblEntryLots.BackColor = Color.Transparent; LblEntryLots.AutoSize = true; LblEntryLots.Text = Language.T("Number of entry lots for a new position"); // NumericUpDown Entry Lots NUDEntryLots.Parent = PnlAmounts; NUDEntryLots.Name = "nudEntryLots"; NUDEntryLots.BeginInit(); NUDEntryLots.Minimum = 0.01M; NUDEntryLots.Maximum = 100; NUDEntryLots.Increment = 0.01M; NUDEntryLots.Value = 1; NUDEntryLots.DecimalPlaces = 2; NUDEntryLots.TextAlign = HorizontalAlignment.Center; NUDEntryLots.EndInit(); // Label Entry Lots % LblPercent1.Parent = PnlAmounts; LblPercent1.ForeColor = ColorText; LblPercent1.BackColor = Color.Transparent; // Label Adding Lots LblAddingLots.Parent = PnlAmounts; LblAddingLots.ForeColor = ColorText; LblAddingLots.BackColor = Color.Transparent; LblAddingLots.AutoSize = true; LblAddingLots.Text = Language.T("In case of addition - number of lots to add"); // NumericUpDown Adding Lots NUDAddingLots.Parent = PnlAmounts; NUDAddingLots.Name = "nudAddingLots"; NUDAddingLots.BeginInit(); NUDAddingLots.Minimum = 0.01M; NUDAddingLots.Maximum = 100; NUDAddingLots.Increment = 0.01M; NUDAddingLots.Value = 1; NUDAddingLots.DecimalPlaces = 2; NUDAddingLots.TextAlign = HorizontalAlignment.Center; NUDAddingLots.EndInit(); // Label Adding Lots % LblPercent2.Parent = PnlAmounts; LblPercent2.ForeColor = ColorText; LblPercent2.BackColor = Color.Transparent; // Label Reducing Lots LblReducingLots.Parent = PnlAmounts; LblReducingLots.ForeColor = ColorText; LblReducingLots.BackColor = Color.Transparent; LblReducingLots.AutoSize = true; LblReducingLots.Text = Language.T("In case of reduction - number of lots to close"); // NumericUpDown Reducing Lots NUDReducingLots.Parent = PnlAmounts; NUDReducingLots.Name = "nudReducingLots"; NUDReducingLots.BeginInit(); NUDReducingLots.Minimum = 0.01M; NUDReducingLots.Maximum = 100; NUDReducingLots.Increment = 0.01m; NUDReducingLots.DecimalPlaces = 2; NUDReducingLots.Value = 1; NUDReducingLots.TextAlign = HorizontalAlignment.Center; NUDReducingLots.EndInit(); // CheckBox Use Martingale CbxUseMartingale.Name = "cbxUseMartingale"; CbxUseMartingale.Parent = PnlAmounts; CbxUseMartingale.ForeColor = ColorText; CbxUseMartingale.BackColor = Color.Transparent; CbxUseMartingale.AutoCheck = true; CbxUseMartingale.AutoSize = true; CbxUseMartingale.Checked = false; CbxUseMartingale.Text = Language.T("Martingale money management multiplier"); // NumericUpDown Martingale Multiplier NUDMartingaleMultiplier.Parent = PnlAmounts; NUDMartingaleMultiplier.Name = "nudMartingaleMultiplier"; NUDMartingaleMultiplier.BeginInit(); NUDMartingaleMultiplier.Minimum = 0.01M; NUDMartingaleMultiplier.Maximum = 10; NUDMartingaleMultiplier.Increment = 0.01m; NUDMartingaleMultiplier.DecimalPlaces = 2; NUDMartingaleMultiplier.Value = 2; NUDMartingaleMultiplier.TextAlign = HorizontalAlignment.Center; NUDMartingaleMultiplier.EndInit(); // Label Reducing Lots % LblPercent3.Parent = PnlAmounts; LblPercent3.ForeColor = ColorText; LblPercent3.BackColor = Color.Transparent; // CheckBox Permanent Stop Loss ChbPermaSL.Name = "chbPermaSL"; ChbPermaSL.Parent = PnlProtection; ChbPermaSL.ForeColor = ColorText; ChbPermaSL.BackColor = Color.Transparent; ChbPermaSL.AutoCheck = true; ChbPermaSL.AutoSize = true; ChbPermaSL.Checked = false; ChbPermaSL.Text = Language.T("Permanent Stop Loss"); // ComboBox cbxPermaSLType CbxPermaSLType.Parent = PnlProtection; CbxPermaSLType.Name = "cbxPermaSLType"; CbxPermaSLType.Visible = false; CbxPermaSLType.DropDownStyle = ComboBoxStyle.DropDownList; CbxPermaSLType.Items.Add(Language.T("Relative")); CbxPermaSLType.Items.Add(Language.T("Absolute")); CbxPermaSLType.SelectedIndex = 0; // NumericUpDown Permanent S/L NUDPermaSL.Name = "nudPermaSL"; NUDPermaSL.Parent = PnlProtection; NUDPermaSL.BeginInit(); NUDPermaSL.Minimum = 5; NUDPermaSL.Maximum = 5000; NUDPermaSL.Increment = 1; NUDPermaSL.Value = Data.InstrProperties.IsFiveDigits ? 1000 : 100; NUDPermaSL.TextAlign = HorizontalAlignment.Center; NUDPermaSL.EndInit(); // CheckBox Permanent Take Profit ChbPermaTP.Name = "chbPermaTP"; ChbPermaTP.Parent = PnlProtection; ChbPermaTP.ForeColor = ColorText; ChbPermaTP.BackColor = Color.Transparent; ChbPermaTP.AutoCheck = true; ChbPermaTP.AutoSize = true; ChbPermaTP.Checked = false; ChbPermaTP.Text = Language.T("Permanent Take Profit"); // ComboBox cbxPermaTPType CbxPermaTPType.Parent = PnlProtection; CbxPermaTPType.Name = "cbxPermaTPType"; CbxPermaTPType.Visible = false; CbxPermaTPType.DropDownStyle = ComboBoxStyle.DropDownList; CbxPermaTPType.Items.Add(Language.T("Relative")); CbxPermaTPType.Items.Add(Language.T("Absolute")); CbxPermaTPType.SelectedIndex = 0; // NumericUpDown Permanent Take Profit NUDPermaTP.Parent = PnlProtection; NUDPermaTP.Name = "nudPermaTP"; NUDPermaTP.BeginInit(); NUDPermaTP.Minimum = 5; NUDPermaTP.Maximum = 5000; NUDPermaTP.Increment = 1; NUDPermaTP.Value = Data.InstrProperties.IsFiveDigits ? 1000 : 100; NUDPermaTP.TextAlign = HorizontalAlignment.Center; NUDPermaTP.EndInit(); // CheckBox Break Even ChbBreakEven.Name = "chbBreakEven"; ChbBreakEven.Parent = PnlProtection; ChbBreakEven.ForeColor = ColorText; ChbBreakEven.BackColor = Color.Transparent; ChbBreakEven.AutoCheck = true; ChbBreakEven.AutoSize = true; ChbBreakEven.Checked = false; ChbBreakEven.Text = Language.T("Break Even"); // NumericUpDown Break Even NUDBreakEven.Parent = PnlProtection; NUDBreakEven.Name = "nudBreakEven"; NUDBreakEven.BeginInit(); NUDBreakEven.Minimum = 5; NUDBreakEven.Maximum = 5000; NUDBreakEven.Increment = 1; NUDBreakEven.Value = Data.InstrProperties.IsFiveDigits ? 1000 : 100; NUDBreakEven.TextAlign = HorizontalAlignment.Center; NUDBreakEven.EndInit(); //Button Default BtnDefault.Parent = this; BtnDefault.Name = "btnDefault"; BtnDefault.Text = Language.T("Default"); BtnDefault.Click += BtnDefaultClick; BtnDefault.UseVisualStyleBackColor = true; //Button Cancel BtnCancel.Parent = this; BtnCancel.Name = "btnCancel"; BtnCancel.Text = Language.T("Cancel"); BtnCancel.DialogResult = DialogResult.Cancel; BtnCancel.UseVisualStyleBackColor = true; //Button Accept BtnAccept.Parent = this; BtnAccept.Name = "btnAccept"; BtnAccept.Text = Language.T("Accept"); BtnAccept.DialogResult = DialogResult.OK; BtnAccept.UseVisualStyleBackColor = true; }
/// <summary> /// Constructor /// </summary> public IndicatorDialog(int slotNumb, SlotTypes slotType, bool isDefined) { _slot = slotNumb; _slotType = slotType; if (slotType == SlotTypes.Open) { _slotCation = Language.T("Opening Point of the Position"); PnlParameters = new FancyPanel(_slotCation, LayoutColors.ColorSlotCaptionBackOpen); PnlTreeViewBase = new FancyPanel(Language.T("Indicators"), LayoutColors.ColorSlotCaptionBackOpen); } else if (slotType == SlotTypes.OpenFilter) { _slotCation = Language.T("Opening Logic Condition"); PnlParameters = new FancyPanel(_slotCation, LayoutColors.ColorSlotCaptionBackOpenFilter); PnlTreeViewBase = new FancyPanel(Language.T("Indicators"), LayoutColors.ColorSlotCaptionBackOpenFilter); } else if (slotType == SlotTypes.Close) { _slotCation = Language.T("Closing Point of the Position"); PnlParameters = new FancyPanel(_slotCation, LayoutColors.ColorSlotCaptionBackClose); PnlTreeViewBase = new FancyPanel(Language.T("Indicators"), LayoutColors.ColorSlotCaptionBackClose); } else { _slotCation = Language.T("Closing Logic Condition"); PnlParameters = new FancyPanel(_slotCation, LayoutColors.ColorSlotCaptionBackCloseFilter); PnlTreeViewBase = new FancyPanel(Language.T("Indicators"), LayoutColors.ColorSlotCaptionBackCloseFilter); } TrvIndicators = new TreeView(); BalanceChart = new SmallBalanceChart(); BtnAccept = new Button(); BtnHelp = new Button(); BtnDefault = new Button(); BtnCancel = new Button(); LblIndicatorInfo = new Label(); LblIndicatorWarning = new Label(); LblIndicator = new Label(); LblGroup = new Label(); CbxGroup = new ComboBox(); ALblList = new Label[5]; ACbxList = new ComboBox[5]; ALblNumeric = new Label[6]; ANudNumeric = new NUD[6]; AChbCheck = new CheckBox[2]; BackColor = LayoutColors.ColorFormBack; FormBorderStyle = FormBorderStyle.FixedDialog; Icon = Data.Icon; MaximizeBox = false; MinimizeBox = false; ShowInTaskbar = false; AcceptButton = BtnAccept; CancelButton = BtnCancel; Text = Language.T("Logic and Parameters of the Indicators"); // Panel TreeViewBase PnlTreeViewBase.Parent = this; PnlTreeViewBase.Padding = new Padding(Border, (int) PnlTreeViewBase.CaptionHeight, Border, Border); // TreeView trvIndicators TrvIndicators.Parent = PnlTreeViewBase; TrvIndicators.Dock = DockStyle.Fill; TrvIndicators.BackColor = LayoutColors.ColorControlBack; TrvIndicators.ForeColor = LayoutColors.ColorControlText; TrvIndicators.BorderStyle = BorderStyle.None; TrvIndicators.NodeMouseDoubleClick += TrvIndicatorsNodeMouseDoubleClick; TrvIndicators.KeyPress += TrvIndicatorsKeyPress; PnlParameters.Parent = this; // pnlSmallBalanceChart BalanceChart.Parent = this; // lblIndicatorInfo LblIndicatorInfo.Parent = PnlParameters; LblIndicatorInfo.Size = new Size(16, 16); LblIndicatorInfo.BackColor = Color.Transparent; LblIndicatorInfo.BackgroundImage = Resources.information; LblIndicatorInfo.Click += LblIndicatorInfoClick; LblIndicatorInfo.MouseEnter += LabelMouseEnter; LblIndicatorInfo.MouseLeave += LabelMouseLeave; // lblIndicatorWarning LblIndicatorWarning.Parent = PnlParameters; LblIndicatorWarning.Size = new Size(16, 16); LblIndicatorWarning.BackColor = Color.Transparent; LblIndicatorWarning.BackgroundImage = Resources.warning; LblIndicatorWarning.Visible = false; LblIndicatorWarning.Click += LblIndicatorWarningClick; LblIndicatorWarning.MouseEnter += LabelMouseEnter; LblIndicatorWarning.MouseLeave += LabelMouseLeave; // Label Indicator LblIndicator.Parent = PnlParameters; LblIndicator.TextAlign = ContentAlignment.MiddleCenter; LblIndicator.Font = new Font(Font.FontFamily, 14, FontStyle.Bold); LblIndicator.ForeColor = LayoutColors.ColorSlotIndicatorText; LblIndicator.BackColor = Color.Transparent; // Label ALblList[0] ALblList[0] = new Label { Parent = PnlParameters, TextAlign = ContentAlignment.BottomCenter, ForeColor = LayoutColors.ColorControlText, BackColor = Color.Transparent }; // ComboBox ACbxList[0] ACbxList[0] = new ComboBox {Parent = PnlParameters, DropDownStyle = ComboBoxStyle.DropDownList}; ACbxList[0].SelectedIndexChanged += ParamChanged; // Logical Group LblGroup = new Label { Parent = PnlParameters, TextAlign = ContentAlignment.BottomCenter, ForeColor = LayoutColors.ColorControlText, BackColor = Color.Transparent, Text = Language.T("Group") }; CbxGroup = new ComboBox {Parent = PnlParameters}; if (slotType == SlotTypes.OpenFilter) CbxGroup.Items.AddRange(new object[] {"A", "B", "C", "D", "E", "F", "G", "H", "All"}); if (slotType == SlotTypes.CloseFilter) CbxGroup.Items.AddRange(new object[] {"a", "b", "c", "d", "e", "f", "g", "h", "all"}); CbxGroup.SelectedIndexChanged += GroupChanged; CbxGroup.DropDownStyle = ComboBoxStyle.DropDownList; _toolTip.SetToolTip(CbxGroup, Language.T("The logical group of the slot.")); // ListParams for (int i = 1; i < 5; i++) { ALblList[i] = new Label { Parent = PnlParameters, TextAlign = ContentAlignment.BottomCenter, ForeColor = LayoutColors.ColorControlText, BackColor = Color.Transparent }; ACbxList[i] = new ComboBox { Parent = PnlParameters, Enabled = false, DropDownStyle = ComboBoxStyle.DropDownList }; ACbxList[i].SelectedIndexChanged += ParamChanged; } // NumParams for (int i = 0; i < 6; i++) { ALblNumeric[i] = new Label { Parent = PnlParameters, TextAlign = ContentAlignment.MiddleRight, ForeColor = LayoutColors.ColorControlText, BackColor = Color.Transparent }; ANudNumeric[i] = new NUD {Parent = PnlParameters, TextAlign = HorizontalAlignment.Center, Enabled = false}; ANudNumeric[i].ValueChanged += ParamChanged; } // CheckParams for (int i = 0; i < 2; i++) { AChbCheck[i] = new CheckBox { Parent = PnlParameters, CheckAlign = ContentAlignment.MiddleLeft, TextAlign = ContentAlignment.MiddleLeft, ForeColor = LayoutColors.ColorControlText, BackColor = Color.Transparent, Enabled = false }; AChbCheck[i].CheckedChanged += ParamChanged; } //Button Accept BtnAccept.Parent = this; BtnAccept.Text = Language.T("Accept"); BtnAccept.DialogResult = DialogResult.OK; BtnAccept.Click += BtnOkClick; BtnAccept.UseVisualStyleBackColor = true; //Button Default BtnDefault.Parent = this; BtnDefault.Text = Language.T("Default"); BtnDefault.Click += BtnDefaultClick; BtnDefault.UseVisualStyleBackColor = true; //Button Help BtnHelp.Parent = this; BtnHelp.Text = Language.T("Help"); BtnHelp.Click += BtnHelpClick; BtnHelp.UseVisualStyleBackColor = true; //Button Cancel BtnCancel.Parent = this; BtnCancel.Text = Language.T("Cancel"); BtnCancel.DialogResult = DialogResult.Cancel; BtnCancel.UseVisualStyleBackColor = true; SetTreeViewIndicators(); // ComboBoxindicator index selection. if (isDefined) { TreeNode[] atrn = TrvIndicators.Nodes.Find(Data.Strategy.Slot[_slot].IndParam.IndicatorName, true); TrvIndicators.SelectedNode = atrn[0]; UpdateFromIndicatorParam(Data.Strategy.Slot[_slot].IndParam); SetLogicalGroup(); CalculateIndicator(false); BalanceChart.SetChartData(); BalanceChart.InitChart(); BalanceChart.Invalidate(); } else { string defaultIndicator; if (slotType == SlotTypes.Open) defaultIndicator = "Bar Opening"; else if (slotType == SlotTypes.OpenFilter) defaultIndicator = "Accelerator Oscillator"; else if (slotType == SlotTypes.Close) defaultIndicator = "Bar Closing"; else defaultIndicator = "Accelerator Oscillator"; TreeNode[] atrn = TrvIndicators.Nodes.Find(defaultIndicator, true); TrvIndicators.SelectedNode = atrn[0]; TrvIndicatorsLoadIndicator(); } _oppSignalBehaviour = Data.Strategy.OppSignalAction; if (slotType == SlotTypes.Close && Data.Strategy.CloseFilters > 0) for (int iSlot = Data.Strategy.CloseSlot + 1; iSlot < Data.Strategy.Slots; iSlot++) _closingConditions.Add(Data.Strategy.Slot[iSlot].Clone()); }
/// <summary> /// Constructor /// </summary> public IndicatorDialog(int slotNumb, SlotTypes slotType, bool isDefined) { _slot = slotNumb; _slotType = slotType; if (slotType == SlotTypes.Open) { _slotCation = Language.T("Opening Point of the Position"); PnlParameters = new FancyPanel(_slotCation, LayoutColors.ColorSlotCaptionBackOpen); PnlTreeViewBase = new FancyPanel(Language.T("Indicators"), LayoutColors.ColorSlotCaptionBackOpen); } else if (slotType == SlotTypes.OpenFilter) { _slotCation = Language.T("Opening Logic Condition"); PnlParameters = new FancyPanel(_slotCation, LayoutColors.ColorSlotCaptionBackOpenFilter); PnlTreeViewBase = new FancyPanel(Language.T("Indicators"), LayoutColors.ColorSlotCaptionBackOpenFilter); } else if (slotType == SlotTypes.Close) { _slotCation = Language.T("Closing Point of the Position"); PnlParameters = new FancyPanel(_slotCation, LayoutColors.ColorSlotCaptionBackClose); PnlTreeViewBase = new FancyPanel(Language.T("Indicators"), LayoutColors.ColorSlotCaptionBackClose); } else { _slotCation = Language.T("Closing Logic Condition"); PnlParameters = new FancyPanel(_slotCation, LayoutColors.ColorSlotCaptionBackCloseFilter); PnlTreeViewBase = new FancyPanel(Language.T("Indicators"), LayoutColors.ColorSlotCaptionBackCloseFilter); } TrvIndicators = new TreeView(); BalanceChart = new SmallBalanceChart(); BtnAccept = new Button(); BtnHelp = new Button(); BtnDefault = new Button(); BtnCancel = new Button(); LblIndicatorInfo = new Label(); LblIndicatorWarning = new Label(); LblIndicator = new Label(); LblGroup = new Label(); CbxGroup = new ComboBox(); ALblList = new Label[5]; ACbxList = new ComboBox[5]; ALblNumeric = new Label[6]; ANudNumeric = new NUD[6]; AChbCheck = new CheckBox[2]; BackColor = LayoutColors.ColorFormBack; FormBorderStyle = FormBorderStyle.FixedDialog; Icon = Data.Icon; MaximizeBox = false; MinimizeBox = false; ShowInTaskbar = false; AcceptButton = BtnAccept; CancelButton = BtnCancel; Text = Language.T("Logic and Parameters of the Indicators"); // Panel TreeViewBase PnlTreeViewBase.Parent = this; PnlTreeViewBase.Padding = new Padding(Border, (int)PnlTreeViewBase.CaptionHeight, Border, Border); // TreeView trvIndicators TrvIndicators.Parent = PnlTreeViewBase; TrvIndicators.Dock = DockStyle.Fill; TrvIndicators.BackColor = LayoutColors.ColorControlBack; TrvIndicators.ForeColor = LayoutColors.ColorControlText; TrvIndicators.BorderStyle = BorderStyle.None; TrvIndicators.NodeMouseDoubleClick += TrvIndicatorsNodeMouseDoubleClick; TrvIndicators.KeyPress += TrvIndicatorsKeyPress; PnlParameters.Parent = this; // pnlSmallBalanceChart BalanceChart.Parent = this; // lblIndicatorInfo LblIndicatorInfo.Parent = PnlParameters; LblIndicatorInfo.Size = new Size(16, 16); LblIndicatorInfo.BackColor = Color.Transparent; LblIndicatorInfo.BackgroundImage = Resources.information; LblIndicatorInfo.Click += LblIndicatorInfoClick; LblIndicatorInfo.MouseEnter += LabelMouseEnter; LblIndicatorInfo.MouseLeave += LabelMouseLeave; // lblIndicatorWarning LblIndicatorWarning.Parent = PnlParameters; LblIndicatorWarning.Size = new Size(16, 16); LblIndicatorWarning.BackColor = Color.Transparent; LblIndicatorWarning.BackgroundImage = Resources.warning; LblIndicatorWarning.Visible = false; LblIndicatorWarning.Click += LblIndicatorWarningClick; LblIndicatorWarning.MouseEnter += LabelMouseEnter; LblIndicatorWarning.MouseLeave += LabelMouseLeave; // Label Indicator LblIndicator.Parent = PnlParameters; LblIndicator.TextAlign = ContentAlignment.MiddleCenter; LblIndicator.Font = new Font(Font.FontFamily, 14, FontStyle.Bold); LblIndicator.ForeColor = LayoutColors.ColorSlotIndicatorText; LblIndicator.BackColor = Color.Transparent; // Label ALblList[0] ALblList[0] = new Label { Parent = PnlParameters, TextAlign = ContentAlignment.BottomCenter, ForeColor = LayoutColors.ColorControlText, BackColor = Color.Transparent }; // ComboBox ACbxList[0] ACbxList[0] = new ComboBox { Parent = PnlParameters, DropDownStyle = ComboBoxStyle.DropDownList }; ACbxList[0].SelectedIndexChanged += ParamChanged; // Logical Group LblGroup = new Label { Parent = PnlParameters, TextAlign = ContentAlignment.BottomCenter, ForeColor = LayoutColors.ColorControlText, BackColor = Color.Transparent, Text = Language.T("Group") }; CbxGroup = new ComboBox { Parent = PnlParameters }; if (slotType == SlotTypes.OpenFilter) { CbxGroup.Items.AddRange(new object[] { "A", "B", "C", "D", "E", "F", "G", "H", "All" }); } if (slotType == SlotTypes.CloseFilter) { CbxGroup.Items.AddRange(new object[] { "a", "b", "c", "d", "e", "f", "g", "h", "all" }); } CbxGroup.SelectedIndexChanged += GroupChanged; CbxGroup.DropDownStyle = ComboBoxStyle.DropDownList; _toolTip.SetToolTip(CbxGroup, Language.T("The logical group of the slot.")); // ListParams for (int i = 1; i < 5; i++) { ALblList[i] = new Label { Parent = PnlParameters, TextAlign = ContentAlignment.BottomCenter, ForeColor = LayoutColors.ColorControlText, BackColor = Color.Transparent }; ACbxList[i] = new ComboBox { Parent = PnlParameters, Enabled = false, DropDownStyle = ComboBoxStyle.DropDownList }; ACbxList[i].SelectedIndexChanged += ParamChanged; } // NumParams for (int i = 0; i < 6; i++) { ALblNumeric[i] = new Label { Parent = PnlParameters, TextAlign = ContentAlignment.MiddleRight, ForeColor = LayoutColors.ColorControlText, BackColor = Color.Transparent }; ANudNumeric[i] = new NUD { Parent = PnlParameters, TextAlign = HorizontalAlignment.Center, Enabled = false }; ANudNumeric[i].ValueChanged += ParamChanged; } // CheckParams for (int i = 0; i < 2; i++) { AChbCheck[i] = new CheckBox { Parent = PnlParameters, CheckAlign = ContentAlignment.MiddleLeft, TextAlign = ContentAlignment.MiddleLeft, ForeColor = LayoutColors.ColorControlText, BackColor = Color.Transparent, Enabled = false }; AChbCheck[i].CheckedChanged += ParamChanged; } //Button Accept BtnAccept.Parent = this; BtnAccept.Text = Language.T("Accept"); BtnAccept.DialogResult = DialogResult.OK; BtnAccept.Click += BtnOkClick; BtnAccept.UseVisualStyleBackColor = true; //Button Default BtnDefault.Parent = this; BtnDefault.Text = Language.T("Default"); BtnDefault.Click += BtnDefaultClick; BtnDefault.UseVisualStyleBackColor = true; //Button Help BtnHelp.Parent = this; BtnHelp.Text = Language.T("Help"); BtnHelp.Click += BtnHelpClick; BtnHelp.UseVisualStyleBackColor = true; //Button Cancel BtnCancel.Parent = this; BtnCancel.Text = Language.T("Cancel"); BtnCancel.DialogResult = DialogResult.Cancel; BtnCancel.UseVisualStyleBackColor = true; SetTreeViewIndicators(); // ComboBoxindicator index selection. if (isDefined) { TreeNode[] atrn = TrvIndicators.Nodes.Find(Data.Strategy.Slot[_slot].IndParam.IndicatorName, true); TrvIndicators.SelectedNode = atrn[0]; UpdateFromIndicatorParam(Data.Strategy.Slot[_slot].IndParam); SetLogicalGroup(); CalculateIndicator(false); BalanceChart.SetChartData(); BalanceChart.InitChart(); BalanceChart.Invalidate(); } else { string defaultIndicator; if (slotType == SlotTypes.Open) { defaultIndicator = "Bar Opening"; } else if (slotType == SlotTypes.OpenFilter) { defaultIndicator = "Accelerator Oscillator"; } else if (slotType == SlotTypes.Close) { defaultIndicator = "Bar Closing"; } else { defaultIndicator = "Accelerator Oscillator"; } TreeNode[] atrn = TrvIndicators.Nodes.Find(defaultIndicator, true); TrvIndicators.SelectedNode = atrn[0]; TrvIndicatorsLoadIndicator(); } _oppSignalBehaviour = Data.Strategy.OppSignalAction; if (slotType == SlotTypes.Close && Data.Strategy.CloseFilters > 0) { for (int iSlot = Data.Strategy.CloseSlot + 1; iSlot < Data.Strategy.Slots; iSlot++) { _closingConditions.Add(Data.Strategy.Slot[iSlot].Clone()); } } }
/// <summary> /// Initializes the controls in panel pnlOverview /// </summary> private void InitializeAccount() { var toolTip = new ToolTip(); string[] methods = Enum.GetNames(typeof (InterpolationMethod)); for (int i = 0; i < methods.Length; i++) methods[i] = Language.T(methods[i]); Graphics g = CreateGraphics(); int maxWidth = 0; foreach (string method in methods) if ((int) g.MeasureString(method, Font).Width > maxWidth) maxWidth = (int) g.MeasureString(method, Font).Width; g.Dispose(); // ComboBox Interpolation Methods ComboBoxInterpolationMethod = new ToolStripComboBox { Name = "ComboBoxInterpolationMethod", AutoSize = false, DropDownStyle = ComboBoxStyle.DropDownList, Width = maxWidth + (int) (18*Data.HorizontalDLU), ToolTipText = Language.T("Bar interpolation method.") }; foreach (string method in methods) ComboBoxInterpolationMethod.Items.Add(method); ComboBoxInterpolationMethod.SelectedIndex = 0; ComboBoxInterpolationMethod.SelectedIndexChanged += SelectedIndexChanged; ToolStripAccount.Items.Add(ComboBoxInterpolationMethod); // Button Comparator var tsbtComparator = new ToolStripButton {Text = Language.T("Comparator"), Name = "Comparator"}; tsbtComparator.Click += BtnToolsOnClick; tsbtComparator.ToolTipText = Language.T("Compare the interpolating methods."); ToolStripAccount.Items.Add(tsbtComparator); // Button Scanner var tsbtScanner = new ToolStripButton {Text = Language.T("Scanner"), Name = "Scanner"}; tsbtScanner.Click += BtnToolsOnClick; tsbtScanner.ToolTipText = Language.T("Perform a deep intrabar scan.") + Environment.NewLine + Language.T("Quick scan") + " - F6."; ToolStripAccount.Items.Add(tsbtScanner); // Button Analyzer var tsbtAnalyzer = new ToolStripButton {Text = Language.T("Analyzer"), Name = "Analyzer"}; tsbtAnalyzer.Click += BtnToolsOnClick; ToolStripAccount.Items.Add(tsbtAnalyzer); // Info Panel Account Statistics InfoPanelAccountStatistics = new InfoPanel {Parent = PanelAccount, Dock = DockStyle.Fill}; new Splitter {Parent = PanelAccount, Dock = DockStyle.Bottom, BorderStyle = BorderStyle.None, Height = Gap}; // Small Balance Chart BalanceChart = new SmallBalanceChart { Parent = PanelAccount, Cursor = Cursors.Hand, Dock = DockStyle.Bottom, MinimumSize = new Size(100, 50), ShowDynamicInfo = true, IsContextButtonVisible = true }; BalanceChart.PopUpContextMenu.Items.AddRange(GetBalanceChartContextMenuItems()); BalanceChart.MouseMove += SmallBalanceChartMouseMove; BalanceChart.MouseLeave += SmallBalanceChartMouseLeave; BalanceChart.MouseUp += SmallBalanceChart_MouseUp; toolTip.SetToolTip(BalanceChart, Language.T("Click to view the full chart.") + Environment.NewLine + Language.T("Right click to detach chart.")); PanelAccount.Resize += PnlAccountResize; }
/// <summary> /// Constructor /// </summary> public Scanner() { InfoPanel = new Panel(); BalanceChart = new SmallBalanceChart(); ProgressBar = new ProgressBar(); LblProgress = new Label(); ChbAutoscan = new CheckBox(); ChbTickScan = new CheckBox(); BtnClose = new Button(); MaximizeBox = false; MinimizeBox = false; ShowInTaskbar = false; Icon = Data.Icon; FormBorderStyle = FormBorderStyle.FixedDialog; AcceptButton = BtnClose; Text = Language.T("Intrabar Scanner"); BackColor = LayoutColors.ColorFormBack; FormClosing += ScannerFormClosing; _colorText = LayoutColors.ColorControlText; _fontInfo = new Font(Font.FontFamily, 9); _infoRowHeight = Math.Max(_fontInfo.Height, 18); _isTickDataFile = CheckTickDataFile(); // pnlInfo InfoPanel.Parent = this; InfoPanel.BackColor = LayoutColors.ColorControlBack; InfoPanel.Paint += PnlInfoPaint; // Small Balance Chart BalanceChart.Parent = this; // ProgressBar ProgressBar.Parent = this; // Label Progress LblProgress.Parent = this; LblProgress.ForeColor = LayoutColors.ColorControlText; LblProgress.AutoSize = true; // Automatic Scan checkbox. ChbAutoscan.Parent = this; ChbAutoscan.ForeColor = _colorText; ChbAutoscan.BackColor = Color.Transparent; ChbAutoscan.Text = Language.T("Automatic Scan"); ChbAutoscan.Checked = Configs.Autoscan; ChbAutoscan.AutoSize = true; ChbAutoscan.CheckedChanged += ChbAutoscanCheckedChanged; // Tick Scan checkbox. ChbTickScan.Parent = this; ChbTickScan.ForeColor = _colorText; ChbTickScan.BackColor = Color.Transparent; ChbTickScan.Text = Language.T("Use Ticks"); ChbTickScan.Checked = Configs.UseTickData && _isTickDataFile; ChbTickScan.AutoSize = true; ChbTickScan.Visible = _isTickDataFile; ChbTickScan.CheckedChanged += ChbTickScanCheckedChanged; //Button Close BtnClose.Parent = this; BtnClose.Name = "Close"; BtnClose.Text = Language.T("Close"); BtnClose.DialogResult = DialogResult.OK; BtnClose.UseVisualStyleBackColor = true; // BackGroundWorker BgWorker = new BackgroundWorker {WorkerReportsProgress = true, WorkerSupportsCancellation = true}; BgWorker.DoWork += BgWorkerDoWork; BgWorker.ProgressChanged += BgWorkerProgressChanged; BgWorker.RunWorkerCompleted += BgWorkerRunWorkerCompleted; _isLoadingNow = false; if (!_isTickDataFile) Configs.UseTickData = false; }