/// <summary> /// Constructor /// </summary> public Balance_Chart() { Text = Language.T("Balance / Equity Chart"); Icon = Data.Icon; AcceptButton = btnClose; // Button Close btnClose = new Button(); btnClose.Parent = this; btnClose.Text = Language.T("Close"); btnClose.DialogResult = DialogResult.Cancel; btnClose.UseVisualStyleBackColor = true; // Balance chart balanceChart = new Small_Balance_Chart(); balanceChart.Parent = this; balanceChart.MouseMove += new MouseEventHandler(BalanceChart_MouseMove); balanceChart.MouseLeave += new EventHandler(BalanceChart_MouseLeave); balanceChart.ShowDynamicInfo = true; balanceChart.SetChartData(); balanceChart.InitChart(); // Label Dynamic Info lblDynInfo = new Label(); lblDynInfo.Parent = this; lblDynInfo.ForeColor = LayoutColors.ColorControlText; lblDynInfo.BackColor = Color.Transparent; }
/// <summary> /// Show the dynamic info on the status bar. /// </summary> void BalanceChart_MouseMove(object sender, MouseEventArgs e) { Small_Balance_Chart chart = (Small_Balance_Chart)sender; lblDynInfo.Text = chart.CurrentBarInfo; return; }
/// <summary> /// Constructor /// </summary> public Generator() { strategyBest = Data.Strategy.Clone(); bestBalance = isOOS ? Backtester.Balance(barOOS) : Backtester.NetBalance; isGenerating = false; isStartegyChanged = false; indicatorBlackList = new List<string>(); font = this.Font; colorText = LayoutColors.ColorControlText; tsStrategy = new ToolStrip(); tsGenerator = new ToolStrip(); strategyLayout = new Strategy_Layout(strategyBest); pnlCommon = new Fancy_Panel(Language.T("Common")); pnlLimitations = new Fancy_Panel(Language.T("Limitations")); pnlSettings = new Fancy_Panel(Language.T("Settings")); pnlTop10 = new Fancy_Panel(Language.T("Top 10")); pnlIndicators = new Fancy_Panel(Language.T("Indicators")); smallBalanceChart = new Small_Balance_Chart(); infpnlAccountStatistics = new Info_Panel(); progressBar = new ProgressBar(); lblCalcStrInfo = new Label(); lblCalcStrNumb = new Label(); btnAccept = new Button(); btnGenerate = new Button(); btnCancel = new Button(); chbGenerateNewStrategy = new CheckBox(); chbPreservPermSL = new CheckBox(); chbPreservPermTP = new CheckBox(); chbInitialOptimisation = new CheckBox(); nudWorkingMinutes = new NumericUpDown(); lblWorkingMinutes = new Label(); MaximizeBox = false; Icon = Data.Icon; FormBorderStyle = FormBorderStyle.FixedDialog; BackColor = LayoutColors.ColorFormBack; AcceptButton = btnGenerate; Text = Language.T("Strategy Generator") + " - " + Data.Symbol + " " + Data.PeriodString + ", " + Data.Bars.ToString() + " " + Language.T("bars"); FormClosing += new FormClosingEventHandler(Generator_FormClosing); // Tool Strip Strategy tsStrategy.Parent = this; tsStrategy.Dock = DockStyle.None; tsStrategy.AutoSize = false; // Tool Strip Generator tsGenerator.Parent = this; tsGenerator.Dock = DockStyle.None; tsGenerator.AutoSize = false; // Creates a Strategy Layout strategyLayout.Parent = this; strategyLayout.ShowAddSlotButtons = false; strategyLayout.ShowRemoveSlotButtons = false; strategyLayout.ShowPadlockImg = true; strategyLayout.SlotPropertiesTipText = Language.T("Lock or unlock the slot."); strategyLayout.SlotToolTipText = Language.T("Lock, link, or unlock the slot."); pnlCommon.Parent = this; pnlLimitations.Parent = this; pnlSettings.Parent = this; pnlTop10.Parent = this; pnlIndicators.Parent = this; // smallBalanceChart smallBalanceChart.Parent = this; smallBalanceChart.BackColor = LayoutColors.ColorControlBack; smallBalanceChart.Visible = true; smallBalanceChart.Cursor = Cursors.Hand; smallBalanceChart.Click += new EventHandler(AccountAutput_Click); smallBalanceChart.DoubleClick += new EventHandler(AccountAutput_Click); toolTip.SetToolTip(smallBalanceChart, Language.T("Show account statistics.")); smallBalanceChart.SetChartData(); // Info Panel Account Statistics infpnlAccountStatistics.Parent = this; infpnlAccountStatistics.Visible = false; infpnlAccountStatistics.Cursor = Cursors.Hand; infpnlAccountStatistics.Click += new EventHandler(AccountAutput_Click); infpnlAccountStatistics.DoubleClick += new EventHandler(AccountAutput_Click); toolTip.SetToolTip(infpnlAccountStatistics, Language.T("Show account chart.")); // ProgressBar progressBar.Parent = this; progressBar.Minimum = 1; progressBar.Maximum = 100; progressBar.Step = 1; //Button Generate btnGenerate.Parent = this; btnGenerate.Name = "Generate"; btnGenerate.Text = Language.T("Generate"); btnGenerate.Click += new EventHandler(BtnGenerate_Click); btnGenerate.UseVisualStyleBackColor = true; //Button Accept btnAccept.Parent = this; btnAccept.Name = "Accept"; btnAccept.Text = Language.T("Accept"); btnAccept.Enabled = false; btnAccept.DialogResult = DialogResult.OK; btnAccept.UseVisualStyleBackColor = true; //Button Cancel btnCancel.Parent = this; btnCancel.Text = Language.T("Cancel"); btnCancel.DialogResult = DialogResult.Cancel; btnCancel.UseVisualStyleBackColor = true; // BackgroundWorker bgWorker = new BackgroundWorker(); bgWorker.WorkerReportsProgress = true; bgWorker.WorkerSupportsCancellation = true; bgWorker.DoWork += new DoWorkEventHandler(BgWorker_DoWork); bgWorker.ProgressChanged += new ProgressChangedEventHandler(BgWorker_ProgressChanged); bgWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(BgWorker_RunWorkerCompleted); SetButtonsStrategy(); SetButtonsGenerator(); SetPanelCommon(); SetPanelLimitations(); SetPanelSettings(); SetPanelTop10(); SetPanelIndicators(); LoadOptions(); SetSrategyDescriptionButton(); chbHideFSB.CheckedChanged += new EventHandler(HideFSB_Click); return; }